2 * xml_stats.c: Functions used by sadf to display statistics in XML.
3 * (C) 1999-2021 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
28 #include "xml_stats.h"
33 #define _(string) gettext(string)
35 #define _(string) (string)
38 extern uint64_t flags;
41 ***************************************************************************
42 * Open or close <network> markup.
45 * @tab Number of tabulations.
46 * @action Open or close action.
47 ***************************************************************************
49 void xml_markup_network(int tab, int action)
51 static int markup_state = CLOSE_XML_MARKUP;
53 if (action == markup_state)
55 markup_state = action;
57 if (action == OPEN_XML_MARKUP) {
59 xprintf(tab, "<network per=\"second\">");
63 xprintf(tab, "</network>");
68 ***************************************************************************
69 * Open or close <power-management> markup.
72 * @tab Number of tabulations.
73 * @action Open or close action.
74 ***************************************************************************
76 void xml_markup_power_management(int tab, int action)
78 static int markup_state = CLOSE_XML_MARKUP;
80 if (action == markup_state)
82 markup_state = action;
84 if (action == OPEN_XML_MARKUP) {
86 xprintf(tab, "<power-management>");
90 xprintf(tab, "</power-management>");
95 ***************************************************************************
96 * Open or close <psi> markup.
99 * @tab Number of tabulations.
100 * @action Open or close action.
101 ***************************************************************************
103 void xml_markup_psi(int tab, int action)
105 static int markup_state = CLOSE_XML_MARKUP;
107 if (action == markup_state)
109 markup_state = action;
111 if (action == OPEN_XML_MARKUP) {
113 xprintf(tab, "<psi per=\"second\">");
117 xprintf(tab, "</psi>");
122 ***************************************************************************
123 * Display CPU statistics in XML.
126 * @a Activity structure with statistics.
127 * @curr Index in array for current sample statistics.
128 * @tab Indentation in XML output.
129 * @itv Interval of time in 1/100th of a second (independent of the
130 * number of processors). Unused here.
131 ***************************************************************************
133 __print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
134 unsigned long long itv)
137 unsigned long long deltot_jiffies = 1;
138 struct stats_cpu *scc, *scp;
139 unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
142 xprintf(tab++, "<cpu-load>");
144 /* @nr[curr] cannot normally be greater than @nr_ini */
145 if (a->nr[curr] > a->nr_ini) {
146 a->nr_ini = a->nr[curr];
150 * Compute CPU "all" as sum of all individual CPU (on SMP machines)
151 * and look for offline CPU.
154 deltot_jiffies = get_global_cpu_statistics(a, !curr, curr,
155 flags, offline_cpu_bitmap);
158 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
160 /* Should current CPU (including CPU "all") be displayed? */
161 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) ||
162 offline_cpu_bitmap[i >> 3] & (1 << (i & 0x07)))
163 /* Don't display CPU */
166 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
167 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
170 /* This is CPU "all" */
171 strcpy(cpuno, "all");
173 if (a->nr_ini == 1) {
175 * This is a UP machine. In this case
176 * interval has still not been calculated.
178 deltot_jiffies = get_per_cpu_interval(scc, scp);
180 if (!deltot_jiffies) {
181 /* CPU "all" cannot be tickless */
186 sprintf(cpuno, "%d", i - 1);
189 * Recalculate interval for current proc.
190 * If result is 0 then current CPU is a tickless one.
192 deltot_jiffies = get_per_cpu_interval(scc, scp);
194 if (!deltot_jiffies) {
195 /* Current CPU is tickless */
196 if (DISPLAY_CPU_DEF(a->opt_flags)) {
197 xprintf(tab, "<cpu number=\"%d\" "
204 i - 1, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0);
206 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
207 xprintf(tab, "<cpu number=\"%d\" "
218 i - 1, 0.0, 0.0, 0.0, 0.0,
219 0.0, 0.0, 0.0, 0.0, 0.0, 100.0);
225 if (DISPLAY_CPU_DEF(a->opt_flags)) {
226 xprintf(tab, "<cpu number=\"%s\" "
234 ll_sp_value(scp->cpu_user, scc->cpu_user, deltot_jiffies),
235 ll_sp_value(scp->cpu_nice, scc->cpu_nice, deltot_jiffies),
236 ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
237 scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
239 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, deltot_jiffies),
240 ll_sp_value(scp->cpu_steal, scc->cpu_steal, deltot_jiffies),
241 scc->cpu_idle < scp->cpu_idle ?
243 ll_sp_value(scp->cpu_idle, scc->cpu_idle, deltot_jiffies));
245 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
246 xprintf(tab, "<cpu number=\"%s\" "
258 (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
260 ll_sp_value(scp->cpu_user - scp->cpu_guest,
261 scc->cpu_user - scc->cpu_guest, deltot_jiffies),
262 (scc->cpu_nice - scc->cpu_guest_nice) < (scp->cpu_nice - scp->cpu_guest_nice) ?
264 ll_sp_value(scp->cpu_nice - scp->cpu_guest_nice,
265 scc->cpu_nice - scc->cpu_guest_nice, deltot_jiffies),
266 ll_sp_value(scp->cpu_sys, scc->cpu_sys, deltot_jiffies),
267 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, deltot_jiffies),
268 ll_sp_value(scp->cpu_steal, scc->cpu_steal, deltot_jiffies),
269 ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, deltot_jiffies),
270 ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, deltot_jiffies),
271 ll_sp_value(scp->cpu_guest, scc->cpu_guest, deltot_jiffies),
272 ll_sp_value(scp->cpu_guest_nice, scc->cpu_guest_nice, deltot_jiffies),
273 scc->cpu_idle < scp->cpu_idle ?
275 ll_sp_value(scp->cpu_idle, scc->cpu_idle, deltot_jiffies));
279 xprintf(--tab, "</cpu-load>");
283 ***************************************************************************
284 * Display task creation and context switch statistics in XML.
287 * @a Activity structure with statistics.
288 * @curr Index in array for current sample statistics.
289 * @tab Indentation in XML output.
290 * @itv Interval of time in 1/100th of a second.
291 ***************************************************************************
293 __print_funct_t xml_print_pcsw_stats(struct activity *a, int curr, int tab,
294 unsigned long long itv)
297 *spc = (struct stats_pcsw *) a->buf[curr],
298 *spp = (struct stats_pcsw *) a->buf[!curr];
300 /* proc/s and cswch/s */
301 xprintf(tab, "<process-and-context-switch per=\"second\" "
304 S_VALUE(spp->processes, spc->processes, itv),
305 S_VALUE(spp->context_switch, spc->context_switch, itv));
309 ***************************************************************************
310 * Display interrupts statistics in XML.
313 * @a Activity structure with statistics.
314 * @curr Index in array for current sample statistics.
315 * @tab Indentation in XML output.
316 * @itv Interval of time in 1/100th of a second.
317 ***************************************************************************
319 __print_funct_t xml_print_irq_stats(struct activity *a, int curr, int tab,
320 unsigned long long itv)
323 struct stats_irq *sic, *sip;
326 xprintf(tab++, "<interrupts>");
327 xprintf(tab++, "<int-global per=\"second\">");
329 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
331 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
332 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
334 /* Should current interrupt (including int "sum") be displayed? */
335 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
337 /* Yes: Display it */
339 /* This is interrupt "sum" */
340 strcpy(irqno, "sum");
343 sprintf(irqno, "%d", i - 1);
346 xprintf(tab, "<irq intr=\"%s\" value=\"%.2f\"/>", irqno,
347 S_VALUE(sip->irq_nr, sic->irq_nr, itv));
351 xprintf(--tab, "</int-global>");
352 xprintf(--tab, "</interrupts>");
356 ***************************************************************************
357 * Display swapping statistics in XML.
360 * @a Activity structure with statistics.
361 * @curr Index in array for current sample statistics.
362 * @tab Indentation in XML output.
363 * @itv Interval of time in 1/100th of a second.
364 ***************************************************************************
366 __print_funct_t xml_print_swap_stats(struct activity *a, int curr, int tab,
367 unsigned long long itv)
370 *ssc = (struct stats_swap *) a->buf[curr],
371 *ssp = (struct stats_swap *) a->buf[!curr];
373 xprintf(tab, "<swap-pages per=\"second\" "
375 "pswpout=\"%.2f\"/>",
376 S_VALUE(ssp->pswpin, ssc->pswpin, itv),
377 S_VALUE(ssp->pswpout, ssc->pswpout, itv));
381 ***************************************************************************
382 * Display paging statistics in XML.
385 * @a Activity structure with statistics.
386 * @curr Index in array for current sample statistics.
387 * @tab Indentation in XML output.
388 * @itv Interval of time in 1/100th of a second.
389 ***************************************************************************
391 __print_funct_t xml_print_paging_stats(struct activity *a, int curr, int tab,
392 unsigned long long itv)
395 *spc = (struct stats_paging *) a->buf[curr],
396 *spp = (struct stats_paging *) a->buf[!curr];
398 xprintf(tab, "<paging per=\"second\" "
407 "vmeff-percent=\"%.2f\"/>",
408 S_VALUE(spp->pgpgin, spc->pgpgin, itv),
409 S_VALUE(spp->pgpgout, spc->pgpgout, itv),
410 S_VALUE(spp->pgfault, spc->pgfault, itv),
411 S_VALUE(spp->pgmajfault, spc->pgmajfault, itv),
412 S_VALUE(spp->pgfree, spc->pgfree, itv),
413 S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
414 S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
415 S_VALUE(spp->pgsteal, spc->pgsteal, itv),
416 (spc->pgscan_kswapd + spc->pgscan_direct -
417 spp->pgscan_kswapd - spp->pgscan_direct) ?
418 SP_VALUE(spp->pgsteal, spc->pgsteal,
419 spc->pgscan_kswapd + spc->pgscan_direct -
420 spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
424 ***************************************************************************
425 * Display I/O and transfer rate statistics in XML.
428 * @a Activity structure with statistics.
429 * @curr Index in array for current sample statistics.
430 * @tab Indentation in XML output.
431 * @itv Interval of time in 1/100th of a second.
432 ***************************************************************************
434 __print_funct_t xml_print_io_stats(struct activity *a, int curr, int tab,
435 unsigned long long itv)
438 *sic = (struct stats_io *) a->buf[curr],
439 *sip = (struct stats_io *) a->buf[!curr];
441 xprintf(tab, "<io per=\"second\">");
444 * If we get negative values, this is probably because
445 * one or more devices/filesystems have been unmounted.
446 * We display 0.0 in this case though we should rather tell
447 * the user that the value cannot be calculated here.
449 xprintf(++tab, "<tps>%.2f</tps>",
450 sic->dk_drive < sip->dk_drive ? 0.0 :
451 S_VALUE(sip->dk_drive, sic->dk_drive, itv));
453 xprintf(tab, "<io-reads rtps=\"%.2f\" bread=\"%.2f\"/>",
454 sic->dk_drive_rio < sip->dk_drive_rio ? 0.0 :
455 S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
456 sic->dk_drive_rblk < sip->dk_drive_rblk ? 0.0 :
457 S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv));
459 xprintf(tab, "<io-writes wtps=\"%.2f\" bwrtn=\"%.2f\"/>",
460 sic->dk_drive_wio < sip->dk_drive_wio ? 0.0 :
461 S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
462 sic->dk_drive_wblk < sip->dk_drive_wblk ? 0.0 :
463 S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
465 xprintf(tab, "<io-discard dtps=\"%.2f\" bdscd=\"%.2f\"/>",
466 sic->dk_drive_dio < sip->dk_drive_dio ? 0.0 :
467 S_VALUE(sip->dk_drive_dio, sic->dk_drive_dio, itv),
468 sic->dk_drive_dblk < sip->dk_drive_dblk ? 0.0 :
469 S_VALUE(sip->dk_drive_dblk, sic->dk_drive_dblk, itv));
471 xprintf(--tab, "</io>");
475 ***************************************************************************
476 * Display memory statistics in XML.
479 * @a Activity structure with statistics.
480 * @curr Index in array for current sample statistics.
481 * @tab Indentation in XML output.
482 * @itv Interval of time in 1/100th of a second.
483 ***************************************************************************
485 __print_funct_t xml_print_memory_stats(struct activity *a, int curr, int tab,
486 unsigned long long itv)
489 *smc = (struct stats_memory *) a->buf[curr];
490 unsigned long long nousedmem;
492 xprintf(tab, "<memory unit=\"kB\">");
494 if (DISPLAY_MEMORY(a->opt_flags)) {
496 nousedmem = smc->frmkb + smc->bufkb + smc->camkb + smc->slabkb;
497 if (nousedmem > smc->tlmkb) {
498 nousedmem = smc->tlmkb;
501 xprintf(++tab, "<memfree>%llu</memfree>",
504 xprintf(tab, "<avail>%llu</avail>",
507 xprintf(tab, "<memused>%llu</memused>",
508 smc->tlmkb - nousedmem);
510 xprintf(tab, "<memused-percent>%.2f</memused-percent>",
512 SP_VALUE(nousedmem, smc->tlmkb, smc->tlmkb) :
515 xprintf(tab, "<buffers>%llu</buffers>",
518 xprintf(tab, "<cached>%llu</cached>",
521 xprintf(tab, "<commit>%llu</commit>",
524 xprintf(tab, "<commit-percent>%.2f</commit-percent>",
525 (smc->tlmkb + smc->tlskb) ?
526 SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
529 xprintf(tab, "<active>%llu</active>",
532 xprintf(tab, "<inactive>%llu</inactive>",
535 xprintf(tab--, "<dirty>%llu</dirty>",
538 if (DISPLAY_MEM_ALL(a->opt_flags)) {
539 xprintf(++tab, "<anonpg>%llu</anonpg>",
542 xprintf(tab, "<slab>%llu</slab>",
545 xprintf(tab, "<kstack>%llu</kstack>",
548 xprintf(tab, "<pgtbl>%llu</pgtbl>",
551 xprintf(tab--, "<vmused>%llu</vmused>",
556 if (DISPLAY_SWAP(a->opt_flags)) {
558 xprintf(++tab, "<swpfree>%llu</swpfree>",
561 xprintf(tab, "<swpused>%llu</swpused>",
562 smc->tlskb - smc->frskb);
564 xprintf(tab, "<swpused-percent>%.2f</swpused-percent>",
566 SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
569 xprintf(tab, "<swpcad>%llu</swpcad>",
572 xprintf(tab--, "<swpcad-percent>%.2f</swpcad-percent>",
573 (smc->tlskb - smc->frskb) ?
574 SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
578 xprintf(tab, "</memory>");
582 ***************************************************************************
583 * Display kernel tables statistics in XML.
586 * @a Activity structure with statistics.
587 * @curr Index in array for current sample statistics.
588 * @tab Indentation in XML output.
589 * @itv Interval of time in 1/100th of a second.
590 ***************************************************************************
592 __print_funct_t xml_print_ktables_stats(struct activity *a, int curr, int tab,
593 unsigned long long itv)
596 *skc = (struct stats_ktables *) a->buf[curr];
598 xprintf(tab, "<kernel "
599 "dentunusd=\"%llu\" "
610 ***************************************************************************
611 * Display queue and load statistics in XML.
614 * @a Activity structure with statistics.
615 * @curr Index in array for current sample statistics.
616 * @tab Indentation in XML output.
617 * @itv Interval of time in 1/100th of a second.
618 ***************************************************************************
620 __print_funct_t xml_print_queue_stats(struct activity *a, int curr, int tab,
621 unsigned long long itv)
624 *sqc = (struct stats_queue *) a->buf[curr];
626 xprintf(tab, "<queue "
632 "blocked=\"%llu\"/>",
635 (double) sqc->load_avg_1 / 100,
636 (double) sqc->load_avg_5 / 100,
637 (double) sqc->load_avg_15 / 100,
642 ***************************************************************************
643 * Display serial lines statistics in XML.
646 * @a Activity structure with statistics.
647 * @curr Index in array for current sample statistics.
648 * @tab Indentation in XML output.
649 * @itv Interval of time in 1/100th of a second.
650 ***************************************************************************
652 __print_funct_t xml_print_serial_stats(struct activity *a, int curr, int tab,
653 unsigned long long itv)
656 struct stats_serial *ssc, *ssp;
658 xprintf(tab++, "<serial per=\"second\">");
660 for (i = 0; i < a->nr[curr]; i++) {
664 if (a->nr[!curr] > 0) {
665 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
667 /* Look for corresponding serial line in previous iteration */
670 if (j >= a->nr[!curr]) {
671 j = a->nr[!curr] - 1;
677 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + j * a->msize);
678 if (ssc->line == ssp->line) {
682 if (++j >= a->nr[!curr]) {
692 xprintf(tab, "<tty line=\"%d\" "
700 S_VALUE(ssp->rx, ssc->rx, itv),
701 S_VALUE(ssp->tx, ssc->tx, itv),
702 S_VALUE(ssp->frame, ssc->frame, itv),
703 S_VALUE(ssp->parity, ssc->parity, itv),
704 S_VALUE(ssp->brk, ssc->brk, itv),
705 S_VALUE(ssp->overrun, ssc->overrun, itv));
708 xprintf(--tab, "</serial>");
712 ***************************************************************************
713 * Display disks statistics in XML.
716 * @a Activity structure with statistics.
717 * @curr Index in array for current sample statistics.
718 * @tab Indentation in XML output.
719 * @itv Interval of time in 1/100th of a second.
720 ***************************************************************************
722 __print_funct_t xml_print_disk_stats(struct activity *a, int curr, int tab,
723 unsigned long long itv)
726 struct stats_disk *sdc, *sdp, sdpzero;
727 struct ext_disk_stats xds;
730 memset(&sdpzero, 0, STATS_DISK_SIZE);
732 xprintf(tab++, "<disk per=\"second\">");
734 for (i = 0; i < a->nr[curr]; i++) {
736 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
738 j = check_disk_reg(a, curr, !curr, i);
740 /* This is a newly registered interface. Previous stats are zero */
744 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
747 /* Get device name */
748 dev_name = get_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
749 DISPLAY_PRETTY(flags), DISPLAY_PERSIST_NAME_S(flags),
750 USE_STABLE_ID(flags), NULL);
752 if (a->item_list != NULL) {
753 /* A list of devices has been entered on the command line */
754 if (!search_list_item(a->item_list, dev_name))
755 /* Device not found */
759 /* Compute extended statistics values */
760 compute_ext_disk_stats(sdc, sdp, itv, &xds);
762 xprintf(tab, "<disk-device dev=\"%s\" "
775 "util-percent=\"%.2f\"/>",
776 /* Confusion possible here between index and minor numbers */
778 S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
779 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv), /* Unit = sectors (for backward compatibility) */
780 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
781 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv),
782 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv) / 2,
783 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2,
784 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv) / 2,
785 /* See iostat for explanations */
786 xds.arqsz, /* Unit = sectors (for backward compatibility) */
788 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0, /* For backward compatibility */
789 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
794 xprintf(--tab, "</disk>");
798 ***************************************************************************
799 * Display network interfaces statistics in XML.
802 * @a Activity structure with statistics.
803 * @curr Index in array for current sample statistics.
804 * @tab Indentation in XML output.
805 * @itv Interval of time in 1/100th of a second.
806 ***************************************************************************
808 __print_funct_t xml_print_net_dev_stats(struct activity *a, int curr, int tab,
809 unsigned long long itv)
812 struct stats_net_dev *sndc, *sndp, sndzero;
813 double rxkb, txkb, ifutil;
815 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
816 goto close_xml_markup;
818 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
820 xml_markup_network(tab, OPEN_XML_MARKUP);
823 for (i = 0; i < a->nr[curr]; i++) {
825 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
827 if (a->item_list != NULL) {
828 /* A list of devices has been entered on the command line */
829 if (!search_list_item(a->item_list, sndc->interface))
830 /* Device not found */
834 j = check_net_dev_reg(a, curr, !curr, i);
836 /* This is a newly registered interface. Previous stats are zero */
840 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
843 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
844 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
845 ifutil = compute_ifutil(sndc, rxkb, txkb);
847 xprintf(tab, "<net-dev iface=\"%s\" "
855 "ifutil-percent=\"%.2f\"/>",
857 S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
858 S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
861 S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
862 S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
863 S_VALUE(sndp->multicast, sndc->multicast, itv),
869 if (CLOSE_MARKUP(a->options)) {
870 xml_markup_network(tab, CLOSE_XML_MARKUP);
875 ***************************************************************************
876 * Display network interfaces errors statistics in XML.
879 * @a Activity structure with statistics.
880 * @curr Index in array for current sample statistics.
881 * @tab Indentation in XML output.
882 * @itv Interval of time in 1/100th of a second.
883 ***************************************************************************
885 __print_funct_t xml_print_net_edev_stats(struct activity *a, int curr, int tab,
886 unsigned long long itv)
889 struct stats_net_edev *snedc, *snedp, snedzero;
891 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
892 goto close_xml_markup;
894 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
896 xml_markup_network(tab, OPEN_XML_MARKUP);
899 for (i = 0; i < a->nr[curr]; i++) {
901 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
903 if (a->item_list != NULL) {
904 /* A list of devices has been entered on the command line */
905 if (!search_list_item(a->item_list, snedc->interface))
906 /* Device not found */
910 j = check_net_edev_reg(a, curr, !curr, i);
912 /* This is a newly registered interface. Previous stats are zero */
916 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
919 xprintf(tab, "<net-edev iface=\"%s\" "
930 S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
931 S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
932 S_VALUE(snedp->collisions, snedc->collisions, itv),
933 S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
934 S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
935 S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
936 S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
937 S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
938 S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
943 if (CLOSE_MARKUP(a->options)) {
944 xml_markup_network(tab, CLOSE_XML_MARKUP);
949 ***************************************************************************
950 * Display NFS client statistics in XML.
953 * @a Activity structure with statistics.
954 * @curr Index in array for current sample statistics.
955 * @tab Indentation in XML output.
956 * @itv Interval of time in 1/100th of a second.
957 ***************************************************************************
959 __print_funct_t xml_print_net_nfs_stats(struct activity *a, int curr, int tab,
960 unsigned long long itv)
963 *snnc = (struct stats_net_nfs *) a->buf[curr],
964 *snnp = (struct stats_net_nfs *) a->buf[!curr];
966 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
967 goto close_xml_markup;
969 xml_markup_network(tab, OPEN_XML_MARKUP);
972 xprintf(tab, "<net-nfs "
979 S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
980 S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
981 S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
982 S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
983 S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
984 S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
988 if (CLOSE_MARKUP(a->options)) {
989 xml_markup_network(tab, CLOSE_XML_MARKUP);
994 ***************************************************************************
995 * Display NFS server statistics in XML.
998 * @a Activity structure with statistics.
999 * @curr Index in array for current sample statistics.
1000 * @tab Indentation in XML output.
1001 * @itv Interval of time in 1/100th of a second.
1002 ***************************************************************************
1004 __print_funct_t xml_print_net_nfsd_stats(struct activity *a, int curr, int tab,
1005 unsigned long long itv)
1007 struct stats_net_nfsd
1008 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1009 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1011 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1012 goto close_xml_markup;
1014 xml_markup_network(tab, OPEN_XML_MARKUP);
1017 xprintf(tab, "<net-nfsd "
1028 "sgetatt=\"%.2f\"/>",
1029 S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1030 S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1031 S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1032 S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1033 S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1034 S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1035 S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1036 S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1037 S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1038 S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1039 S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1043 if (CLOSE_MARKUP(a->options)) {
1044 xml_markup_network(tab, CLOSE_XML_MARKUP);
1049 ***************************************************************************
1050 * Display network socket statistics in XML.
1053 * @a Activity structure with statistics.
1054 * @curr Index in array for current sample statistics.
1055 * @tab Indentation in XML output.
1056 * @itv Interval of time in 1/100th of a second.
1057 ***************************************************************************
1059 __print_funct_t xml_print_net_sock_stats(struct activity *a, int curr, int tab,
1060 unsigned long long itv)
1062 struct stats_net_sock
1063 *snsc = (struct stats_net_sock *) a->buf[curr];
1065 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1066 goto close_xml_markup;
1068 xml_markup_network(tab, OPEN_XML_MARKUP);
1071 xprintf(tab, "<net-sock "
1087 if (CLOSE_MARKUP(a->options)) {
1088 xml_markup_network(tab, CLOSE_XML_MARKUP);
1093 ***************************************************************************
1094 * Display IP network statistics in XML.
1097 * @a Activity structure with statistics.
1098 * @curr Index in array for current sample statistics.
1099 * @tab Indentation in XML output.
1100 * @itv Interval of time in 1/100th of a second.
1101 ***************************************************************************
1103 __print_funct_t xml_print_net_ip_stats(struct activity *a, int curr, int tab,
1104 unsigned long long itv)
1107 *snic = (struct stats_net_ip *) a->buf[curr],
1108 *snip = (struct stats_net_ip *) a->buf[!curr];
1110 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1111 goto close_xml_markup;
1113 xml_markup_network(tab, OPEN_XML_MARKUP);
1116 xprintf(tab, "<net-ip "
1124 "fragcrt=\"%.2f\"/>",
1125 S_VALUE(snip->InReceives, snic->InReceives, itv),
1126 S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1127 S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1128 S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1129 S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1130 S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1131 S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1132 S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1136 if (CLOSE_MARKUP(a->options)) {
1137 xml_markup_network(tab, CLOSE_XML_MARKUP);
1142 ***************************************************************************
1143 * Display IP network errors statistics in XML.
1146 * @a Activity structure with statistics.
1147 * @curr Index in array for current sample statistics.
1148 * @tab Indentation in XML output.
1149 * @itv Interval of time in 1/100th of a second.
1150 ***************************************************************************
1152 __print_funct_t xml_print_net_eip_stats(struct activity *a, int curr, int tab,
1153 unsigned long long itv)
1155 struct stats_net_eip
1156 *sneic = (struct stats_net_eip *) a->buf[curr],
1157 *sneip = (struct stats_net_eip *) a->buf[!curr];
1159 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1160 goto close_xml_markup;
1162 xml_markup_network(tab, OPEN_XML_MARKUP);
1165 xprintf(tab, "<net-eip "
1174 S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1175 S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1176 S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1177 S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1178 S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1179 S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1180 S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1181 S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1185 if (CLOSE_MARKUP(a->options)) {
1186 xml_markup_network(tab, CLOSE_XML_MARKUP);
1191 ***************************************************************************
1192 * Display ICMP network statistics in XML.
1195 * @a Activity structure with statistics.
1196 * @curr Index in array for current sample statistics.
1197 * @tab Indentation in XML output.
1198 * @itv Interval of time in 1/100th of a second.
1199 ***************************************************************************
1201 __print_funct_t xml_print_net_icmp_stats(struct activity *a, int curr, int tab,
1202 unsigned long long itv)
1204 struct stats_net_icmp
1205 *snic = (struct stats_net_icmp *) a->buf[curr],
1206 *snip = (struct stats_net_icmp *) a->buf[!curr];
1208 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1209 goto close_xml_markup;
1211 xml_markup_network(tab, OPEN_XML_MARKUP);
1214 xprintf(tab, "<net-icmp "
1228 "oadrmkr=\"%.2f\"/>",
1229 S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1230 S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1231 S_VALUE(snip->InEchos, snic->InEchos, itv),
1232 S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1233 S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1234 S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1235 S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1236 S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1237 S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1238 S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1239 S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1240 S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1241 S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1242 S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1246 if (CLOSE_MARKUP(a->options)) {
1247 xml_markup_network(tab, CLOSE_XML_MARKUP);
1252 ***************************************************************************
1253 * Display ICMP error messages statistics in XML.
1256 * @a Activity structure with statistics.
1257 * @curr Index in array for current sample statistics.
1258 * @tab Indentation in XML output.
1259 * @itv Interval of time in 1/100th of a second.
1260 ***************************************************************************
1262 __print_funct_t xml_print_net_eicmp_stats(struct activity *a, int curr, int tab,
1263 unsigned long long itv)
1265 struct stats_net_eicmp
1266 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1267 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1269 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1270 goto close_xml_markup;
1272 xml_markup_network(tab, OPEN_XML_MARKUP);
1275 xprintf(tab, "<net-eicmp "
1287 "oredir=\"%.2f\"/>",
1288 S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1289 S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1290 S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1291 S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1292 S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1293 S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1294 S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1295 S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1296 S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1297 S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1298 S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1299 S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1303 if (CLOSE_MARKUP(a->options)) {
1304 xml_markup_network(tab, CLOSE_XML_MARKUP);
1309 ***************************************************************************
1310 * Display TCP network statistics in XML.
1313 * @a Activity structure with statistics.
1314 * @curr Index in array for current sample statistics.
1315 * @tab Indentation in XML output.
1316 * @itv Interval of time in 1/100th of a second.
1317 ***************************************************************************
1319 __print_funct_t xml_print_net_tcp_stats(struct activity *a, int curr, int tab,
1320 unsigned long long itv)
1322 struct stats_net_tcp
1323 *sntc = (struct stats_net_tcp *) a->buf[curr],
1324 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1326 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1327 goto close_xml_markup;
1329 xml_markup_network(tab, OPEN_XML_MARKUP);
1332 xprintf(tab, "<net-tcp "
1337 S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1338 S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1339 S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1340 S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1344 if (CLOSE_MARKUP(a->options)) {
1345 xml_markup_network(tab, CLOSE_XML_MARKUP);
1350 ***************************************************************************
1351 * Display TCP network errors statistics in XML.
1354 * @a Activity structure with statistics.
1355 * @curr Index in array for current sample statistics.
1356 * @tab Indentation in XML output.
1357 * @itv Interval of time in 1/100th of a second.
1358 ***************************************************************************
1360 __print_funct_t xml_print_net_etcp_stats(struct activity *a, int curr, int tab,
1361 unsigned long long itv)
1363 struct stats_net_etcp
1364 *snetc = (struct stats_net_etcp *) a->buf[curr],
1365 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1367 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1368 goto close_xml_markup;
1370 xml_markup_network(tab, OPEN_XML_MARKUP);
1373 xprintf(tab, "<net-etcp "
1379 S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1380 S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1381 S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1382 S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1383 S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1387 if (CLOSE_MARKUP(a->options)) {
1388 xml_markup_network(tab, CLOSE_XML_MARKUP);
1393 ***************************************************************************
1394 * Display UDP network statistics in XML.
1397 * @a Activity structure with statistics.
1398 * @curr Index in array for current sample statistics.
1399 * @tab Indentation in XML output.
1400 * @itv Interval of time in 1/100th of a second.
1401 ***************************************************************************
1403 __print_funct_t xml_print_net_udp_stats(struct activity *a, int curr, int tab,
1404 unsigned long long itv)
1406 struct stats_net_udp
1407 *snuc = (struct stats_net_udp *) a->buf[curr],
1408 *snup = (struct stats_net_udp *) a->buf[!curr];
1410 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1411 goto close_xml_markup;
1413 xml_markup_network(tab, OPEN_XML_MARKUP);
1416 xprintf(tab, "<net-udp "
1420 "idgmerr=\"%.2f\"/>",
1421 S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1422 S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1423 S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1424 S_VALUE(snup->InErrors, snuc->InErrors, itv));
1428 if (CLOSE_MARKUP(a->options)) {
1429 xml_markup_network(tab, CLOSE_XML_MARKUP);
1434 ***************************************************************************
1435 * Display IPv6 network socket statistics in XML.
1438 * @a Activity structure with statistics.
1439 * @curr Index in array for current sample statistics.
1440 * @tab Indentation in XML output.
1441 * @itv Interval of time in 1/100th of a second.
1442 ***************************************************************************
1444 __print_funct_t xml_print_net_sock6_stats(struct activity *a, int curr, int tab,
1445 unsigned long long itv)
1447 struct stats_net_sock6
1448 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1450 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1451 goto close_xml_markup;
1453 xml_markup_network(tab, OPEN_XML_MARKUP);
1456 xprintf(tab, "<net-sock6 "
1460 "ip6-frag=\"%u\"/>",
1468 if (CLOSE_MARKUP(a->options)) {
1469 xml_markup_network(tab, CLOSE_XML_MARKUP);
1474 ***************************************************************************
1475 * Display IPv6 network statistics in XML.
1478 * @a Activity structure with statistics.
1479 * @curr Index in array for current sample statistics.
1480 * @tab Indentation in XML output.
1481 * @itv Interval of time in 1/100th of a second.
1482 ***************************************************************************
1484 __print_funct_t xml_print_net_ip6_stats(struct activity *a, int curr, int tab,
1485 unsigned long long itv)
1487 struct stats_net_ip6
1488 *snic = (struct stats_net_ip6 *) a->buf[curr],
1489 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1491 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1492 goto close_xml_markup;
1494 xml_markup_network(tab, OPEN_XML_MARKUP);
1497 xprintf(tab, "<net-ip6 "
1507 "fragcr6=\"%.2f\"/>",
1508 S_VALUE(snip->InReceives6, snic->InReceives6, itv),
1509 S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1510 S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
1511 S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
1512 S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
1513 S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
1514 S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
1515 S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
1516 S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
1517 S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1521 if (CLOSE_MARKUP(a->options)) {
1522 xml_markup_network(tab, CLOSE_XML_MARKUP);
1527 ***************************************************************************
1528 * Display IPv6 network errors statistics in XML.
1531 * @a Activity structure with statistics.
1532 * @curr Index in array for current sample statistics.
1533 * @tab Indentation in XML output.
1534 * @itv Interval of time in 1/100th of a second.
1535 ***************************************************************************
1537 __print_funct_t xml_print_net_eip6_stats(struct activity *a, int curr, int tab,
1538 unsigned long long itv)
1540 struct stats_net_eip6
1541 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1542 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1544 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1545 goto close_xml_markup;
1547 xml_markup_network(tab, OPEN_XML_MARKUP);
1550 xprintf(tab, "<net-eip6 "
1561 "itrpck6=\"%.2f\"/>",
1562 S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
1563 S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
1564 S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1565 S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
1566 S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
1567 S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
1568 S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
1569 S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
1570 S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
1571 S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
1572 S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1576 if (CLOSE_MARKUP(a->options)) {
1577 xml_markup_network(tab, CLOSE_XML_MARKUP);
1582 ***************************************************************************
1583 * Display ICMPv6 network statistics in XML.
1586 * @a Activity structure with statistics.
1587 * @curr Index in array for current sample statistics.
1588 * @tab Indentation in XML output.
1589 * @itv Interval of time in 1/100th of a second.
1590 ***************************************************************************
1592 __print_funct_t xml_print_net_icmp6_stats(struct activity *a, int curr, int tab,
1593 unsigned long long itv)
1595 struct stats_net_icmp6
1596 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1597 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1599 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1600 goto close_xml_markup;
1602 xml_markup_network(tab, OPEN_XML_MARKUP);
1605 xprintf(tab, "<net-icmp6 "
1622 "onbad6=\"%.2f\"/>",
1623 S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
1624 S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
1625 S_VALUE(snip->InEchos6, snic->InEchos6, itv),
1626 S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
1627 S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
1628 S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
1629 S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
1630 S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
1631 S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
1632 S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
1633 S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
1634 S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
1635 S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
1636 S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
1637 S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
1638 S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
1639 S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1643 if (CLOSE_MARKUP(a->options)) {
1644 xml_markup_network(tab, CLOSE_XML_MARKUP);
1649 ***************************************************************************
1650 * Display ICMPv6 error messages statistics in XML.
1653 * @a Activity structure with statistics.
1654 * @curr Index in array for current sample statistics.
1655 * @tab Indentation in XML output.
1656 * @itv Interval of time in 1/100th of a second.
1657 ***************************************************************************
1659 __print_funct_t xml_print_net_eicmp6_stats(struct activity *a, int curr, int tab,
1660 unsigned long long itv)
1662 struct stats_net_eicmp6
1663 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1664 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1666 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1667 goto close_xml_markup;
1669 xml_markup_network(tab, OPEN_XML_MARKUP);
1672 xprintf(tab, "<net-eicmp6 "
1683 "opck2b6=\"%.2f\"/>",
1684 S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
1685 S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
1686 S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1687 S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
1688 S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
1689 S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
1690 S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1691 S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
1692 S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
1693 S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
1694 S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
1698 if (CLOSE_MARKUP(a->options)) {
1699 xml_markup_network(tab, CLOSE_XML_MARKUP);
1704 ***************************************************************************
1705 * Display UDPv6 network statistics in XML.
1708 * @a Activity structure with statistics.
1709 * @curr Index in array for current sample statistics.
1710 * @tab Indentation in XML output.
1711 * @itv Interval of time in 1/100th of a second.
1712 ***************************************************************************
1714 __print_funct_t xml_print_net_udp6_stats(struct activity *a, int curr, int tab,
1715 unsigned long long itv)
1717 struct stats_net_udp6
1718 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1719 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1721 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1722 goto close_xml_markup;
1724 xml_markup_network(tab, OPEN_XML_MARKUP);
1727 xprintf(tab, "<net-udp6 "
1731 "idgmer6=\"%.2f\"/>",
1732 S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
1733 S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1734 S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
1735 S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
1739 if (CLOSE_MARKUP(a->options)) {
1740 xml_markup_network(tab, CLOSE_XML_MARKUP);
1745 ***************************************************************************
1746 * Display CPU frequency statistics in XML.
1749 * @a Activity structure with statistics.
1750 * @curr Index in array for current sample statistics.
1751 * @tab Indentation in XML output.
1752 * @itv Interval of time in 1/100th of a second.
1753 ***************************************************************************
1755 __print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int tab,
1756 unsigned long long itv)
1759 struct stats_pwr_cpufreq *spc;
1762 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1763 goto close_xml_markup;
1765 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1768 xprintf(tab++, "<cpu-frequency unit=\"MHz\">");
1770 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1772 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1774 /* Should current CPU (including CPU "all") be displayed? */
1775 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1779 /* Yes: Display it */
1781 /* This is CPU "all" */
1782 strcpy(cpuno, "all");
1785 sprintf(cpuno, "%d", i - 1);
1788 xprintf(tab, "<cpufreq number=\"%s\" "
1789 "frequency=\"%.2f\"/>",
1791 ((double) spc->cpufreq) / 100);
1794 xprintf(--tab, "</cpu-frequency>");
1798 if (CLOSE_MARKUP(a->options)) {
1799 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1804 ***************************************************************************
1805 * Display fan statistics in XML.
1808 * @a Activity structure with statistics.
1809 * @curr Index in array for current sample statistics.
1810 * @tab Indentation in XML output.
1811 * @itv Interval of time in 1/100th of a second.
1812 ***************************************************************************
1814 __print_funct_t xml_print_pwr_fan_stats(struct activity *a, int curr, int tab,
1815 unsigned long long itv)
1818 struct stats_pwr_fan *spc;
1820 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1821 goto close_xml_markup;
1823 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1826 xprintf(tab++, "<fan-speed unit=\"rpm\">");
1828 for (i = 0; i < a->nr[curr]; i++) {
1829 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1831 xprintf(tab, "<fan number=\"%d\" rpm=\"%llu\" drpm=\"%llu\" device=\"%s\"/>",
1833 (unsigned long long) spc->rpm,
1834 (unsigned long long) (spc->rpm - spc->rpm_min),
1838 xprintf(--tab, "</fan-speed>");
1842 if (CLOSE_MARKUP(a->options)) {
1843 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1848 ***************************************************************************
1849 * Display temperature statistics in XML.
1852 * @a Activity structure with statistics.
1853 * @curr Index in array for current sample statistics.
1854 * @tab Indentation in XML output.
1855 * @itv Interval of time in 1/100th of a second.
1856 ***************************************************************************
1858 __print_funct_t xml_print_pwr_temp_stats(struct activity *a, int curr, int tab,
1859 unsigned long long itv)
1862 struct stats_pwr_temp *spc;
1864 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1865 goto close_xml_markup;
1867 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1870 xprintf(tab++, "<temperature unit=\"degree Celsius\">");
1872 for (i = 0; i < a->nr[curr]; i++) {
1873 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1875 xprintf(tab, "<temp number=\"%d\" degC=\"%.2f\" percent-temp=\"%.2f\" device=\"%s\"/>",
1878 (spc->temp_max - spc->temp_min) ?
1879 (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
1884 xprintf(--tab, "</temperature>");
1888 if (CLOSE_MARKUP(a->options)) {
1889 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1894 ***************************************************************************
1895 * Display voltage inputs statistics in XML.
1898 * @a Activity structure with statistics.
1899 * @curr Index in array for current sample statistics.
1900 * @tab Indentation in XML output.
1901 * @itv Interval of time in 1/100th of a second.
1902 ***************************************************************************
1904 __print_funct_t xml_print_pwr_in_stats(struct activity *a, int curr, int tab,
1905 unsigned long long itv)
1908 struct stats_pwr_in *spc;
1910 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1911 goto close_xml_markup;
1913 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1916 xprintf(tab++, "<voltage-input unit=\"V\">");
1918 for (i = 0; i < a->nr[curr]; i++) {
1919 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1921 xprintf(tab, "<in number=\"%d\" inV=\"%.2f\" percent-in=\"%.2f\" device=\"%s\"/>",
1924 (spc->in_max - spc->in_min) ?
1925 (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
1930 xprintf(--tab, "</voltage-input>");
1934 if (CLOSE_MARKUP(a->options)) {
1935 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1940 ***************************************************************************
1941 * Display huge pages statistics in XML.
1944 * @a Activity structure with statistics.
1945 * @curr Index in array for current sample statistics.
1946 * @tab Indentation in XML output.
1947 * @itv Interval of time in 1/100th of a second.
1948 ***************************************************************************
1950 __print_funct_t xml_print_huge_stats(struct activity *a, int curr, int tab,
1951 unsigned long long itv)
1954 *smc = (struct stats_huge *) a->buf[curr];
1956 xprintf(tab, "<hugepages unit=\"kB\">");
1958 xprintf(++tab, "<hugfree>%llu</hugfree>",
1961 xprintf(tab, "<hugused>%llu</hugused>",
1962 smc->tlhkb - smc->frhkb);
1964 xprintf(tab, "<hugused-percent>%.2f</hugused-percent>",
1966 SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
1969 xprintf(tab, "<hugrsvd>%llu</hugrsvd>",
1972 xprintf(tab--, "<hugsurp>%llu</hugsurp>",
1975 xprintf(tab, "</hugepages>");
1979 ***************************************************************************
1980 * Display weighted CPU frequency statistics in XML.
1983 * @a Activity structure with statistics.
1984 * @curr Index in array for current sample statistics.
1985 * @tab Indentation in XML output.
1986 * @itv Interval of time in 1/100th of a second.
1987 ***************************************************************************
1989 __print_funct_t xml_print_pwr_wghfreq_stats(struct activity *a, int curr, int tab,
1990 unsigned long long itv)
1993 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1994 unsigned long long tis, tisfreq;
1997 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1998 goto close_xml_markup;
2000 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2003 xprintf(tab++, "<cpu-weighted-frequency unit=\"MHz\">");
2005 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
2007 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
2008 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
2010 /* Should current CPU (including CPU "all") be displayed? */
2011 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
2018 for (k = 0; k < a->nr2; k++) {
2020 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2023 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2025 tisfreq += (spc_k->freq / 1000) *
2026 (spc_k->time_in_state - spp_k->time_in_state);
2027 tis += (spc_k->time_in_state - spp_k->time_in_state);
2031 /* This is CPU "all" */
2032 strcpy(cpuno, "all");
2035 sprintf(cpuno, "%d", i - 1);
2038 xprintf(tab, "<cpuwfreq number=\"%s\" "
2039 "weighted-frequency=\"%.2f\"/>",
2041 tis ? ((double) tisfreq) / tis : 0.0);
2044 xprintf(--tab, "</cpu-weighted-frequency>");
2048 if (CLOSE_MARKUP(a->options)) {
2049 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2054 ***************************************************************************
2055 * Display USB devices statistics in XML.
2058 * @a Activity structure with statistics.
2059 * @curr Index in array for current sample statistics.
2060 * @tab Indentation in XML output.
2061 * @itv Interval of time in 1/100th of a second.
2062 ***************************************************************************
2064 __print_funct_t xml_print_pwr_usb_stats(struct activity *a, int curr, int tab,
2065 unsigned long long itv)
2068 struct stats_pwr_usb *suc;
2070 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2071 goto close_xml_markup;
2073 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2076 xprintf(tab++, "<usb-devices>");
2078 for (i = 0; i < a->nr[curr]; i++) {
2079 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2081 xprintf(tab, "<usb bus_number=\"%d\" idvendor=\"%x\" idprod=\"%x\" "
2082 "maxpower=\"%u\" manufact=\"%s\" product=\"%s\"/>",
2086 suc->bmaxpower << 1,
2091 xprintf(--tab, "</usb-devices>");
2095 if (CLOSE_MARKUP(a->options)) {
2096 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2101 ***************************************************************************
2102 * Display filesystems statistics in XML.
2105 * @a Activity structure with statistics.
2106 * @curr Index in array for current sample statistics.
2107 * @tab Indentation in XML output.
2108 * @itv Interval of time in 1/100th of a second.
2109 ***************************************************************************
2111 __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
2112 unsigned long long itv)
2115 struct stats_filesystem *sfc;
2118 xprintf(tab++, "<filesystems>");
2120 for (i = 0; i < a->nr[curr]; i++) {
2121 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2123 /* Get name to display (persistent or standard fs name, or mount point) */
2124 dev_name = get_fs_name_to_display(a, flags, sfc);
2126 if (a->item_list != NULL) {
2127 /* A list of devices has been entered on the command line */
2128 if (!search_list_item(a->item_list, dev_name))
2129 /* Device not found */
2133 xprintf(tab, "<filesystem %s=\"%s\" "
2134 "MBfsfree=\"%.0f\" "
2135 "MBfsused=\"%.0f\" "
2136 "fsused-percent=\"%.2f\" "
2137 "ufsused-percent=\"%.2f\" "
2140 "Iused-percent=\"%.2f\"/>",
2141 DISPLAY_MOUNT(a->opt_flags) ? "mountp" : "fsname",
2143 (double) sfc->f_bfree / 1024 / 1024,
2144 (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2145 /* f_blocks is not zero. But test it anyway ;-) */
2146 sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2148 sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2151 sfc->f_files - sfc->f_ffree,
2152 sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2156 xprintf(--tab, "</filesystems>");
2160 ***************************************************************************
2161 * Display Fibre Channel HBA statistics in XML.
2164 * @a Activity structure with statistics.
2165 * @curr Index in array for current sample statistics.
2166 * @tab Indentation in XML output.
2167 * @itv Interval of time in 1/100th of a second.
2168 ***************************************************************************
2170 __print_funct_t xml_print_fchost_stats(struct activity *a, int curr, int tab,
2171 unsigned long long itv)
2173 int i, j, j0, found;
2174 struct stats_fchost *sfcc, *sfcp, sfczero;
2176 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2177 goto close_xml_markup;
2179 memset(&sfczero, 0, sizeof(struct stats_fchost));
2181 xml_markup_network(tab, OPEN_XML_MARKUP);
2184 for (i = 0; i < a->nr[curr]; i++) {
2187 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2189 if (a->nr[!curr] > 0) {
2190 /* Look for corresponding structure in previous iteration */
2193 if (j >= a->nr[!curr]) {
2194 j = a->nr[!curr] - 1;
2200 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
2201 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
2205 if (++j >= a->nr[!curr]) {
2213 /* This is a newly registered host */
2217 xprintf(tab, "<fchost name=\"%s\" "
2221 "fch_txw=\"%.2f\"/>",
2223 S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2224 S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2225 S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2226 S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
2231 if (CLOSE_MARKUP(a->options)) {
2232 xml_markup_network(tab, CLOSE_XML_MARKUP);
2237 ***************************************************************************
2238 * Display softnet statistics in XML.
2241 * @a Activity structure with statistics.
2242 * @curr Index in array for current sample statistics.
2243 * @tab Indentation in XML output.
2244 * @itv Interval of time in 1/100th of a second.
2245 ***************************************************************************
2247 __print_funct_t xml_print_softnet_stats(struct activity *a, int curr, int tab,
2248 unsigned long long itv)
2251 struct stats_softnet *ssnc, *ssnp;
2253 unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
2255 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2256 goto close_xml_markup;
2258 xml_markup_network(tab, OPEN_XML_MARKUP);
2261 /* @nr[curr] cannot normally be greater than @nr_ini */
2262 if (a->nr[curr] > a->nr_ini) {
2263 a->nr_ini = a->nr[curr];
2266 /* Compute statistics for CPU "all" */
2267 get_global_soft_statistics(a, !curr, curr, flags, offline_cpu_bitmap);
2269 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
2271 /* Should current CPU (including CPU "all") be displayed? */
2272 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) ||
2273 offline_cpu_bitmap[i >> 3] & (1 << (i & 0x07)))
2277 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
2278 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
2280 /* Yes: Display it */
2282 /* This is CPU "all" */
2283 strcpy(cpuno, "all");
2286 sprintf(cpuno, "%d", i - 1);
2289 xprintf(tab, "<softnet cpu=\"%s\" "
2294 "flw_lim=\"%.2f\"/>",
2296 S_VALUE(ssnp->processed, ssnc->processed, itv),
2297 S_VALUE(ssnp->dropped, ssnc->dropped, itv),
2298 S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
2299 S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
2300 S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv));
2305 if (CLOSE_MARKUP(a->options)) {
2306 xml_markup_network(tab, CLOSE_XML_MARKUP);
2311 ***************************************************************************
2312 * Display pressure-stall CPU statistics in XML.
2315 * @a Activity structure with statistics.
2316 * @curr Index in array for current sample statistics.
2317 * @tab Indentation in XML output.
2318 * @itv Interval of time in 1/100th of a second.
2319 ***************************************************************************
2321 __print_funct_t xml_print_psicpu_stats(struct activity *a, int curr, int tab,
2322 unsigned long long itv)
2324 struct stats_psi_cpu
2325 *psic = (struct stats_psi_cpu *) a->buf[curr],
2326 *psip = (struct stats_psi_cpu *) a->buf[!curr];
2328 if (!IS_SELECTED(a->options))
2329 goto close_xml_markup;
2331 xml_markup_psi(tab, OPEN_XML_MARKUP);
2334 xprintf(tab, "<psi-cpu "
2335 "some_avg10=\"%.2f\" "
2336 "some_avg60=\"%.2f\" "
2337 "some_avg300=\"%.2f\" "
2338 "some_avg=\"%.2f\"/>",
2339 (double) psic->some_acpu_10 / 100,
2340 (double) psic->some_acpu_60 / 100,
2341 (double) psic->some_acpu_300 / 100,
2342 ((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
2346 if (CLOSE_MARKUP(a->options)) {
2347 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2352 ***************************************************************************
2353 * Display pressure-stall I/O statistics in XML.
2356 * @a Activity structure with statistics.
2357 * @curr Index in array for current sample statistics.
2358 * @tab Indentation in XML output.
2359 * @itv Interval of time in 1/100th of a second.
2360 ***************************************************************************
2362 __print_funct_t xml_print_psiio_stats(struct activity *a, int curr, int tab,
2363 unsigned long long itv)
2366 *psic = (struct stats_psi_io *) a->buf[curr],
2367 *psip = (struct stats_psi_io *) a->buf[!curr];
2369 if (!IS_SELECTED(a->options))
2370 goto close_xml_markup;
2372 xml_markup_psi(tab, OPEN_XML_MARKUP);
2375 xprintf(tab, "<psi-io "
2376 "some_avg10=\"%.2f\" "
2377 "some_avg60=\"%.2f\" "
2378 "some_avg300=\"%.2f\" "
2379 "some_avg=\"%.2f\" "
2380 "full_avg10=\"%.2f\" "
2381 "full_avg60=\"%.2f\" "
2382 "full_avg300=\"%.2f\" "
2383 "full_avg=\"%.2f\"/>",
2384 (double) psic->some_aio_10 / 100,
2385 (double) psic->some_aio_60 / 100,
2386 (double) psic->some_aio_300 / 100,
2387 ((double) psic->some_io_total - psip->some_io_total) / (100 * itv),
2388 (double) psic->full_aio_10 / 100,
2389 (double) psic->full_aio_60 / 100,
2390 (double) psic->full_aio_300 / 100,
2391 ((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
2395 if (CLOSE_MARKUP(a->options)) {
2396 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2401 ***************************************************************************
2402 * Display pressure-stall memory statistics in XML.
2405 * @a Activity structure with statistics.
2406 * @curr Index in array for current sample statistics.
2407 * @tab Indentation in XML output.
2408 * @itv Interval of time in 1/100th of a second.
2409 ***************************************************************************
2411 __print_funct_t xml_print_psimem_stats(struct activity *a, int curr, int tab,
2412 unsigned long long itv)
2414 struct stats_psi_mem
2415 *psic = (struct stats_psi_mem *) a->buf[curr],
2416 *psip = (struct stats_psi_mem *) a->buf[!curr];
2418 if (!IS_SELECTED(a->options))
2419 goto close_xml_markup;
2421 xml_markup_psi(tab, OPEN_XML_MARKUP);
2424 xprintf(tab, "<psi-mem "
2425 "some_avg10=\"%.2f\" "
2426 "some_avg60=\"%.2f\" "
2427 "some_avg300=\"%.2f\" "
2428 "some_avg=\"%.2f\" "
2429 "full_avg10=\"%.2f\" "
2430 "full_avg60=\"%.2f\" "
2431 "full_avg300=\"%.2f\" "
2432 "full_avg=\"%.2f\"/>",
2433 (double) psic->some_amem_10 / 100,
2434 (double) psic->some_amem_60 / 100,
2435 (double) psic->some_amem_300 / 100,
2436 ((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv),
2437 (double) psic->full_amem_10 / 100,
2438 (double) psic->full_amem_60 / 100,
2439 (double) psic->full_amem_300 / 100,
2440 ((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
2444 if (CLOSE_MARKUP(a->options)) {
2445 xml_markup_psi(tab, CLOSE_XML_MARKUP);