2 * xml_stats.c: Funtions used by sadf to display statistics in XML.
3 * (C) 1999-2019 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 unsigned int 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_sa_devname(sdc->major, sdc->minor,
749 sdc->wwn, sdc->part_nr, flags);
751 if (a->item_list != NULL) {
752 /* A list of devices has been entered on the command line */
753 if (!search_list_item(a->item_list, dev_name))
754 /* Device not found */
758 /* Compute extended statistics values */
759 compute_ext_disk_stats(sdc, sdp, itv, &xds);
761 xprintf(tab, "<disk-device dev=\"%s\" "
774 "util-percent=\"%.2f\"/>",
775 /* Confusion possible here between index and minor numbers */
777 S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
778 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv), /* Unit = sectors (for backward compatibility) */
779 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
780 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv),
781 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv) / 2,
782 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2,
783 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv) / 2,
784 /* See iostat for explanations */
785 xds.arqsz, /* Unit = sectors (for backward compatibility) */
787 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0, /* For backward compatibility */
788 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
793 xprintf(--tab, "</disk>");
797 ***************************************************************************
798 * Display network interfaces statistics in XML.
801 * @a Activity structure with statistics.
802 * @curr Index in array for current sample statistics.
803 * @tab Indentation in XML output.
804 * @itv Interval of time in 1/100th of a second.
805 ***************************************************************************
807 __print_funct_t xml_print_net_dev_stats(struct activity *a, int curr, int tab,
808 unsigned long long itv)
811 struct stats_net_dev *sndc, *sndp, sndzero;
812 double rxkb, txkb, ifutil;
814 if (!IS_SELECTED(a->options) || (a->nr <= 0))
815 goto close_xml_markup;
817 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
819 xml_markup_network(tab, OPEN_XML_MARKUP);
822 for (i = 0; i < a->nr[curr]; i++) {
824 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
826 if (a->item_list != NULL) {
827 /* A list of devices has been entered on the command line */
828 if (!search_list_item(a->item_list, sndc->interface))
829 /* Device not found */
833 j = check_net_dev_reg(a, curr, !curr, i);
835 /* This is a newly registered interface. Previous stats are zero */
839 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
842 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
843 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
844 ifutil = compute_ifutil(sndc, rxkb, txkb);
846 xprintf(tab, "<net-dev iface=\"%s\" "
854 "ifutil-percent=\"%.2f\"/>",
856 S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
857 S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
860 S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
861 S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
862 S_VALUE(sndp->multicast, sndc->multicast, itv),
868 if (CLOSE_MARKUP(a->options)) {
869 xml_markup_network(tab, CLOSE_XML_MARKUP);
874 ***************************************************************************
875 * Display network interfaces errors statistics in XML.
878 * @a Activity structure with statistics.
879 * @curr Index in array for current sample statistics.
880 * @tab Indentation in XML output.
881 * @itv Interval of time in 1/100th of a second.
882 ***************************************************************************
884 __print_funct_t xml_print_net_edev_stats(struct activity *a, int curr, int tab,
885 unsigned long long itv)
888 struct stats_net_edev *snedc, *snedp, snedzero;
890 if (!IS_SELECTED(a->options) || (a->nr <= 0))
891 goto close_xml_markup;
893 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
895 xml_markup_network(tab, OPEN_XML_MARKUP);
898 for (i = 0; i < a->nr[curr]; i++) {
900 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
902 if (a->item_list != NULL) {
903 /* A list of devices has been entered on the command line */
904 if (!search_list_item(a->item_list, snedc->interface))
905 /* Device not found */
909 j = check_net_edev_reg(a, curr, !curr, i);
911 /* This is a newly registered interface. Previous stats are zero */
915 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
918 xprintf(tab, "<net-edev iface=\"%s\" "
929 S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
930 S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
931 S_VALUE(snedp->collisions, snedc->collisions, itv),
932 S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
933 S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
934 S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
935 S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
936 S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
937 S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
942 if (CLOSE_MARKUP(a->options)) {
943 xml_markup_network(tab, CLOSE_XML_MARKUP);
948 ***************************************************************************
949 * Display NFS client statistics in XML.
952 * @a Activity structure with statistics.
953 * @curr Index in array for current sample statistics.
954 * @tab Indentation in XML output.
955 * @itv Interval of time in 1/100th of a second.
956 ***************************************************************************
958 __print_funct_t xml_print_net_nfs_stats(struct activity *a, int curr, int tab,
959 unsigned long long itv)
962 *snnc = (struct stats_net_nfs *) a->buf[curr],
963 *snnp = (struct stats_net_nfs *) a->buf[!curr];
965 if (!IS_SELECTED(a->options) || (a->nr <= 0))
966 goto close_xml_markup;
968 xml_markup_network(tab, OPEN_XML_MARKUP);
971 xprintf(tab, "<net-nfs "
978 S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
979 S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
980 S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
981 S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
982 S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
983 S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
987 if (CLOSE_MARKUP(a->options)) {
988 xml_markup_network(tab, CLOSE_XML_MARKUP);
993 ***************************************************************************
994 * Display NFS server statistics in XML.
997 * @a Activity structure with statistics.
998 * @curr Index in array for current sample statistics.
999 * @tab Indentation in XML output.
1000 * @itv Interval of time in 1/100th of a second.
1001 ***************************************************************************
1003 __print_funct_t xml_print_net_nfsd_stats(struct activity *a, int curr, int tab,
1004 unsigned long long itv)
1006 struct stats_net_nfsd
1007 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1008 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1010 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1011 goto close_xml_markup;
1013 xml_markup_network(tab, OPEN_XML_MARKUP);
1016 xprintf(tab, "<net-nfsd "
1027 "sgetatt=\"%.2f\"/>",
1028 S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1029 S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1030 S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1031 S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1032 S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1033 S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1034 S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1035 S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1036 S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1037 S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1038 S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1042 if (CLOSE_MARKUP(a->options)) {
1043 xml_markup_network(tab, CLOSE_XML_MARKUP);
1048 ***************************************************************************
1049 * Display network socket statistics in XML.
1052 * @a Activity structure with statistics.
1053 * @curr Index in array for current sample statistics.
1054 * @tab Indentation in XML output.
1055 * @itv Interval of time in 1/100th of a second.
1056 ***************************************************************************
1058 __print_funct_t xml_print_net_sock_stats(struct activity *a, int curr, int tab,
1059 unsigned long long itv)
1061 struct stats_net_sock
1062 *snsc = (struct stats_net_sock *) a->buf[curr];
1064 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1065 goto close_xml_markup;
1067 xml_markup_network(tab, OPEN_XML_MARKUP);
1070 xprintf(tab, "<net-sock "
1086 if (CLOSE_MARKUP(a->options)) {
1087 xml_markup_network(tab, CLOSE_XML_MARKUP);
1092 ***************************************************************************
1093 * Display IP network statistics in XML.
1096 * @a Activity structure with statistics.
1097 * @curr Index in array for current sample statistics.
1098 * @tab Indentation in XML output.
1099 * @itv Interval of time in 1/100th of a second.
1100 ***************************************************************************
1102 __print_funct_t xml_print_net_ip_stats(struct activity *a, int curr, int tab,
1103 unsigned long long itv)
1106 *snic = (struct stats_net_ip *) a->buf[curr],
1107 *snip = (struct stats_net_ip *) a->buf[!curr];
1109 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1110 goto close_xml_markup;
1112 xml_markup_network(tab, OPEN_XML_MARKUP);
1115 xprintf(tab, "<net-ip "
1123 "fragcrt=\"%.2f\"/>",
1124 S_VALUE(snip->InReceives, snic->InReceives, itv),
1125 S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1126 S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1127 S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1128 S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1129 S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1130 S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1131 S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1135 if (CLOSE_MARKUP(a->options)) {
1136 xml_markup_network(tab, CLOSE_XML_MARKUP);
1141 ***************************************************************************
1142 * Display IP network errors statistics in XML.
1145 * @a Activity structure with statistics.
1146 * @curr Index in array for current sample statistics.
1147 * @tab Indentation in XML output.
1148 * @itv Interval of time in 1/100th of a second.
1149 ***************************************************************************
1151 __print_funct_t xml_print_net_eip_stats(struct activity *a, int curr, int tab,
1152 unsigned long long itv)
1154 struct stats_net_eip
1155 *sneic = (struct stats_net_eip *) a->buf[curr],
1156 *sneip = (struct stats_net_eip *) a->buf[!curr];
1158 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1159 goto close_xml_markup;
1161 xml_markup_network(tab, OPEN_XML_MARKUP);
1164 xprintf(tab, "<net-eip "
1173 S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1174 S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1175 S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1176 S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1177 S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1178 S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1179 S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1180 S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1184 if (CLOSE_MARKUP(a->options)) {
1185 xml_markup_network(tab, CLOSE_XML_MARKUP);
1190 ***************************************************************************
1191 * Display ICMP network statistics in XML.
1194 * @a Activity structure with statistics.
1195 * @curr Index in array for current sample statistics.
1196 * @tab Indentation in XML output.
1197 * @itv Interval of time in 1/100th of a second.
1198 ***************************************************************************
1200 __print_funct_t xml_print_net_icmp_stats(struct activity *a, int curr, int tab,
1201 unsigned long long itv)
1203 struct stats_net_icmp
1204 *snic = (struct stats_net_icmp *) a->buf[curr],
1205 *snip = (struct stats_net_icmp *) a->buf[!curr];
1207 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1208 goto close_xml_markup;
1210 xml_markup_network(tab, OPEN_XML_MARKUP);
1213 xprintf(tab, "<net-icmp "
1227 "oadrmkr=\"%.2f\"/>",
1228 S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1229 S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1230 S_VALUE(snip->InEchos, snic->InEchos, itv),
1231 S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1232 S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1233 S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1234 S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1235 S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1236 S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1237 S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1238 S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1239 S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1240 S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1241 S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1245 if (CLOSE_MARKUP(a->options)) {
1246 xml_markup_network(tab, CLOSE_XML_MARKUP);
1251 ***************************************************************************
1252 * Display ICMP error messages statistics in XML.
1255 * @a Activity structure with statistics.
1256 * @curr Index in array for current sample statistics.
1257 * @tab Indentation in XML output.
1258 * @itv Interval of time in 1/100th of a second.
1259 ***************************************************************************
1261 __print_funct_t xml_print_net_eicmp_stats(struct activity *a, int curr, int tab,
1262 unsigned long long itv)
1264 struct stats_net_eicmp
1265 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1266 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1268 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1269 goto close_xml_markup;
1271 xml_markup_network(tab, OPEN_XML_MARKUP);
1274 xprintf(tab, "<net-eicmp "
1286 "oredir=\"%.2f\"/>",
1287 S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1288 S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1289 S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1290 S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1291 S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1292 S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1293 S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1294 S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1295 S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1296 S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1297 S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1298 S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1302 if (CLOSE_MARKUP(a->options)) {
1303 xml_markup_network(tab, CLOSE_XML_MARKUP);
1308 ***************************************************************************
1309 * Display TCP network statistics in XML.
1312 * @a Activity structure with statistics.
1313 * @curr Index in array for current sample statistics.
1314 * @tab Indentation in XML output.
1315 * @itv Interval of time in 1/100th of a second.
1316 ***************************************************************************
1318 __print_funct_t xml_print_net_tcp_stats(struct activity *a, int curr, int tab,
1319 unsigned long long itv)
1321 struct stats_net_tcp
1322 *sntc = (struct stats_net_tcp *) a->buf[curr],
1323 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1325 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1326 goto close_xml_markup;
1328 xml_markup_network(tab, OPEN_XML_MARKUP);
1331 xprintf(tab, "<net-tcp "
1336 S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1337 S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1338 S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1339 S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1343 if (CLOSE_MARKUP(a->options)) {
1344 xml_markup_network(tab, CLOSE_XML_MARKUP);
1349 ***************************************************************************
1350 * Display TCP network errors statistics in XML.
1353 * @a Activity structure with statistics.
1354 * @curr Index in array for current sample statistics.
1355 * @tab Indentation in XML output.
1356 * @itv Interval of time in 1/100th of a second.
1357 ***************************************************************************
1359 __print_funct_t xml_print_net_etcp_stats(struct activity *a, int curr, int tab,
1360 unsigned long long itv)
1362 struct stats_net_etcp
1363 *snetc = (struct stats_net_etcp *) a->buf[curr],
1364 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1366 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1367 goto close_xml_markup;
1369 xml_markup_network(tab, OPEN_XML_MARKUP);
1372 xprintf(tab, "<net-etcp "
1378 S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1379 S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1380 S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1381 S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1382 S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1386 if (CLOSE_MARKUP(a->options)) {
1387 xml_markup_network(tab, CLOSE_XML_MARKUP);
1392 ***************************************************************************
1393 * Display UDP network statistics in XML.
1396 * @a Activity structure with statistics.
1397 * @curr Index in array for current sample statistics.
1398 * @tab Indentation in XML output.
1399 * @itv Interval of time in 1/100th of a second.
1400 ***************************************************************************
1402 __print_funct_t xml_print_net_udp_stats(struct activity *a, int curr, int tab,
1403 unsigned long long itv)
1405 struct stats_net_udp
1406 *snuc = (struct stats_net_udp *) a->buf[curr],
1407 *snup = (struct stats_net_udp *) a->buf[!curr];
1409 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1410 goto close_xml_markup;
1412 xml_markup_network(tab, OPEN_XML_MARKUP);
1415 xprintf(tab, "<net-udp "
1419 "idgmerr=\"%.2f\"/>",
1420 S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1421 S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1422 S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1423 S_VALUE(snup->InErrors, snuc->InErrors, itv));
1427 if (CLOSE_MARKUP(a->options)) {
1428 xml_markup_network(tab, CLOSE_XML_MARKUP);
1433 ***************************************************************************
1434 * Display IPv6 network socket statistics in XML.
1437 * @a Activity structure with statistics.
1438 * @curr Index in array for current sample statistics.
1439 * @tab Indentation in XML output.
1440 * @itv Interval of time in 1/100th of a second.
1441 ***************************************************************************
1443 __print_funct_t xml_print_net_sock6_stats(struct activity *a, int curr, int tab,
1444 unsigned long long itv)
1446 struct stats_net_sock6
1447 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1449 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1450 goto close_xml_markup;
1452 xml_markup_network(tab, OPEN_XML_MARKUP);
1455 xprintf(tab, "<net-sock6 "
1459 "ip6-frag=\"%u\"/>",
1467 if (CLOSE_MARKUP(a->options)) {
1468 xml_markup_network(tab, CLOSE_XML_MARKUP);
1473 ***************************************************************************
1474 * Display IPv6 network statistics in XML.
1477 * @a Activity structure with statistics.
1478 * @curr Index in array for current sample statistics.
1479 * @tab Indentation in XML output.
1480 * @itv Interval of time in 1/100th of a second.
1481 ***************************************************************************
1483 __print_funct_t xml_print_net_ip6_stats(struct activity *a, int curr, int tab,
1484 unsigned long long itv)
1486 struct stats_net_ip6
1487 *snic = (struct stats_net_ip6 *) a->buf[curr],
1488 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1490 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1491 goto close_xml_markup;
1493 xml_markup_network(tab, OPEN_XML_MARKUP);
1496 xprintf(tab, "<net-ip6 "
1506 "fragcr6=\"%.2f\"/>",
1507 S_VALUE(snip->InReceives6, snic->InReceives6, itv),
1508 S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1509 S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
1510 S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
1511 S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
1512 S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
1513 S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
1514 S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
1515 S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
1516 S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1520 if (CLOSE_MARKUP(a->options)) {
1521 xml_markup_network(tab, CLOSE_XML_MARKUP);
1526 ***************************************************************************
1527 * Display IPv6 network errors statistics in XML.
1530 * @a Activity structure with statistics.
1531 * @curr Index in array for current sample statistics.
1532 * @tab Indentation in XML output.
1533 * @itv Interval of time in 1/100th of a second.
1534 ***************************************************************************
1536 __print_funct_t xml_print_net_eip6_stats(struct activity *a, int curr, int tab,
1537 unsigned long long itv)
1539 struct stats_net_eip6
1540 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1541 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1543 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1544 goto close_xml_markup;
1546 xml_markup_network(tab, OPEN_XML_MARKUP);
1549 xprintf(tab, "<net-eip6 "
1560 "itrpck6=\"%.2f\"/>",
1561 S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
1562 S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
1563 S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1564 S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
1565 S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
1566 S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
1567 S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
1568 S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
1569 S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
1570 S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
1571 S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1575 if (CLOSE_MARKUP(a->options)) {
1576 xml_markup_network(tab, CLOSE_XML_MARKUP);
1581 ***************************************************************************
1582 * Display ICMPv6 network statistics in XML.
1585 * @a Activity structure with statistics.
1586 * @curr Index in array for current sample statistics.
1587 * @tab Indentation in XML output.
1588 * @itv Interval of time in 1/100th of a second.
1589 ***************************************************************************
1591 __print_funct_t xml_print_net_icmp6_stats(struct activity *a, int curr, int tab,
1592 unsigned long long itv)
1594 struct stats_net_icmp6
1595 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1596 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1598 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1599 goto close_xml_markup;
1601 xml_markup_network(tab, OPEN_XML_MARKUP);
1604 xprintf(tab, "<net-icmp6 "
1621 "onbad6=\"%.2f\"/>",
1622 S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
1623 S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
1624 S_VALUE(snip->InEchos6, snic->InEchos6, itv),
1625 S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
1626 S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
1627 S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
1628 S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
1629 S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
1630 S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
1631 S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
1632 S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
1633 S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
1634 S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
1635 S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
1636 S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
1637 S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
1638 S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1642 if (CLOSE_MARKUP(a->options)) {
1643 xml_markup_network(tab, CLOSE_XML_MARKUP);
1648 ***************************************************************************
1649 * Display ICMPv6 error messages statistics in XML.
1652 * @a Activity structure with statistics.
1653 * @curr Index in array for current sample statistics.
1654 * @tab Indentation in XML output.
1655 * @itv Interval of time in 1/100th of a second.
1656 ***************************************************************************
1658 __print_funct_t xml_print_net_eicmp6_stats(struct activity *a, int curr, int tab,
1659 unsigned long long itv)
1661 struct stats_net_eicmp6
1662 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1663 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1665 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1666 goto close_xml_markup;
1668 xml_markup_network(tab, OPEN_XML_MARKUP);
1671 xprintf(tab, "<net-eicmp6 "
1682 "opck2b6=\"%.2f\"/>",
1683 S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
1684 S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
1685 S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1686 S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
1687 S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
1688 S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
1689 S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1690 S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
1691 S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
1692 S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
1693 S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
1697 if (CLOSE_MARKUP(a->options)) {
1698 xml_markup_network(tab, CLOSE_XML_MARKUP);
1703 ***************************************************************************
1704 * Display UDPv6 network statistics in XML.
1707 * @a Activity structure with statistics.
1708 * @curr Index in array for current sample statistics.
1709 * @tab Indentation in XML output.
1710 * @itv Interval of time in 1/100th of a second.
1711 ***************************************************************************
1713 __print_funct_t xml_print_net_udp6_stats(struct activity *a, int curr, int tab,
1714 unsigned long long itv)
1716 struct stats_net_udp6
1717 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1718 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1720 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1721 goto close_xml_markup;
1723 xml_markup_network(tab, OPEN_XML_MARKUP);
1726 xprintf(tab, "<net-udp6 "
1730 "idgmer6=\"%.2f\"/>",
1731 S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
1732 S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1733 S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
1734 S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
1738 if (CLOSE_MARKUP(a->options)) {
1739 xml_markup_network(tab, CLOSE_XML_MARKUP);
1744 ***************************************************************************
1745 * Display CPU frequency statistics in XML.
1748 * @a Activity structure with statistics.
1749 * @curr Index in array for current sample statistics.
1750 * @tab Indentation in XML output.
1751 * @itv Interval of time in 1/100th of a second.
1752 ***************************************************************************
1754 __print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int tab,
1755 unsigned long long itv)
1758 struct stats_pwr_cpufreq *spc;
1761 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1762 goto close_xml_markup;
1764 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1767 xprintf(tab++, "<cpu-frequency unit=\"MHz\">");
1769 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1771 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1773 /* Should current CPU (including CPU "all") be displayed? */
1774 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1778 /* Yes: Display it */
1780 /* This is CPU "all" */
1781 strcpy(cpuno, "all");
1784 sprintf(cpuno, "%d", i - 1);
1787 xprintf(tab, "<cpufreq number=\"%s\" "
1788 "frequency=\"%.2f\"/>",
1790 ((double) spc->cpufreq) / 100);
1793 xprintf(--tab, "</cpu-frequency>");
1797 if (CLOSE_MARKUP(a->options)) {
1798 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1803 ***************************************************************************
1804 * Display fan statistics in XML.
1807 * @a Activity structure with statistics.
1808 * @curr Index in array for current sample statistics.
1809 * @tab Indentation in XML output.
1810 * @itv Interval of time in 1/100th of a second.
1811 ***************************************************************************
1813 __print_funct_t xml_print_pwr_fan_stats(struct activity *a, int curr, int tab,
1814 unsigned long long itv)
1817 struct stats_pwr_fan *spc;
1819 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1820 goto close_xml_markup;
1822 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1825 xprintf(tab++, "<fan-speed unit=\"rpm\">");
1827 for (i = 0; i < a->nr[curr]; i++) {
1828 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1830 xprintf(tab, "<fan number=\"%d\" rpm=\"%llu\" drpm=\"%llu\" device=\"%s\"/>",
1832 (unsigned long long) spc->rpm,
1833 (unsigned long long) (spc->rpm - spc->rpm_min),
1837 xprintf(--tab, "</fan-speed>");
1841 if (CLOSE_MARKUP(a->options)) {
1842 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1847 ***************************************************************************
1848 * Display temperature statistics in XML.
1851 * @a Activity structure with statistics.
1852 * @curr Index in array for current sample statistics.
1853 * @tab Indentation in XML output.
1854 * @itv Interval of time in 1/100th of a second.
1855 ***************************************************************************
1857 __print_funct_t xml_print_pwr_temp_stats(struct activity *a, int curr, int tab,
1858 unsigned long long itv)
1861 struct stats_pwr_temp *spc;
1863 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1864 goto close_xml_markup;
1866 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1869 xprintf(tab++, "<temperature unit=\"degree Celsius\">");
1871 for (i = 0; i < a->nr[curr]; i++) {
1872 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1874 xprintf(tab, "<temp number=\"%d\" degC=\"%.2f\" percent-temp=\"%.2f\" device=\"%s\"/>",
1877 (spc->temp_max - spc->temp_min) ?
1878 (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
1883 xprintf(--tab, "</temperature>");
1887 if (CLOSE_MARKUP(a->options)) {
1888 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1893 ***************************************************************************
1894 * Display voltage inputs statistics in XML.
1897 * @a Activity structure with statistics.
1898 * @curr Index in array for current sample statistics.
1899 * @tab Indentation in XML output.
1900 * @itv Interval of time in 1/100th of a second.
1901 ***************************************************************************
1903 __print_funct_t xml_print_pwr_in_stats(struct activity *a, int curr, int tab,
1904 unsigned long long itv)
1907 struct stats_pwr_in *spc;
1909 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1910 goto close_xml_markup;
1912 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1915 xprintf(tab++, "<voltage-input unit=\"V\">");
1917 for (i = 0; i < a->nr[curr]; i++) {
1918 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1920 xprintf(tab, "<in number=\"%d\" inV=\"%.2f\" percent-in=\"%.2f\" device=\"%s\"/>",
1923 (spc->in_max - spc->in_min) ?
1924 (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
1929 xprintf(--tab, "</voltage-input>");
1933 if (CLOSE_MARKUP(a->options)) {
1934 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1939 ***************************************************************************
1940 * Display huge pages statistics in XML.
1943 * @a Activity structure with statistics.
1944 * @curr Index in array for current sample statistics.
1945 * @tab Indentation in XML output.
1946 * @itv Interval of time in 1/100th of a second.
1947 ***************************************************************************
1949 __print_funct_t xml_print_huge_stats(struct activity *a, int curr, int tab,
1950 unsigned long long itv)
1953 *smc = (struct stats_huge *) a->buf[curr];
1955 xprintf(tab, "<hugepages unit=\"kB\">");
1957 xprintf(++tab, "<hugfree>%llu</hugfree>",
1960 xprintf(tab, "<hugused>%llu</hugused>",
1961 smc->tlhkb - smc->frhkb);
1963 xprintf(tab, "<hugused-percent>%.2f</hugused-percent>",
1965 SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
1968 xprintf(tab, "<hugrsvd>%llu</hugrsvd>",
1971 xprintf(tab--, "<hugsurp>%llu</hugsurp>",
1974 xprintf(tab, "</hugepages>");
1978 ***************************************************************************
1979 * Display weighted CPU frequency statistics in XML.
1982 * @a Activity structure with statistics.
1983 * @curr Index in array for current sample statistics.
1984 * @tab Indentation in XML output.
1985 * @itv Interval of time in 1/100th of a second.
1986 ***************************************************************************
1988 __print_funct_t xml_print_pwr_wghfreq_stats(struct activity *a, int curr, int tab,
1989 unsigned long long itv)
1992 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1993 unsigned long long tis, tisfreq;
1996 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1997 goto close_xml_markup;
1999 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2002 xprintf(tab++, "<cpu-weighted-frequency unit=\"MHz\">");
2004 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
2006 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
2007 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
2009 /* Should current CPU (including CPU "all") be displayed? */
2010 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
2017 for (k = 0; k < a->nr2; k++) {
2019 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2022 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2024 tisfreq += (spc_k->freq / 1000) *
2025 (spc_k->time_in_state - spp_k->time_in_state);
2026 tis += (spc_k->time_in_state - spp_k->time_in_state);
2030 /* This is CPU "all" */
2031 strcpy(cpuno, "all");
2034 sprintf(cpuno, "%d", i - 1);
2037 xprintf(tab, "<cpuwfreq number=\"%s\" "
2038 "weighted-frequency=\"%.2f\"/>",
2040 tis ? ((double) tisfreq) / tis : 0.0);
2043 xprintf(--tab, "</cpu-weighted-frequency>");
2047 if (CLOSE_MARKUP(a->options)) {
2048 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2053 ***************************************************************************
2054 * Display USB devices statistics in XML.
2057 * @a Activity structure with statistics.
2058 * @curr Index in array for current sample statistics.
2059 * @tab Indentation in XML output.
2060 * @itv Interval of time in 1/100th of a second.
2061 ***************************************************************************
2063 __print_funct_t xml_print_pwr_usb_stats(struct activity *a, int curr, int tab,
2064 unsigned long long itv)
2067 struct stats_pwr_usb *suc;
2069 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2070 goto close_xml_markup;
2072 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2075 xprintf(tab++, "<usb-devices>");
2077 for (i = 0; i < a->nr[curr]; i++) {
2078 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2080 xprintf(tab, "<usb bus_number=\"%d\" idvendor=\"%x\" idprod=\"%x\" "
2081 "maxpower=\"%u\" manufact=\"%s\" product=\"%s\"/>",
2085 suc->bmaxpower << 1,
2090 xprintf(--tab, "</usb-devices>");
2094 if (CLOSE_MARKUP(a->options)) {
2095 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2100 ***************************************************************************
2101 * Display filesystems statistics in XML.
2104 * @a Activity structure with statistics.
2105 * @curr Index in array for current sample statistics.
2106 * @tab Indentation in XML output.
2107 * @itv Interval of time in 1/100th of a second.
2108 ***************************************************************************
2110 __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
2111 unsigned long long itv)
2114 struct stats_filesystem *sfc;
2116 xprintf(tab++, "<filesystems>");
2118 for (i = 0; i < a->nr[curr]; i++) {
2120 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2122 if (a->item_list != NULL) {
2123 /* A list of devices has been entered on the command line */
2124 if (!search_list_item(a->item_list,
2125 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name))
2126 /* Device not found */
2130 xprintf(tab, "<filesystem %s=\"%s\" "
2131 "MBfsfree=\"%.0f\" "
2132 "MBfsused=\"%.0f\" "
2133 "fsused-percent=\"%.2f\" "
2134 "ufsused-percent=\"%.2f\" "
2137 "Iused-percent=\"%.2f\"/>",
2138 DISPLAY_MOUNT(a->opt_flags) ? "mountp" : "fsname",
2139 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name,
2140 (double) sfc->f_bfree / 1024 / 1024,
2141 (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2142 /* f_blocks is not zero. But test it anyway ;-) */
2143 sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2145 sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2148 sfc->f_files - sfc->f_ffree,
2149 sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2153 xprintf(--tab, "</filesystems>");
2157 ***************************************************************************
2158 * Display Fibre Channel HBA statistics in XML.
2161 * @a Activity structure with statistics.
2162 * @curr Index in array for current sample statistics.
2163 * @tab Indentation in XML output.
2164 * @itv Interval of time in 1/100th of a second.
2165 ***************************************************************************
2167 __print_funct_t xml_print_fchost_stats(struct activity *a, int curr, int tab,
2168 unsigned long long itv)
2170 int i, j, j0, found;
2171 struct stats_fchost *sfcc, *sfcp, sfczero;
2173 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2174 goto close_xml_markup;
2176 memset(&sfczero, 0, sizeof(struct stats_fchost));
2178 xml_markup_network(tab, OPEN_XML_MARKUP);
2181 for (i = 0; i < a->nr[curr]; i++) {
2184 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2186 if (a->nr[!curr] > 0) {
2187 /* Look for corresponding structure in previous iteration */
2190 if (j >= a->nr[!curr]) {
2191 j = a->nr[!curr] - 1;
2197 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
2198 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
2202 if (++j >= a->nr[!curr]) {
2210 /* This is a newly registered host */
2214 xprintf(tab, "<fchost name=\"%s\" "
2218 "fch_txw=\"%.2f\"/>",
2220 S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2221 S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2222 S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2223 S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
2228 if (CLOSE_MARKUP(a->options)) {
2229 xml_markup_network(tab, CLOSE_XML_MARKUP);
2234 ***************************************************************************
2235 * Display softnet statistics in XML.
2238 * @a Activity structure with statistics.
2239 * @curr Index in array for current sample statistics.
2240 * @tab Indentation in XML output.
2241 * @itv Interval of time in 1/100th of a second.
2242 ***************************************************************************
2244 __print_funct_t xml_print_softnet_stats(struct activity *a, int curr, int tab,
2245 unsigned long long itv)
2248 struct stats_softnet *ssnc, *ssnp;
2250 unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
2252 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2253 goto close_xml_markup;
2255 xml_markup_network(tab, OPEN_XML_MARKUP);
2258 /* @nr[curr] cannot normally be greater than @nr_ini */
2259 if (a->nr[curr] > a->nr_ini) {
2260 a->nr_ini = a->nr[curr];
2263 /* Compute statistics for CPU "all" */
2264 get_global_soft_statistics(a, !curr, curr, flags, offline_cpu_bitmap);
2266 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
2268 /* Should current CPU (including CPU "all") be displayed? */
2269 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) ||
2270 offline_cpu_bitmap[i >> 3] & (1 << (i & 0x07)))
2274 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
2275 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
2277 /* Yes: Display it */
2279 /* This is CPU "all" */
2280 strcpy(cpuno, "all");
2283 sprintf(cpuno, "%d", i - 1);
2286 xprintf(tab, "<softnet cpu=\"%s\" "
2291 "flw_lim=\"%.2f\"/>",
2293 S_VALUE(ssnp->processed, ssnc->processed, itv),
2294 S_VALUE(ssnp->dropped, ssnc->dropped, itv),
2295 S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
2296 S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
2297 S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv));
2302 if (CLOSE_MARKUP(a->options)) {
2303 xml_markup_network(tab, CLOSE_XML_MARKUP);
2308 ***************************************************************************
2309 * Display pressure-stall CPU statistics in XML.
2312 * @a Activity structure with statistics.
2313 * @curr Index in array for current sample statistics.
2314 * @tab Indentation in XML output.
2315 * @itv Interval of time in 1/100th of a second.
2316 ***************************************************************************
2318 __print_funct_t xml_print_psicpu_stats(struct activity *a, int curr, int tab,
2319 unsigned long long itv)
2321 struct stats_psi_cpu
2322 *psic = (struct stats_psi_cpu *) a->buf[curr],
2323 *psip = (struct stats_psi_cpu *) a->buf[!curr];
2325 if (!IS_SELECTED(a->options))
2326 goto close_xml_markup;
2328 xml_markup_psi(tab, OPEN_XML_MARKUP);
2331 xprintf(tab, "<psi-cpu "
2332 "some_avg10=\"%.2f\" "
2333 "some_avg60=\"%.2f\" "
2334 "some_avg300=\"%.2f\" "
2335 "some_avg=\"%.2f\"/>",
2336 (double) psic->some_acpu_10 / 100,
2337 (double) psic->some_acpu_60 / 100,
2338 (double) psic->some_acpu_300 / 100,
2339 ((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
2343 if (CLOSE_MARKUP(a->options)) {
2344 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2349 ***************************************************************************
2350 * Display pressure-stall I/O statistics in XML.
2353 * @a Activity structure with statistics.
2354 * @curr Index in array for current sample statistics.
2355 * @tab Indentation in XML output.
2356 * @itv Interval of time in 1/100th of a second.
2357 ***************************************************************************
2359 __print_funct_t xml_print_psiio_stats(struct activity *a, int curr, int tab,
2360 unsigned long long itv)
2363 *psic = (struct stats_psi_io *) a->buf[curr],
2364 *psip = (struct stats_psi_io *) a->buf[!curr];
2366 if (!IS_SELECTED(a->options))
2367 goto close_xml_markup;
2369 xml_markup_psi(tab, OPEN_XML_MARKUP);
2372 xprintf(tab, "<psi-io "
2373 "some_avg10=\"%.2f\" "
2374 "some_avg60=\"%.2f\" "
2375 "some_avg300=\"%.2f\" "
2376 "some_avg=\"%.2f\" "
2377 "full_avg10=\"%.2f\" "
2378 "full_avg60=\"%.2f\" "
2379 "full_avg300=\"%.2f\" "
2380 "full_avg=\"%.2f\"/>",
2381 (double) psic->some_aio_10 / 100,
2382 (double) psic->some_aio_60 / 100,
2383 (double) psic->some_aio_300 / 100,
2384 ((double) psic->some_io_total - psip->some_io_total) / (100 * itv),
2385 (double) psic->full_aio_10 / 100,
2386 (double) psic->full_aio_60 / 100,
2387 (double) psic->full_aio_300 / 100,
2388 ((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
2392 if (CLOSE_MARKUP(a->options)) {
2393 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2398 ***************************************************************************
2399 * Display pressure-stall memory statistics in XML.
2402 * @a Activity structure with statistics.
2403 * @curr Index in array for current sample statistics.
2404 * @tab Indentation in XML output.
2405 * @itv Interval of time in 1/100th of a second.
2406 ***************************************************************************
2408 __print_funct_t xml_print_psimem_stats(struct activity *a, int curr, int tab,
2409 unsigned long long itv)
2411 struct stats_psi_mem
2412 *psic = (struct stats_psi_mem *) a->buf[curr],
2413 *psip = (struct stats_psi_mem *) a->buf[!curr];
2415 if (!IS_SELECTED(a->options))
2416 goto close_xml_markup;
2418 xml_markup_psi(tab, OPEN_XML_MARKUP);
2421 xprintf(tab, "<psi-mem "
2422 "some_avg10=\"%.2f\" "
2423 "some_avg60=\"%.2f\" "
2424 "some_avg300=\"%.2f\" "
2425 "some_avg=\"%.2f\" "
2426 "full_avg10=\"%.2f\" "
2427 "full_avg60=\"%.2f\" "
2428 "full_avg300=\"%.2f\" "
2429 "full_avg=\"%.2f\"/>",
2430 (double) psic->some_amem_10 / 100,
2431 (double) psic->some_amem_60 / 100,
2432 (double) psic->some_amem_300 / 100,
2433 ((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv),
2434 (double) psic->full_amem_10 / 100,
2435 (double) psic->full_amem_60 / 100,
2436 (double) psic->full_amem_300 / 100,
2437 ((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
2441 if (CLOSE_MARKUP(a->options)) {
2442 xml_markup_psi(tab, CLOSE_XML_MARKUP);