2 * xml_stats.c: Functions used by sadf to display statistics in XML.
3 * (C) 1999-2022 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, K_LOWERALL);
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 *stc_cpu_irq, *stp_cpu_irq, *stc_cpuall_irq;
324 unsigned char masked_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
326 xprintf(tab++, "<interrupts>");
327 xprintf(tab++, "<int-global per=\"second\">");
329 /* @nr[curr] cannot normally be greater than @nr_ini */
330 if (a->nr[curr] > a->nr_ini) {
331 a->nr_ini = a->nr[curr];
334 /* Identify offline and unselected CPU, and keep persistent statistics values */
335 get_global_int_statistics(a, !curr, curr, flags, masked_cpu_bitmap);
337 for (i = 0; i < a->nr2; i++) {
339 stc_cpuall_irq = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
341 if (a->item_list != NULL) {
342 /* A list of devices has been entered on the command line */
343 if (!search_list_item(a->item_list, stc_cpuall_irq->irq_name))
344 /* Device not found */
348 for (c = 0; (c < a->nr[curr]) && (c < a->bitmap->b_size + 1); c++) {
350 stc_cpu_irq = (struct stats_irq *) ((char *) a->buf[curr] + c * a->msize * a->nr2
352 stp_cpu_irq = (struct stats_irq *) ((char *) a->buf[!curr] + c * a->msize * a->nr2
355 /* Should current CPU (including CPU "all") be displayed? */
356 if (masked_cpu_bitmap[c >> 3] & (1 << (c & 0x07)))
360 /* Yes: Display it */
362 xprintf(tab, "<irq intr=\"%s\" cpu=\"all\" value=\"%.2f\"/>",
363 stc_cpuall_irq->irq_name,
364 (stc_cpu_irq->irq_nr < stp_cpu_irq->irq_nr) ? 0.0 :
365 S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv));
368 xprintf(tab, "<irq intr=\"%s\" cpu=\"%d\" value=\"%.2f\"/>",
369 stc_cpuall_irq->irq_name,
371 S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv));
376 xprintf(--tab, "</int-global>");
377 xprintf(--tab, "</interrupts>");
381 ***************************************************************************
382 * Display swapping 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_swap_stats(struct activity *a, int curr, int tab,
392 unsigned long long itv)
395 *ssc = (struct stats_swap *) a->buf[curr],
396 *ssp = (struct stats_swap *) a->buf[!curr];
398 xprintf(tab, "<swap-pages per=\"second\" "
400 "pswpout=\"%.2f\"/>",
401 S_VALUE(ssp->pswpin, ssc->pswpin, itv),
402 S_VALUE(ssp->pswpout, ssc->pswpout, itv));
406 ***************************************************************************
407 * Display paging statistics in XML.
410 * @a Activity structure with statistics.
411 * @curr Index in array for current sample statistics.
412 * @tab Indentation in XML output.
413 * @itv Interval of time in 1/100th of a second.
414 ***************************************************************************
416 __print_funct_t xml_print_paging_stats(struct activity *a, int curr, int tab,
417 unsigned long long itv)
420 *spc = (struct stats_paging *) a->buf[curr],
421 *spp = (struct stats_paging *) a->buf[!curr];
423 xprintf(tab, "<paging per=\"second\" "
432 "vmeff-percent=\"%.2f\"/>",
433 S_VALUE(spp->pgpgin, spc->pgpgin, itv),
434 S_VALUE(spp->pgpgout, spc->pgpgout, itv),
435 S_VALUE(spp->pgfault, spc->pgfault, itv),
436 S_VALUE(spp->pgmajfault, spc->pgmajfault, itv),
437 S_VALUE(spp->pgfree, spc->pgfree, itv),
438 S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
439 S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
440 S_VALUE(spp->pgsteal, spc->pgsteal, itv),
441 (spc->pgscan_kswapd + spc->pgscan_direct -
442 spp->pgscan_kswapd - spp->pgscan_direct) ?
443 SP_VALUE(spp->pgsteal, spc->pgsteal,
444 spc->pgscan_kswapd + spc->pgscan_direct -
445 spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
449 ***************************************************************************
450 * Display I/O and transfer rate statistics in XML.
453 * @a Activity structure with statistics.
454 * @curr Index in array for current sample statistics.
455 * @tab Indentation in XML output.
456 * @itv Interval of time in 1/100th of a second.
457 ***************************************************************************
459 __print_funct_t xml_print_io_stats(struct activity *a, int curr, int tab,
460 unsigned long long itv)
463 *sic = (struct stats_io *) a->buf[curr],
464 *sip = (struct stats_io *) a->buf[!curr];
466 xprintf(tab, "<io per=\"second\">");
469 * If we get negative values, this is probably because
470 * one or more devices/filesystems have been unmounted.
471 * We display 0.0 in this case though we should rather tell
472 * the user that the value cannot be calculated here.
474 xprintf(++tab, "<tps>%.2f</tps>",
475 sic->dk_drive < sip->dk_drive ? 0.0 :
476 S_VALUE(sip->dk_drive, sic->dk_drive, itv));
478 xprintf(tab, "<io-reads rtps=\"%.2f\" bread=\"%.2f\"/>",
479 sic->dk_drive_rio < sip->dk_drive_rio ? 0.0 :
480 S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
481 sic->dk_drive_rblk < sip->dk_drive_rblk ? 0.0 :
482 S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv));
484 xprintf(tab, "<io-writes wtps=\"%.2f\" bwrtn=\"%.2f\"/>",
485 sic->dk_drive_wio < sip->dk_drive_wio ? 0.0 :
486 S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
487 sic->dk_drive_wblk < sip->dk_drive_wblk ? 0.0 :
488 S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
490 xprintf(tab, "<io-discard dtps=\"%.2f\" bdscd=\"%.2f\"/>",
491 sic->dk_drive_dio < sip->dk_drive_dio ? 0.0 :
492 S_VALUE(sip->dk_drive_dio, sic->dk_drive_dio, itv),
493 sic->dk_drive_dblk < sip->dk_drive_dblk ? 0.0 :
494 S_VALUE(sip->dk_drive_dblk, sic->dk_drive_dblk, itv));
496 xprintf(--tab, "</io>");
500 ***************************************************************************
501 * Display memory statistics in XML.
504 * @a Activity structure with statistics.
505 * @curr Index in array for current sample statistics.
506 * @tab Indentation in XML output.
507 * @itv Interval of time in 1/100th of a second.
508 ***************************************************************************
510 __print_funct_t xml_print_memory_stats(struct activity *a, int curr, int tab,
511 unsigned long long itv)
514 *smc = (struct stats_memory *) a->buf[curr];
515 unsigned long long nousedmem;
517 xprintf(tab, "<memory unit=\"kB\">");
519 if (DISPLAY_MEMORY(a->opt_flags)) {
521 nousedmem = smc->frmkb + smc->bufkb + smc->camkb + smc->slabkb;
522 if (nousedmem > smc->tlmkb) {
523 nousedmem = smc->tlmkb;
526 xprintf(++tab, "<memfree>%llu</memfree>",
529 xprintf(tab, "<avail>%llu</avail>",
532 xprintf(tab, "<memused>%llu</memused>",
533 smc->tlmkb - nousedmem);
535 xprintf(tab, "<memused-percent>%.2f</memused-percent>",
537 SP_VALUE(nousedmem, smc->tlmkb, smc->tlmkb) :
540 xprintf(tab, "<buffers>%llu</buffers>",
543 xprintf(tab, "<cached>%llu</cached>",
546 xprintf(tab, "<commit>%llu</commit>",
549 xprintf(tab, "<commit-percent>%.2f</commit-percent>",
550 (smc->tlmkb + smc->tlskb) ?
551 SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
554 xprintf(tab, "<active>%llu</active>",
557 xprintf(tab, "<inactive>%llu</inactive>",
560 xprintf(tab--, "<dirty>%llu</dirty>",
563 if (DISPLAY_MEM_ALL(a->opt_flags)) {
564 xprintf(++tab, "<anonpg>%llu</anonpg>",
567 xprintf(tab, "<slab>%llu</slab>",
570 xprintf(tab, "<kstack>%llu</kstack>",
573 xprintf(tab, "<pgtbl>%llu</pgtbl>",
576 xprintf(tab--, "<vmused>%llu</vmused>",
581 if (DISPLAY_SWAP(a->opt_flags)) {
583 xprintf(++tab, "<swpfree>%llu</swpfree>",
586 xprintf(tab, "<swpused>%llu</swpused>",
587 smc->tlskb - smc->frskb);
589 xprintf(tab, "<swpused-percent>%.2f</swpused-percent>",
591 SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
594 xprintf(tab, "<swpcad>%llu</swpcad>",
597 xprintf(tab--, "<swpcad-percent>%.2f</swpcad-percent>",
598 (smc->tlskb - smc->frskb) ?
599 SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
603 xprintf(tab, "</memory>");
607 ***************************************************************************
608 * Display kernel tables statistics in XML.
611 * @a Activity structure with statistics.
612 * @curr Index in array for current sample statistics.
613 * @tab Indentation in XML output.
614 * @itv Interval of time in 1/100th of a second.
615 ***************************************************************************
617 __print_funct_t xml_print_ktables_stats(struct activity *a, int curr, int tab,
618 unsigned long long itv)
621 *skc = (struct stats_ktables *) a->buf[curr];
623 xprintf(tab, "<kernel "
624 "dentunusd=\"%llu\" "
635 ***************************************************************************
636 * Display queue and load statistics in XML.
639 * @a Activity structure with statistics.
640 * @curr Index in array for current sample statistics.
641 * @tab Indentation in XML output.
642 * @itv Interval of time in 1/100th of a second.
643 ***************************************************************************
645 __print_funct_t xml_print_queue_stats(struct activity *a, int curr, int tab,
646 unsigned long long itv)
649 *sqc = (struct stats_queue *) a->buf[curr];
651 xprintf(tab, "<queue "
657 "blocked=\"%llu\"/>",
660 (double) sqc->load_avg_1 / 100,
661 (double) sqc->load_avg_5 / 100,
662 (double) sqc->load_avg_15 / 100,
667 ***************************************************************************
668 * Display serial lines statistics in XML.
671 * @a Activity structure with statistics.
672 * @curr Index in array for current sample statistics.
673 * @tab Indentation in XML output.
674 * @itv Interval of time in 1/100th of a second.
675 ***************************************************************************
677 __print_funct_t xml_print_serial_stats(struct activity *a, int curr, int tab,
678 unsigned long long itv)
681 struct stats_serial *ssc, *ssp;
683 xprintf(tab++, "<serial per=\"second\">");
685 for (i = 0; i < a->nr[curr]; i++) {
689 if (a->nr[!curr] > 0) {
690 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
692 /* Look for corresponding serial line in previous iteration */
695 if (j >= a->nr[!curr]) {
696 j = a->nr[!curr] - 1;
702 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + j * a->msize);
703 if (ssc->line == ssp->line) {
707 if (++j >= a->nr[!curr]) {
717 xprintf(tab, "<tty line=\"%d\" "
725 S_VALUE(ssp->rx, ssc->rx, itv),
726 S_VALUE(ssp->tx, ssc->tx, itv),
727 S_VALUE(ssp->frame, ssc->frame, itv),
728 S_VALUE(ssp->parity, ssc->parity, itv),
729 S_VALUE(ssp->brk, ssc->brk, itv),
730 S_VALUE(ssp->overrun, ssc->overrun, itv));
733 xprintf(--tab, "</serial>");
737 ***************************************************************************
738 * Display disks statistics in XML.
741 * @a Activity structure with statistics.
742 * @curr Index in array for current sample statistics.
743 * @tab Indentation in XML output.
744 * @itv Interval of time in 1/100th of a second.
745 ***************************************************************************
747 __print_funct_t xml_print_disk_stats(struct activity *a, int curr, int tab,
748 unsigned long long itv)
751 struct stats_disk *sdc, *sdp, sdpzero;
752 struct ext_disk_stats xds;
755 memset(&sdpzero, 0, STATS_DISK_SIZE);
757 xprintf(tab++, "<disk per=\"second\">");
759 for (i = 0; i < a->nr[curr]; i++) {
761 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
763 j = check_disk_reg(a, curr, !curr, i);
765 /* This is a newly registered interface. Previous stats are zero */
769 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
772 /* Get device name */
773 dev_name = get_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
774 DISPLAY_PRETTY(flags), DISPLAY_PERSIST_NAME_S(flags),
775 USE_STABLE_ID(flags), NULL);
777 if (a->item_list != NULL) {
778 /* A list of devices has been entered on the command line */
779 if (!search_list_item(a->item_list, dev_name))
780 /* Device not found */
784 /* Compute extended statistics values */
785 compute_ext_disk_stats(sdc, sdp, itv, &xds);
787 xprintf(tab, "<disk-device dev=\"%s\" "
800 "util-percent=\"%.2f\"/>",
801 /* Confusion possible here between index and minor numbers */
803 S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
804 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv), /* Unit = sectors (for backward compatibility) */
805 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
806 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv),
807 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv) / 2,
808 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2,
809 S_VALUE(sdp->dc_sect, sdc->dc_sect, itv) / 2,
810 /* See iostat for explanations */
811 xds.arqsz, /* Unit = sectors (for backward compatibility) */
813 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0, /* For backward compatibility */
814 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
819 xprintf(--tab, "</disk>");
823 ***************************************************************************
824 * Display network interfaces statistics in XML.
827 * @a Activity structure with statistics.
828 * @curr Index in array for current sample statistics.
829 * @tab Indentation in XML output.
830 * @itv Interval of time in 1/100th of a second.
831 ***************************************************************************
833 __print_funct_t xml_print_net_dev_stats(struct activity *a, int curr, int tab,
834 unsigned long long itv)
837 struct stats_net_dev *sndc, *sndp, sndzero;
838 double rxkb, txkb, ifutil;
840 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
841 goto close_xml_markup;
843 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
845 xml_markup_network(tab, OPEN_XML_MARKUP);
848 for (i = 0; i < a->nr[curr]; i++) {
850 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
852 if (a->item_list != NULL) {
853 /* A list of devices has been entered on the command line */
854 if (!search_list_item(a->item_list, sndc->interface))
855 /* Device not found */
859 j = check_net_dev_reg(a, curr, !curr, i);
861 /* This is a newly registered interface. Previous stats are zero */
865 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
868 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
869 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
870 ifutil = compute_ifutil(sndc, rxkb, txkb);
872 xprintf(tab, "<net-dev iface=\"%s\" "
880 "ifutil-percent=\"%.2f\"/>",
882 S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
883 S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
886 S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
887 S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
888 S_VALUE(sndp->multicast, sndc->multicast, itv),
894 if (CLOSE_MARKUP(a->options)) {
895 xml_markup_network(tab, CLOSE_XML_MARKUP);
900 ***************************************************************************
901 * Display network interfaces errors statistics in XML.
904 * @a Activity structure with statistics.
905 * @curr Index in array for current sample statistics.
906 * @tab Indentation in XML output.
907 * @itv Interval of time in 1/100th of a second.
908 ***************************************************************************
910 __print_funct_t xml_print_net_edev_stats(struct activity *a, int curr, int tab,
911 unsigned long long itv)
914 struct stats_net_edev *snedc, *snedp, snedzero;
916 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
917 goto close_xml_markup;
919 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
921 xml_markup_network(tab, OPEN_XML_MARKUP);
924 for (i = 0; i < a->nr[curr]; i++) {
926 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
928 if (a->item_list != NULL) {
929 /* A list of devices has been entered on the command line */
930 if (!search_list_item(a->item_list, snedc->interface))
931 /* Device not found */
935 j = check_net_edev_reg(a, curr, !curr, i);
937 /* This is a newly registered interface. Previous stats are zero */
941 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
944 xprintf(tab, "<net-edev iface=\"%s\" "
955 S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
956 S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
957 S_VALUE(snedp->collisions, snedc->collisions, itv),
958 S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
959 S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
960 S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
961 S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
962 S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
963 S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
968 if (CLOSE_MARKUP(a->options)) {
969 xml_markup_network(tab, CLOSE_XML_MARKUP);
974 ***************************************************************************
975 * Display NFS client statistics in XML.
978 * @a Activity structure with statistics.
979 * @curr Index in array for current sample statistics.
980 * @tab Indentation in XML output.
981 * @itv Interval of time in 1/100th of a second.
982 ***************************************************************************
984 __print_funct_t xml_print_net_nfs_stats(struct activity *a, int curr, int tab,
985 unsigned long long itv)
988 *snnc = (struct stats_net_nfs *) a->buf[curr],
989 *snnp = (struct stats_net_nfs *) a->buf[!curr];
991 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
992 goto close_xml_markup;
994 xml_markup_network(tab, OPEN_XML_MARKUP);
997 xprintf(tab, "<net-nfs "
1003 "getatt=\"%.2f\"/>",
1004 S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
1005 S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
1006 S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
1007 S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
1008 S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
1009 S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
1013 if (CLOSE_MARKUP(a->options)) {
1014 xml_markup_network(tab, CLOSE_XML_MARKUP);
1019 ***************************************************************************
1020 * Display NFS server statistics in XML.
1023 * @a Activity structure with statistics.
1024 * @curr Index in array for current sample statistics.
1025 * @tab Indentation in XML output.
1026 * @itv Interval of time in 1/100th of a second.
1027 ***************************************************************************
1029 __print_funct_t xml_print_net_nfsd_stats(struct activity *a, int curr, int tab,
1030 unsigned long long itv)
1032 struct stats_net_nfsd
1033 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1034 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1036 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1037 goto close_xml_markup;
1039 xml_markup_network(tab, OPEN_XML_MARKUP);
1042 xprintf(tab, "<net-nfsd "
1053 "sgetatt=\"%.2f\"/>",
1054 S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1055 S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1056 S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1057 S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1058 S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1059 S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1060 S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1061 S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1062 S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1063 S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1064 S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1068 if (CLOSE_MARKUP(a->options)) {
1069 xml_markup_network(tab, CLOSE_XML_MARKUP);
1074 ***************************************************************************
1075 * Display network socket statistics in XML.
1078 * @a Activity structure with statistics.
1079 * @curr Index in array for current sample statistics.
1080 * @tab Indentation in XML output.
1081 * @itv Interval of time in 1/100th of a second.
1082 ***************************************************************************
1084 __print_funct_t xml_print_net_sock_stats(struct activity *a, int curr, int tab,
1085 unsigned long long itv)
1087 struct stats_net_sock
1088 *snsc = (struct stats_net_sock *) a->buf[curr];
1090 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1091 goto close_xml_markup;
1093 xml_markup_network(tab, OPEN_XML_MARKUP);
1096 xprintf(tab, "<net-sock "
1112 if (CLOSE_MARKUP(a->options)) {
1113 xml_markup_network(tab, CLOSE_XML_MARKUP);
1118 ***************************************************************************
1119 * Display IP network statistics in XML.
1122 * @a Activity structure with statistics.
1123 * @curr Index in array for current sample statistics.
1124 * @tab Indentation in XML output.
1125 * @itv Interval of time in 1/100th of a second.
1126 ***************************************************************************
1128 __print_funct_t xml_print_net_ip_stats(struct activity *a, int curr, int tab,
1129 unsigned long long itv)
1132 *snic = (struct stats_net_ip *) a->buf[curr],
1133 *snip = (struct stats_net_ip *) a->buf[!curr];
1135 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1136 goto close_xml_markup;
1138 xml_markup_network(tab, OPEN_XML_MARKUP);
1141 xprintf(tab, "<net-ip "
1149 "fragcrt=\"%.2f\"/>",
1150 S_VALUE(snip->InReceives, snic->InReceives, itv),
1151 S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1152 S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1153 S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1154 S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1155 S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1156 S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1157 S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1161 if (CLOSE_MARKUP(a->options)) {
1162 xml_markup_network(tab, CLOSE_XML_MARKUP);
1167 ***************************************************************************
1168 * Display IP network errors statistics in XML.
1171 * @a Activity structure with statistics.
1172 * @curr Index in array for current sample statistics.
1173 * @tab Indentation in XML output.
1174 * @itv Interval of time in 1/100th of a second.
1175 ***************************************************************************
1177 __print_funct_t xml_print_net_eip_stats(struct activity *a, int curr, int tab,
1178 unsigned long long itv)
1180 struct stats_net_eip
1181 *sneic = (struct stats_net_eip *) a->buf[curr],
1182 *sneip = (struct stats_net_eip *) a->buf[!curr];
1184 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1185 goto close_xml_markup;
1187 xml_markup_network(tab, OPEN_XML_MARKUP);
1190 xprintf(tab, "<net-eip "
1199 S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1200 S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1201 S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1202 S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1203 S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1204 S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1205 S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1206 S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1210 if (CLOSE_MARKUP(a->options)) {
1211 xml_markup_network(tab, CLOSE_XML_MARKUP);
1216 ***************************************************************************
1217 * Display ICMP network statistics in XML.
1220 * @a Activity structure with statistics.
1221 * @curr Index in array for current sample statistics.
1222 * @tab Indentation in XML output.
1223 * @itv Interval of time in 1/100th of a second.
1224 ***************************************************************************
1226 __print_funct_t xml_print_net_icmp_stats(struct activity *a, int curr, int tab,
1227 unsigned long long itv)
1229 struct stats_net_icmp
1230 *snic = (struct stats_net_icmp *) a->buf[curr],
1231 *snip = (struct stats_net_icmp *) a->buf[!curr];
1233 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1234 goto close_xml_markup;
1236 xml_markup_network(tab, OPEN_XML_MARKUP);
1239 xprintf(tab, "<net-icmp "
1253 "oadrmkr=\"%.2f\"/>",
1254 S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1255 S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1256 S_VALUE(snip->InEchos, snic->InEchos, itv),
1257 S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1258 S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1259 S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1260 S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1261 S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1262 S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1263 S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1264 S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1265 S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1266 S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1267 S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1271 if (CLOSE_MARKUP(a->options)) {
1272 xml_markup_network(tab, CLOSE_XML_MARKUP);
1277 ***************************************************************************
1278 * Display ICMP error messages statistics in XML.
1281 * @a Activity structure with statistics.
1282 * @curr Index in array for current sample statistics.
1283 * @tab Indentation in XML output.
1284 * @itv Interval of time in 1/100th of a second.
1285 ***************************************************************************
1287 __print_funct_t xml_print_net_eicmp_stats(struct activity *a, int curr, int tab,
1288 unsigned long long itv)
1290 struct stats_net_eicmp
1291 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1292 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1294 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1295 goto close_xml_markup;
1297 xml_markup_network(tab, OPEN_XML_MARKUP);
1300 xprintf(tab, "<net-eicmp "
1312 "oredir=\"%.2f\"/>",
1313 S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1314 S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1315 S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1316 S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1317 S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1318 S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1319 S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1320 S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1321 S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1322 S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1323 S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1324 S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1328 if (CLOSE_MARKUP(a->options)) {
1329 xml_markup_network(tab, CLOSE_XML_MARKUP);
1334 ***************************************************************************
1335 * Display TCP network statistics in XML.
1338 * @a Activity structure with statistics.
1339 * @curr Index in array for current sample statistics.
1340 * @tab Indentation in XML output.
1341 * @itv Interval of time in 1/100th of a second.
1342 ***************************************************************************
1344 __print_funct_t xml_print_net_tcp_stats(struct activity *a, int curr, int tab,
1345 unsigned long long itv)
1347 struct stats_net_tcp
1348 *sntc = (struct stats_net_tcp *) a->buf[curr],
1349 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1351 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1352 goto close_xml_markup;
1354 xml_markup_network(tab, OPEN_XML_MARKUP);
1357 xprintf(tab, "<net-tcp "
1362 S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1363 S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1364 S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1365 S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1369 if (CLOSE_MARKUP(a->options)) {
1370 xml_markup_network(tab, CLOSE_XML_MARKUP);
1375 ***************************************************************************
1376 * Display TCP network errors statistics in XML.
1379 * @a Activity structure with statistics.
1380 * @curr Index in array for current sample statistics.
1381 * @tab Indentation in XML output.
1382 * @itv Interval of time in 1/100th of a second.
1383 ***************************************************************************
1385 __print_funct_t xml_print_net_etcp_stats(struct activity *a, int curr, int tab,
1386 unsigned long long itv)
1388 struct stats_net_etcp
1389 *snetc = (struct stats_net_etcp *) a->buf[curr],
1390 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1392 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1393 goto close_xml_markup;
1395 xml_markup_network(tab, OPEN_XML_MARKUP);
1398 xprintf(tab, "<net-etcp "
1404 S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1405 S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1406 S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1407 S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1408 S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1412 if (CLOSE_MARKUP(a->options)) {
1413 xml_markup_network(tab, CLOSE_XML_MARKUP);
1418 ***************************************************************************
1419 * Display UDP network statistics in XML.
1422 * @a Activity structure with statistics.
1423 * @curr Index in array for current sample statistics.
1424 * @tab Indentation in XML output.
1425 * @itv Interval of time in 1/100th of a second.
1426 ***************************************************************************
1428 __print_funct_t xml_print_net_udp_stats(struct activity *a, int curr, int tab,
1429 unsigned long long itv)
1431 struct stats_net_udp
1432 *snuc = (struct stats_net_udp *) a->buf[curr],
1433 *snup = (struct stats_net_udp *) a->buf[!curr];
1435 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1436 goto close_xml_markup;
1438 xml_markup_network(tab, OPEN_XML_MARKUP);
1441 xprintf(tab, "<net-udp "
1445 "idgmerr=\"%.2f\"/>",
1446 S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1447 S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1448 S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1449 S_VALUE(snup->InErrors, snuc->InErrors, itv));
1453 if (CLOSE_MARKUP(a->options)) {
1454 xml_markup_network(tab, CLOSE_XML_MARKUP);
1459 ***************************************************************************
1460 * Display IPv6 network socket statistics in XML.
1463 * @a Activity structure with statistics.
1464 * @curr Index in array for current sample statistics.
1465 * @tab Indentation in XML output.
1466 * @itv Interval of time in 1/100th of a second.
1467 ***************************************************************************
1469 __print_funct_t xml_print_net_sock6_stats(struct activity *a, int curr, int tab,
1470 unsigned long long itv)
1472 struct stats_net_sock6
1473 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1475 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1476 goto close_xml_markup;
1478 xml_markup_network(tab, OPEN_XML_MARKUP);
1481 xprintf(tab, "<net-sock6 "
1485 "ip6-frag=\"%u\"/>",
1493 if (CLOSE_MARKUP(a->options)) {
1494 xml_markup_network(tab, CLOSE_XML_MARKUP);
1499 ***************************************************************************
1500 * Display IPv6 network statistics in XML.
1503 * @a Activity structure with statistics.
1504 * @curr Index in array for current sample statistics.
1505 * @tab Indentation in XML output.
1506 * @itv Interval of time in 1/100th of a second.
1507 ***************************************************************************
1509 __print_funct_t xml_print_net_ip6_stats(struct activity *a, int curr, int tab,
1510 unsigned long long itv)
1512 struct stats_net_ip6
1513 *snic = (struct stats_net_ip6 *) a->buf[curr],
1514 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1516 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1517 goto close_xml_markup;
1519 xml_markup_network(tab, OPEN_XML_MARKUP);
1522 xprintf(tab, "<net-ip6 "
1532 "fragcr6=\"%.2f\"/>",
1533 S_VALUE(snip->InReceives6, snic->InReceives6, itv),
1534 S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1535 S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
1536 S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
1537 S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
1538 S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
1539 S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
1540 S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
1541 S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
1542 S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1546 if (CLOSE_MARKUP(a->options)) {
1547 xml_markup_network(tab, CLOSE_XML_MARKUP);
1552 ***************************************************************************
1553 * Display IPv6 network errors statistics in XML.
1556 * @a Activity structure with statistics.
1557 * @curr Index in array for current sample statistics.
1558 * @tab Indentation in XML output.
1559 * @itv Interval of time in 1/100th of a second.
1560 ***************************************************************************
1562 __print_funct_t xml_print_net_eip6_stats(struct activity *a, int curr, int tab,
1563 unsigned long long itv)
1565 struct stats_net_eip6
1566 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1567 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1569 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1570 goto close_xml_markup;
1572 xml_markup_network(tab, OPEN_XML_MARKUP);
1575 xprintf(tab, "<net-eip6 "
1586 "itrpck6=\"%.2f\"/>",
1587 S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
1588 S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
1589 S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1590 S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
1591 S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
1592 S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
1593 S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
1594 S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
1595 S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
1596 S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
1597 S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1601 if (CLOSE_MARKUP(a->options)) {
1602 xml_markup_network(tab, CLOSE_XML_MARKUP);
1607 ***************************************************************************
1608 * Display ICMPv6 network statistics in XML.
1611 * @a Activity structure with statistics.
1612 * @curr Index in array for current sample statistics.
1613 * @tab Indentation in XML output.
1614 * @itv Interval of time in 1/100th of a second.
1615 ***************************************************************************
1617 __print_funct_t xml_print_net_icmp6_stats(struct activity *a, int curr, int tab,
1618 unsigned long long itv)
1620 struct stats_net_icmp6
1621 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1622 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1624 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1625 goto close_xml_markup;
1627 xml_markup_network(tab, OPEN_XML_MARKUP);
1630 xprintf(tab, "<net-icmp6 "
1647 "onbad6=\"%.2f\"/>",
1648 S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
1649 S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
1650 S_VALUE(snip->InEchos6, snic->InEchos6, itv),
1651 S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
1652 S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
1653 S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
1654 S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
1655 S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
1656 S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
1657 S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
1658 S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
1659 S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
1660 S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
1661 S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
1662 S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
1663 S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
1664 S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1668 if (CLOSE_MARKUP(a->options)) {
1669 xml_markup_network(tab, CLOSE_XML_MARKUP);
1674 ***************************************************************************
1675 * Display ICMPv6 error messages statistics in XML.
1678 * @a Activity structure with statistics.
1679 * @curr Index in array for current sample statistics.
1680 * @tab Indentation in XML output.
1681 * @itv Interval of time in 1/100th of a second.
1682 ***************************************************************************
1684 __print_funct_t xml_print_net_eicmp6_stats(struct activity *a, int curr, int tab,
1685 unsigned long long itv)
1687 struct stats_net_eicmp6
1688 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1689 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1691 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1692 goto close_xml_markup;
1694 xml_markup_network(tab, OPEN_XML_MARKUP);
1697 xprintf(tab, "<net-eicmp6 "
1708 "opck2b6=\"%.2f\"/>",
1709 S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
1710 S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
1711 S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1712 S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
1713 S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
1714 S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
1715 S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1716 S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
1717 S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
1718 S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
1719 S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
1723 if (CLOSE_MARKUP(a->options)) {
1724 xml_markup_network(tab, CLOSE_XML_MARKUP);
1729 ***************************************************************************
1730 * Display UDPv6 network statistics in XML.
1733 * @a Activity structure with statistics.
1734 * @curr Index in array for current sample statistics.
1735 * @tab Indentation in XML output.
1736 * @itv Interval of time in 1/100th of a second.
1737 ***************************************************************************
1739 __print_funct_t xml_print_net_udp6_stats(struct activity *a, int curr, int tab,
1740 unsigned long long itv)
1742 struct stats_net_udp6
1743 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1744 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1746 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1747 goto close_xml_markup;
1749 xml_markup_network(tab, OPEN_XML_MARKUP);
1752 xprintf(tab, "<net-udp6 "
1756 "idgmer6=\"%.2f\"/>",
1757 S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
1758 S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1759 S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
1760 S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
1764 if (CLOSE_MARKUP(a->options)) {
1765 xml_markup_network(tab, CLOSE_XML_MARKUP);
1770 ***************************************************************************
1771 * Display CPU frequency statistics in XML.
1774 * @a Activity structure with statistics.
1775 * @curr Index in array for current sample statistics.
1776 * @tab Indentation in XML output.
1777 * @itv Interval of time in 1/100th of a second.
1778 ***************************************************************************
1780 __print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int tab,
1781 unsigned long long itv)
1784 struct stats_pwr_cpufreq *spc;
1787 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1788 goto close_xml_markup;
1790 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1793 xprintf(tab++, "<cpu-frequency unit=\"MHz\">");
1795 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1797 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1799 /* Should current CPU (including CPU "all") be displayed? */
1800 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1804 /* Yes: Display it */
1806 /* This is CPU "all" */
1807 strcpy(cpuno, K_LOWERALL);
1810 sprintf(cpuno, "%d", i - 1);
1813 xprintf(tab, "<cpufreq number=\"%s\" "
1814 "frequency=\"%.2f\"/>",
1816 ((double) spc->cpufreq) / 100);
1819 xprintf(--tab, "</cpu-frequency>");
1823 if (CLOSE_MARKUP(a->options)) {
1824 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1829 ***************************************************************************
1830 * Display fan statistics in XML.
1833 * @a Activity structure with statistics.
1834 * @curr Index in array for current sample statistics.
1835 * @tab Indentation in XML output.
1836 * @itv Interval of time in 1/100th of a second.
1837 ***************************************************************************
1839 __print_funct_t xml_print_pwr_fan_stats(struct activity *a, int curr, int tab,
1840 unsigned long long itv)
1843 struct stats_pwr_fan *spc;
1845 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1846 goto close_xml_markup;
1848 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1851 xprintf(tab++, "<fan-speed unit=\"rpm\">");
1853 for (i = 0; i < a->nr[curr]; i++) {
1854 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1856 xprintf(tab, "<fan number=\"%d\" rpm=\"%llu\" drpm=\"%llu\" device=\"%s\"/>",
1858 (unsigned long long) spc->rpm,
1859 (unsigned long long) (spc->rpm - spc->rpm_min),
1863 xprintf(--tab, "</fan-speed>");
1867 if (CLOSE_MARKUP(a->options)) {
1868 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1873 ***************************************************************************
1874 * Display temperature statistics in XML.
1877 * @a Activity structure with statistics.
1878 * @curr Index in array for current sample statistics.
1879 * @tab Indentation in XML output.
1880 * @itv Interval of time in 1/100th of a second.
1881 ***************************************************************************
1883 __print_funct_t xml_print_pwr_temp_stats(struct activity *a, int curr, int tab,
1884 unsigned long long itv)
1887 struct stats_pwr_temp *spc;
1889 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1890 goto close_xml_markup;
1892 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1895 xprintf(tab++, "<temperature unit=\"degree Celsius\">");
1897 for (i = 0; i < a->nr[curr]; i++) {
1898 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1900 xprintf(tab, "<temp number=\"%d\" degC=\"%.2f\" percent-temp=\"%.2f\" device=\"%s\"/>",
1903 (spc->temp_max - spc->temp_min) ?
1904 (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
1909 xprintf(--tab, "</temperature>");
1913 if (CLOSE_MARKUP(a->options)) {
1914 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1919 ***************************************************************************
1920 * Display voltage inputs statistics in XML.
1923 * @a Activity structure with statistics.
1924 * @curr Index in array for current sample statistics.
1925 * @tab Indentation in XML output.
1926 * @itv Interval of time in 1/100th of a second.
1927 ***************************************************************************
1929 __print_funct_t xml_print_pwr_in_stats(struct activity *a, int curr, int tab,
1930 unsigned long long itv)
1933 struct stats_pwr_in *spc;
1935 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
1936 goto close_xml_markup;
1938 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1941 xprintf(tab++, "<voltage-input unit=\"V\">");
1943 for (i = 0; i < a->nr[curr]; i++) {
1944 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1946 xprintf(tab, "<in number=\"%d\" inV=\"%.2f\" percent-in=\"%.2f\" device=\"%s\"/>",
1949 (spc->in_max - spc->in_min) ?
1950 (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
1955 xprintf(--tab, "</voltage-input>");
1959 if (CLOSE_MARKUP(a->options)) {
1960 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1965 ***************************************************************************
1966 * Display huge pages statistics in XML.
1969 * @a Activity structure with statistics.
1970 * @curr Index in array for current sample statistics.
1971 * @tab Indentation in XML output.
1972 * @itv Interval of time in 1/100th of a second.
1973 ***************************************************************************
1975 __print_funct_t xml_print_huge_stats(struct activity *a, int curr, int tab,
1976 unsigned long long itv)
1979 *smc = (struct stats_huge *) a->buf[curr];
1981 xprintf(tab, "<hugepages unit=\"kB\">");
1983 xprintf(++tab, "<hugfree>%llu</hugfree>",
1986 xprintf(tab, "<hugused>%llu</hugused>",
1987 smc->tlhkb - smc->frhkb);
1989 xprintf(tab, "<hugused-percent>%.2f</hugused-percent>",
1991 SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
1994 xprintf(tab, "<hugrsvd>%llu</hugrsvd>",
1997 xprintf(tab--, "<hugsurp>%llu</hugsurp>",
2000 xprintf(tab, "</hugepages>");
2004 ***************************************************************************
2005 * Display weighted CPU frequency statistics in XML.
2008 * @a Activity structure with statistics.
2009 * @curr Index in array for current sample statistics.
2010 * @tab Indentation in XML output.
2011 * @itv Interval of time in 1/100th of a second.
2012 ***************************************************************************
2014 __print_funct_t xml_print_pwr_wghfreq_stats(struct activity *a, int curr, int tab,
2015 unsigned long long itv)
2018 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
2019 unsigned long long tis, tisfreq;
2022 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2023 goto close_xml_markup;
2025 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2028 xprintf(tab++, "<cpu-weighted-frequency unit=\"MHz\">");
2030 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
2032 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
2033 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
2035 /* Should current CPU (including CPU "all") be displayed? */
2036 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
2043 for (k = 0; k < a->nr2; k++) {
2045 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2048 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2050 tisfreq += (spc_k->freq / 1000) *
2051 (spc_k->time_in_state - spp_k->time_in_state);
2052 tis += (spc_k->time_in_state - spp_k->time_in_state);
2056 /* This is CPU "all" */
2057 strcpy(cpuno, K_LOWERALL);
2060 sprintf(cpuno, "%d", i - 1);
2063 xprintf(tab, "<cpuwfreq number=\"%s\" "
2064 "weighted-frequency=\"%.2f\"/>",
2066 tis ? ((double) tisfreq) / tis : 0.0);
2069 xprintf(--tab, "</cpu-weighted-frequency>");
2073 if (CLOSE_MARKUP(a->options)) {
2074 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2079 ***************************************************************************
2080 * Display USB devices statistics in XML.
2083 * @a Activity structure with statistics.
2084 * @curr Index in array for current sample statistics.
2085 * @tab Indentation in XML output.
2086 * @itv Interval of time in 1/100th of a second.
2087 ***************************************************************************
2089 __print_funct_t xml_print_pwr_usb_stats(struct activity *a, int curr, int tab,
2090 unsigned long long itv)
2093 struct stats_pwr_usb *suc;
2095 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2096 goto close_xml_markup;
2098 xml_markup_power_management(tab, OPEN_XML_MARKUP);
2101 xprintf(tab++, "<usb-devices>");
2103 for (i = 0; i < a->nr[curr]; i++) {
2104 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2106 xprintf(tab, "<usb bus_number=\"%d\" idvendor=\"%x\" idprod=\"%x\" "
2107 "maxpower=\"%u\" manufact=\"%s\" product=\"%s\"/>",
2111 suc->bmaxpower << 1,
2116 xprintf(--tab, "</usb-devices>");
2120 if (CLOSE_MARKUP(a->options)) {
2121 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2126 ***************************************************************************
2127 * Display filesystems statistics in XML.
2130 * @a Activity structure with statistics.
2131 * @curr Index in array for current sample statistics.
2132 * @tab Indentation in XML output.
2133 * @itv Interval of time in 1/100th of a second.
2134 ***************************************************************************
2136 __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
2137 unsigned long long itv)
2140 struct stats_filesystem *sfc;
2143 xprintf(tab++, "<filesystems>");
2145 for (i = 0; i < a->nr[curr]; i++) {
2146 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2148 /* Get name to display (persistent or standard fs name, or mount point) */
2149 dev_name = get_fs_name_to_display(a, flags, sfc);
2151 if (a->item_list != NULL) {
2152 /* A list of devices has been entered on the command line */
2153 if (!search_list_item(a->item_list, dev_name))
2154 /* Device not found */
2158 xprintf(tab, "<filesystem %s=\"%s\" "
2159 "MBfsfree=\"%.0f\" "
2160 "MBfsused=\"%.0f\" "
2161 "fsused-percent=\"%.2f\" "
2162 "ufsused-percent=\"%.2f\" "
2165 "Iused-percent=\"%.2f\"/>",
2166 DISPLAY_MOUNT(a->opt_flags) ? "mountp" : "fsname",
2168 (double) sfc->f_bfree / 1024 / 1024,
2169 (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2170 /* f_blocks is not zero. But test it anyway ;-) */
2171 sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2173 sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2176 sfc->f_files - sfc->f_ffree,
2177 sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2181 xprintf(--tab, "</filesystems>");
2185 ***************************************************************************
2186 * Display Fibre Channel HBA statistics in XML.
2189 * @a Activity structure with statistics.
2190 * @curr Index in array for current sample statistics.
2191 * @tab Indentation in XML output.
2192 * @itv Interval of time in 1/100th of a second.
2193 ***************************************************************************
2195 __print_funct_t xml_print_fchost_stats(struct activity *a, int curr, int tab,
2196 unsigned long long itv)
2198 int i, j, j0, found;
2199 struct stats_fchost *sfcc, *sfcp, sfczero;
2201 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2202 goto close_xml_markup;
2204 memset(&sfczero, 0, sizeof(struct stats_fchost));
2206 xml_markup_network(tab, OPEN_XML_MARKUP);
2209 for (i = 0; i < a->nr[curr]; i++) {
2212 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2214 if (a->nr[!curr] > 0) {
2215 /* Look for corresponding structure in previous iteration */
2218 if (j >= a->nr[!curr]) {
2219 j = a->nr[!curr] - 1;
2225 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
2226 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
2230 if (++j >= a->nr[!curr]) {
2238 /* This is a newly registered host */
2242 xprintf(tab, "<fchost name=\"%s\" "
2246 "fch_txw=\"%.2f\"/>",
2248 S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2249 S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2250 S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2251 S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
2256 if (CLOSE_MARKUP(a->options)) {
2257 xml_markup_network(tab, CLOSE_XML_MARKUP);
2262 ***************************************************************************
2263 * Display softnet statistics in XML.
2266 * @a Activity structure with statistics.
2267 * @curr Index in array for current sample statistics.
2268 * @tab Indentation in XML output.
2269 * @itv Interval of time in 1/100th of a second.
2270 ***************************************************************************
2272 __print_funct_t xml_print_softnet_stats(struct activity *a, int curr, int tab,
2273 unsigned long long itv)
2276 struct stats_softnet *ssnc, *ssnp;
2278 unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
2280 if (!IS_SELECTED(a->options) || (a->nr[curr] <= 0))
2281 goto close_xml_markup;
2283 xml_markup_network(tab, OPEN_XML_MARKUP);
2286 /* @nr[curr] cannot normally be greater than @nr_ini */
2287 if (a->nr[curr] > a->nr_ini) {
2288 a->nr_ini = a->nr[curr];
2291 /* Compute statistics for CPU "all" */
2292 get_global_soft_statistics(a, !curr, curr, flags, offline_cpu_bitmap);
2294 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
2296 /* Should current CPU (including CPU "all") be displayed? */
2297 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) ||
2298 offline_cpu_bitmap[i >> 3] & (1 << (i & 0x07)))
2302 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
2303 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
2305 /* Yes: Display it */
2307 /* This is CPU "all" */
2308 strcpy(cpuno, K_LOWERALL);
2311 sprintf(cpuno, "%d", i - 1);
2314 xprintf(tab, "<softnet cpu=\"%s\" "
2322 S_VALUE(ssnp->processed, ssnc->processed, itv),
2323 S_VALUE(ssnp->dropped, ssnc->dropped, itv),
2324 S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
2325 S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
2326 S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv),
2332 if (CLOSE_MARKUP(a->options)) {
2333 xml_markup_network(tab, CLOSE_XML_MARKUP);
2338 ***************************************************************************
2339 * Display pressure-stall CPU statistics in XML.
2342 * @a Activity structure with statistics.
2343 * @curr Index in array for current sample statistics.
2344 * @tab Indentation in XML output.
2345 * @itv Interval of time in 1/100th of a second.
2346 ***************************************************************************
2348 __print_funct_t xml_print_psicpu_stats(struct activity *a, int curr, int tab,
2349 unsigned long long itv)
2351 struct stats_psi_cpu
2352 *psic = (struct stats_psi_cpu *) a->buf[curr],
2353 *psip = (struct stats_psi_cpu *) a->buf[!curr];
2355 if (!IS_SELECTED(a->options))
2356 goto close_xml_markup;
2358 xml_markup_psi(tab, OPEN_XML_MARKUP);
2361 xprintf(tab, "<psi-cpu "
2362 "some_avg10=\"%.2f\" "
2363 "some_avg60=\"%.2f\" "
2364 "some_avg300=\"%.2f\" "
2365 "some_avg=\"%.2f\"/>",
2366 (double) psic->some_acpu_10 / 100,
2367 (double) psic->some_acpu_60 / 100,
2368 (double) psic->some_acpu_300 / 100,
2369 ((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
2373 if (CLOSE_MARKUP(a->options)) {
2374 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2379 ***************************************************************************
2380 * Display pressure-stall I/O statistics in XML.
2383 * @a Activity structure with statistics.
2384 * @curr Index in array for current sample statistics.
2385 * @tab Indentation in XML output.
2386 * @itv Interval of time in 1/100th of a second.
2387 ***************************************************************************
2389 __print_funct_t xml_print_psiio_stats(struct activity *a, int curr, int tab,
2390 unsigned long long itv)
2393 *psic = (struct stats_psi_io *) a->buf[curr],
2394 *psip = (struct stats_psi_io *) a->buf[!curr];
2396 if (!IS_SELECTED(a->options))
2397 goto close_xml_markup;
2399 xml_markup_psi(tab, OPEN_XML_MARKUP);
2402 xprintf(tab, "<psi-io "
2403 "some_avg10=\"%.2f\" "
2404 "some_avg60=\"%.2f\" "
2405 "some_avg300=\"%.2f\" "
2406 "some_avg=\"%.2f\" "
2407 "full_avg10=\"%.2f\" "
2408 "full_avg60=\"%.2f\" "
2409 "full_avg300=\"%.2f\" "
2410 "full_avg=\"%.2f\"/>",
2411 (double) psic->some_aio_10 / 100,
2412 (double) psic->some_aio_60 / 100,
2413 (double) psic->some_aio_300 / 100,
2414 ((double) psic->some_io_total - psip->some_io_total) / (100 * itv),
2415 (double) psic->full_aio_10 / 100,
2416 (double) psic->full_aio_60 / 100,
2417 (double) psic->full_aio_300 / 100,
2418 ((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
2422 if (CLOSE_MARKUP(a->options)) {
2423 xml_markup_psi(tab, CLOSE_XML_MARKUP);
2428 ***************************************************************************
2429 * Display pressure-stall memory statistics in XML.
2432 * @a Activity structure with statistics.
2433 * @curr Index in array for current sample statistics.
2434 * @tab Indentation in XML output.
2435 * @itv Interval of time in 1/100th of a second.
2436 ***************************************************************************
2438 __print_funct_t xml_print_psimem_stats(struct activity *a, int curr, int tab,
2439 unsigned long long itv)
2441 struct stats_psi_mem
2442 *psic = (struct stats_psi_mem *) a->buf[curr],
2443 *psip = (struct stats_psi_mem *) a->buf[!curr];
2445 if (!IS_SELECTED(a->options))
2446 goto close_xml_markup;
2448 xml_markup_psi(tab, OPEN_XML_MARKUP);
2451 xprintf(tab, "<psi-mem "
2452 "some_avg10=\"%.2f\" "
2453 "some_avg60=\"%.2f\" "
2454 "some_avg300=\"%.2f\" "
2455 "some_avg=\"%.2f\" "
2456 "full_avg10=\"%.2f\" "
2457 "full_avg60=\"%.2f\" "
2458 "full_avg300=\"%.2f\" "
2459 "full_avg=\"%.2f\"/>",
2460 (double) psic->some_amem_10 / 100,
2461 (double) psic->some_amem_60 / 100,
2462 (double) psic->some_amem_300 / 100,
2463 ((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv),
2464 (double) psic->full_amem_10 / 100,
2465 (double) psic->full_amem_60 / 100,
2466 (double) psic->full_amem_300 / 100,
2467 ((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
2471 if (CLOSE_MARKUP(a->options)) {
2472 xml_markup_psi(tab, CLOSE_XML_MARKUP);