2 * xml_stats.c: Funtions used by sadf to display statistics in XML.
3 * (C) 1999-2016 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 ***************************************************************************
29 #include "xml_stats.h"
34 #define _(string) gettext(string)
36 #define _(string) (string)
39 extern unsigned int flags;
40 extern unsigned int dm_major;
43 ***************************************************************************
44 * Open or close <network> markup.
47 * @tab Number of tabulations.
48 * @action Open or close action.
49 ***************************************************************************
51 void xml_markup_network(int tab, int action)
53 static int markup_state = CLOSE_XML_MARKUP;
55 if (action == markup_state)
57 markup_state = action;
59 if (action == OPEN_XML_MARKUP) {
61 xprintf(tab, "<network per=\"second\">");
65 xprintf(tab, "</network>");
70 ***************************************************************************
71 * Open or close <power-management> markup.
74 * @tab Number of tabulations.
75 * @action Open or close action.
76 ***************************************************************************
78 void xml_markup_power_management(int tab, int action)
80 static int markup_state = CLOSE_XML_MARKUP;
82 if (action == markup_state)
84 markup_state = action;
86 if (action == OPEN_XML_MARKUP) {
88 xprintf(tab, "<power-management>");
92 xprintf(tab, "</power-management>");
97 ***************************************************************************
98 * Display CPU statistics in XML.
101 * @a Activity structure with statistics.
102 * @curr Index in array for current sample statistics.
103 * @tab Indentation in XML output.
104 * @g_itv Interval of time in jiffies mutliplied by the number of
106 ***************************************************************************
108 __print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
109 unsigned long long g_itv)
112 struct stats_cpu *scc, *scp;
115 xprintf(tab++, "<cpu-load>");
117 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
119 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
120 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
122 /* Should current CPU (including CPU "all") be displayed? */
123 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
127 /* Yes: Display it */
129 /* This is CPU "all" */
130 strcpy(cpuno, "all");
133 sprintf(cpuno, "%d", i - 1);
136 * If the CPU is offline then it is omited from /proc/stat:
137 * All the fields couldn't have been read and the sum of them is zero.
138 * (Remember that guest/guest_nice times are already included in
141 if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
142 scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
143 scc->cpu_hardirq + scc->cpu_softirq) == 0) {
145 * Set current struct fields (which have been set to zero)
146 * to values from previous iteration. Hence their values won't
147 * jump from zero when the CPU comes back online.
156 * Recalculate interval for current proc.
157 * If result is 0 then current CPU is a tickless one.
159 g_itv = get_per_cpu_interval(scc, scp);
164 /* Current CPU is offline or tickless */
165 if (DISPLAY_CPU_DEF(a->opt_flags)) {
166 xprintf(tab, "<cpu number=\"%d\" "
173 i - 1, 0.0, 0.0, 0.0, 0.0, 0.0,
174 cpu_offline ? 0.0 : 100.0);
176 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
177 xprintf(tab, "<cpu number=\"%d\" "
188 i - 1, 0.0, 0.0, 0.0, 0.0,
189 0.0, 0.0, 0.0, 0.0, 0.0,
190 cpu_offline ? 0.0 : 100.0);
196 if (DISPLAY_CPU_DEF(a->opt_flags)) {
197 xprintf(tab, "<cpu number=\"%s\" "
205 ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv),
206 ll_sp_value(scp->cpu_nice, scc->cpu_nice, g_itv),
207 ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
208 scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
210 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
211 ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv),
212 scc->cpu_idle < scp->cpu_idle ?
214 ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv));
216 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
217 xprintf(tab, "<cpu number=\"%s\" "
229 (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
231 ll_sp_value(scp->cpu_user - scp->cpu_guest,
232 scc->cpu_user - scc->cpu_guest, g_itv),
233 (scc->cpu_nice - scc->cpu_guest_nice) < (scp->cpu_nice - scp->cpu_guest_nice) ?
235 ll_sp_value(scp->cpu_nice - scp->cpu_guest_nice,
236 scc->cpu_nice - scc->cpu_guest_nice, g_itv),
237 ll_sp_value(scp->cpu_sys, scc->cpu_sys, g_itv),
238 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
239 ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv),
240 ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
241 ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
242 ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv),
243 ll_sp_value(scp->cpu_guest_nice, scc->cpu_guest_nice, g_itv),
244 scc->cpu_idle < scp->cpu_idle ?
246 ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv));
250 xprintf(--tab, "</cpu-load>");
254 ***************************************************************************
255 * Display task creation and context switch statistics in XML.
258 * @a Activity structure with statistics.
259 * @curr Index in array for current sample statistics.
260 * @tab Indentation in XML output.
261 * @itv Interval of time in jiffies.
262 ***************************************************************************
264 __print_funct_t xml_print_pcsw_stats(struct activity *a, int curr, int tab,
265 unsigned long long itv)
268 *spc = (struct stats_pcsw *) a->buf[curr],
269 *spp = (struct stats_pcsw *) a->buf[!curr];
271 /* proc/s and cswch/s */
272 xprintf(tab, "<process-and-context-switch per=\"second\" "
275 S_VALUE(spp->processes, spc->processes, itv),
276 S_VALUE(spp->context_switch, spc->context_switch, itv));
280 ***************************************************************************
281 * Display interrupts statistics in XML.
284 * @a Activity structure with statistics.
285 * @curr Index in array for current sample statistics.
286 * @tab Indentation in XML output.
287 * @itv Interval of time in jiffies.
288 ***************************************************************************
290 __print_funct_t xml_print_irq_stats(struct activity *a, int curr, int tab,
291 unsigned long long itv)
294 struct stats_irq *sic, *sip;
297 xprintf(tab++, "<interrupts>");
298 xprintf(tab++, "<int-global per=\"second\">");
300 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
302 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
303 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
305 /* Should current interrupt (including int "sum") be displayed? */
306 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
308 /* Yes: Display it */
310 /* This is interrupt "sum" */
311 strcpy(irqno, "sum");
314 sprintf(irqno, "%d", i - 1);
317 xprintf(tab, "<irq intr=\"%s\" value=\"%.2f\"/>", irqno,
318 S_VALUE(sip->irq_nr, sic->irq_nr, itv));
322 xprintf(--tab, "</int-global>");
323 xprintf(--tab, "</interrupts>");
327 ***************************************************************************
328 * Display swapping statistics in XML.
331 * @a Activity structure with statistics.
332 * @curr Index in array for current sample statistics.
333 * @tab Indentation in XML output.
334 * @itv Interval of time in jiffies.
335 ***************************************************************************
337 __print_funct_t xml_print_swap_stats(struct activity *a, int curr, int tab,
338 unsigned long long itv)
341 *ssc = (struct stats_swap *) a->buf[curr],
342 *ssp = (struct stats_swap *) a->buf[!curr];
344 xprintf(tab, "<swap-pages per=\"second\" "
346 "pswpout=\"%.2f\"/>",
347 S_VALUE(ssp->pswpin, ssc->pswpin, itv),
348 S_VALUE(ssp->pswpout, ssc->pswpout, itv));
352 ***************************************************************************
353 * Display paging statistics in XML.
356 * @a Activity structure with statistics.
357 * @curr Index in array for current sample statistics.
358 * @tab Indentation in XML output.
359 * @itv Interval of time in jiffies.
360 ***************************************************************************
362 __print_funct_t xml_print_paging_stats(struct activity *a, int curr, int tab,
363 unsigned long long itv)
366 *spc = (struct stats_paging *) a->buf[curr],
367 *spp = (struct stats_paging *) a->buf[!curr];
369 xprintf(tab, "<paging per=\"second\" "
378 "vmeff-percent=\"%.2f\"/>",
379 S_VALUE(spp->pgpgin, spc->pgpgin, itv),
380 S_VALUE(spp->pgpgout, spc->pgpgout, itv),
381 S_VALUE(spp->pgfault, spc->pgfault, itv),
382 S_VALUE(spp->pgmajfault, spc->pgmajfault, itv),
383 S_VALUE(spp->pgfree, spc->pgfree, itv),
384 S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
385 S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
386 S_VALUE(spp->pgsteal, spc->pgsteal, itv),
387 (spc->pgscan_kswapd + spc->pgscan_direct -
388 spp->pgscan_kswapd - spp->pgscan_direct) ?
389 SP_VALUE(spp->pgsteal, spc->pgsteal,
390 spc->pgscan_kswapd + spc->pgscan_direct -
391 spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
395 ***************************************************************************
396 * Display I/O and transfer rate statistics in XML.
399 * @a Activity structure with statistics.
400 * @curr Index in array for current sample statistics.
401 * @tab Indentation in XML output.
402 * @itv Interval of time in jiffies.
403 ***************************************************************************
405 __print_funct_t xml_print_io_stats(struct activity *a, int curr, int tab,
406 unsigned long long itv)
409 *sic = (struct stats_io *) a->buf[curr],
410 *sip = (struct stats_io *) a->buf[!curr];
412 xprintf(tab, "<io per=\"second\">");
414 xprintf(++tab, "<tps>%.2f</tps>",
415 S_VALUE(sip->dk_drive, sic->dk_drive, itv));
417 xprintf(tab, "<io-reads rtps=\"%.2f\" bread=\"%.2f\"/>",
418 S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
419 S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv));
421 xprintf(tab, "<io-writes wtps=\"%.2f\" bwrtn=\"%.2f\"/>",
422 S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
423 S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
425 xprintf(--tab, "</io>");
429 ***************************************************************************
430 * Display memory statistics in XML.
433 * @a Activity structure with statistics.
434 * @curr Index in array for current sample statistics.
435 * @tab Indentation in XML output.
436 * @itv Interval of time in jiffies.
437 ***************************************************************************
439 __print_funct_t xml_print_memory_stats(struct activity *a, int curr, int tab,
440 unsigned long long itv)
443 *smc = (struct stats_memory *) a->buf[curr],
444 *smp = (struct stats_memory *) a->buf[!curr];
446 xprintf(tab, "<memory per=\"second\" unit=\"kB\">");
448 if (DISPLAY_MEM_AMT(a->opt_flags)) {
450 xprintf(++tab, "<memfree>%lu</memfree>",
453 xprintf(tab, "<memused>%lu</memused>",
454 smc->tlmkb - smc->frmkb);
456 xprintf(tab, "<memused-percent>%.2f</memused-percent>",
458 SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) :
461 xprintf(tab, "<buffers>%lu</buffers>",
464 xprintf(tab, "<cached>%lu</cached>",
467 xprintf(tab, "<commit>%lu</commit>",
470 xprintf(tab, "<commit-percent>%.2f</commit-percent>",
471 (smc->tlmkb + smc->tlskb) ?
472 SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
475 xprintf(tab, "<active>%lu</active>",
478 xprintf(tab, "<inactive>%lu</inactive>",
481 xprintf(tab--, "<dirty>%lu</dirty>",
484 if (DISPLAY_MEM_ALL(a->opt_flags)) {
485 xprintf(++tab, "<anonpg>%lu</anonpg>",
488 xprintf(tab, "<slab>%lu</slab>",
491 xprintf(tab, "<kstack>%lu</kstack>",
494 xprintf(tab, "<pgtbl>%lu</pgtbl>",
497 xprintf(tab--, "<vmused>%lu</vmused>",
502 if (DISPLAY_SWAP(a->opt_flags)) {
504 xprintf(++tab, "<swpfree>%lu</swpfree>",
507 xprintf(tab, "<swpused>%lu</swpused>",
508 smc->tlskb - smc->frskb);
510 xprintf(tab, "<swpused-percent>%.2f</swpused-percent>",
512 SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
515 xprintf(tab, "<swpcad>%lu</swpcad>",
518 xprintf(tab--, "<swpcad-percent>%.2f</swpcad-percent>",
519 (smc->tlskb - smc->frskb) ?
520 SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
524 if (DISPLAY_MEMORY(a->opt_flags)) {
526 xprintf(++tab, "<frmpg>%.2f</frmpg>",
527 S_VALUE((double) KB_TO_PG(smp->frmkb),
528 (double) KB_TO_PG(smc->frmkb), itv));
530 xprintf(tab, "<bufpg>%.2f</bufpg>",
531 S_VALUE((double) KB_TO_PG(smp->bufkb),
532 (double) KB_TO_PG(smc->bufkb), itv));
534 xprintf(tab--, "<campg>%.2f</campg>",
535 S_VALUE((double) KB_TO_PG(smp->camkb),
536 (double) KB_TO_PG(smc->camkb), itv));
539 xprintf(tab, "</memory>");
543 ***************************************************************************
544 * Display kernel tables statistics in XML.
547 * @a Activity structure with statistics.
548 * @curr Index in array for current sample statistics.
549 * @tab Indentation in XML output.
550 * @itv Interval of time in jiffies.
551 ***************************************************************************
553 __print_funct_t xml_print_ktables_stats(struct activity *a, int curr, int tab,
554 unsigned long long itv)
557 *skc = (struct stats_ktables *) a->buf[curr];
559 xprintf(tab, "<kernel "
571 ***************************************************************************
572 * Display queue and load statistics in XML.
575 * @a Activity structure with statistics.
576 * @curr Index in array for current sample statistics.
577 * @tab Indentation in XML output.
578 * @itv Interval of time in jiffies.
579 ***************************************************************************
581 __print_funct_t xml_print_queue_stats(struct activity *a, int curr, int tab,
582 unsigned long long itv)
585 *sqc = (struct stats_queue *) a->buf[curr];
587 xprintf(tab, "<queue "
596 (double) sqc->load_avg_1 / 100,
597 (double) sqc->load_avg_5 / 100,
598 (double) sqc->load_avg_15 / 100,
603 ***************************************************************************
604 * Display serial lines statistics in XML.
607 * @a Activity structure with statistics.
608 * @curr Index in array for current sample statistics.
609 * @tab Indentation in XML output.
610 * @itv Interval of time in jiffies.
611 ***************************************************************************
613 __print_funct_t xml_print_serial_stats(struct activity *a, int curr, int tab,
614 unsigned long long itv)
617 struct stats_serial *ssc, *ssp;
619 xprintf(tab++, "<serial per=\"second\">");
621 for (i = 0; i < a->nr; i++) {
623 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
624 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
629 if (ssc->line == ssp->line) {
631 xprintf(tab, "<tty line=\"%d\" "
639 S_VALUE(ssp->rx, ssc->rx, itv),
640 S_VALUE(ssp->tx, ssc->tx, itv),
641 S_VALUE(ssp->frame, ssc->frame, itv),
642 S_VALUE(ssp->parity, ssc->parity, itv),
643 S_VALUE(ssp->brk, ssc->brk, itv),
644 S_VALUE(ssp->overrun, ssc->overrun, itv));
648 xprintf(--tab, "</serial>");
652 ***************************************************************************
653 * Display disks statistics in XML.
656 * @a Activity structure with statistics.
657 * @curr Index in array for current sample statistics.
658 * @tab Indentation in XML output.
659 * @itv Interval of time in jiffies.
660 ***************************************************************************
662 __print_funct_t xml_print_disk_stats(struct activity *a, int curr, int tab,
663 unsigned long long itv)
666 struct stats_disk *sdc, *sdp;
667 struct ext_disk_stats xds;
668 char *dev_name, *persist_dev_name;
670 xprintf(tab++, "<disk per=\"second\">");
672 for (i = 0; i < a->nr; i++) {
674 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
676 if (!(sdc->major + sdc->minor))
679 j = check_disk_reg(a, curr, !curr, i);
680 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
682 /* Compute extended statistics values */
683 compute_ext_disk_stats(sdc, sdp, itv, &xds);
686 persist_dev_name = NULL;
688 if (DISPLAY_PERSIST_NAME_S(flags)) {
689 persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
692 if (persist_dev_name) {
693 dev_name = persist_dev_name;
696 if ((USE_PRETTY_OPTION(flags)) && (sdc->major == dm_major)) {
697 dev_name = transform_devmapname(sdc->major, sdc->minor);
701 dev_name = get_devname(sdc->major, sdc->minor,
702 USE_PRETTY_OPTION(flags));
706 xprintf(tab, "<disk-device dev=\"%s\" "
714 "util-percent=\"%.2f\"/>",
715 /* Confusion possible here between index and minor numbers */
717 S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
718 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv),
719 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
720 /* See iostat for explanations */
722 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
728 xprintf(--tab, "</disk>");
732 ***************************************************************************
733 * Display network interfaces statistics in XML.
736 * @a Activity structure with statistics.
737 * @curr Index in array for current sample statistics.
738 * @tab Indentation in XML output.
739 * @itv Interval of time in jiffies.
740 ***************************************************************************
742 __print_funct_t xml_print_net_dev_stats(struct activity *a, int curr, int tab,
743 unsigned long long itv)
746 struct stats_net_dev *sndc, *sndp;
747 double rxkb, txkb, ifutil;
749 if (!IS_SELECTED(a->options) || (a->nr <= 0))
750 goto close_xml_markup;
752 xml_markup_network(tab, OPEN_XML_MARKUP);
755 for (i = 0; i < a->nr; i++) {
757 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
759 if (!strcmp(sndc->interface, ""))
762 j = check_net_dev_reg(a, curr, !curr, i);
763 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
765 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
766 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
767 ifutil = compute_ifutil(sndc, rxkb, txkb);
769 xprintf(tab, "<net-dev iface=\"%s\" "
777 "ifutil-percent=\"%.2f\"/>",
779 S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
780 S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
783 S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
784 S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
785 S_VALUE(sndp->multicast, sndc->multicast, itv),
791 if (CLOSE_MARKUP(a->options)) {
792 xml_markup_network(tab, CLOSE_XML_MARKUP);
797 ***************************************************************************
798 * Display network interfaces error 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 jiffies.
805 ***************************************************************************
807 __print_funct_t xml_print_net_edev_stats(struct activity *a, int curr, int tab,
808 unsigned long long itv)
811 struct stats_net_edev *snedc, *snedp;
813 if (!IS_SELECTED(a->options) || (a->nr <= 0))
814 goto close_xml_markup;
816 xml_markup_network(tab, OPEN_XML_MARKUP);
819 for (i = 0; i < a->nr; i++) {
821 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
823 if (!strcmp(snedc->interface, ""))
826 j = check_net_edev_reg(a, curr, !curr, i);
827 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
829 xprintf(tab, "<net-edev iface=\"%s\" "
840 S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
841 S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
842 S_VALUE(snedp->collisions, snedc->collisions, itv),
843 S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
844 S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
845 S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
846 S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
847 S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
848 S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
853 if (CLOSE_MARKUP(a->options)) {
854 xml_markup_network(tab, CLOSE_XML_MARKUP);
859 ***************************************************************************
860 * Display NFS client statistics in XML.
863 * @a Activity structure with statistics.
864 * @curr Index in array for current sample statistics.
865 * @tab Indentation in XML output.
866 * @itv Interval of time in jiffies.
867 ***************************************************************************
869 __print_funct_t xml_print_net_nfs_stats(struct activity *a, int curr, int tab,
870 unsigned long long itv)
873 *snnc = (struct stats_net_nfs *) a->buf[curr],
874 *snnp = (struct stats_net_nfs *) a->buf[!curr];
876 if (!IS_SELECTED(a->options) || (a->nr <= 0))
877 goto close_xml_markup;
879 xml_markup_network(tab, OPEN_XML_MARKUP);
882 xprintf(tab, "<net-nfs "
889 S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
890 S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
891 S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
892 S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
893 S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
894 S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
898 if (CLOSE_MARKUP(a->options)) {
899 xml_markup_network(tab, CLOSE_XML_MARKUP);
904 ***************************************************************************
905 * Display NFS server statistics in XML.
908 * @a Activity structure with statistics.
909 * @curr Index in array for current sample statistics.
910 * @tab Indentation in XML output.
911 * @itv Interval of time in jiffies.
912 ***************************************************************************
914 __print_funct_t xml_print_net_nfsd_stats(struct activity *a, int curr, int tab,
915 unsigned long long itv)
917 struct stats_net_nfsd
918 *snndc = (struct stats_net_nfsd *) a->buf[curr],
919 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
921 if (!IS_SELECTED(a->options) || (a->nr <= 0))
922 goto close_xml_markup;
924 xml_markup_network(tab, OPEN_XML_MARKUP);
927 xprintf(tab, "<net-nfsd "
938 "sgetatt=\"%.2f\"/>",
939 S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
940 S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
941 S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
942 S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
943 S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
944 S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
945 S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
946 S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
947 S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
948 S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
949 S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
953 if (CLOSE_MARKUP(a->options)) {
954 xml_markup_network(tab, CLOSE_XML_MARKUP);
959 ***************************************************************************
960 * Display network socket statistics in XML.
963 * @a Activity structure with statistics.
964 * @curr Index in array for current sample statistics.
965 * @tab Indentation in XML output.
966 * @itv Interval of time in jiffies.
967 ***************************************************************************
969 __print_funct_t xml_print_net_sock_stats(struct activity *a, int curr, int tab,
970 unsigned long long itv)
972 struct stats_net_sock
973 *snsc = (struct stats_net_sock *) a->buf[curr];
975 if (!IS_SELECTED(a->options) || (a->nr <= 0))
976 goto close_xml_markup;
978 xml_markup_network(tab, OPEN_XML_MARKUP);
981 xprintf(tab, "<net-sock "
997 if (CLOSE_MARKUP(a->options)) {
998 xml_markup_network(tab, CLOSE_XML_MARKUP);
1003 ***************************************************************************
1004 * Display IP network statistics in XML.
1007 * @a Activity structure with statistics.
1008 * @curr Index in array for current sample statistics.
1009 * @tab Indentation in XML output.
1010 * @itv Interval of time in jiffies.
1011 ***************************************************************************
1013 __print_funct_t xml_print_net_ip_stats(struct activity *a, int curr, int tab,
1014 unsigned long long itv)
1017 *snic = (struct stats_net_ip *) a->buf[curr],
1018 *snip = (struct stats_net_ip *) a->buf[!curr];
1020 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1021 goto close_xml_markup;
1023 xml_markup_network(tab, OPEN_XML_MARKUP);
1026 xprintf(tab, "<net-ip "
1034 "fragcrt=\"%.2f\"/>",
1035 S_VALUE(snip->InReceives, snic->InReceives, itv),
1036 S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1037 S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1038 S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1039 S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1040 S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1041 S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1042 S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1046 if (CLOSE_MARKUP(a->options)) {
1047 xml_markup_network(tab, CLOSE_XML_MARKUP);
1052 ***************************************************************************
1053 * Display IP network error statistics in XML.
1056 * @a Activity structure with statistics.
1057 * @curr Index in array for current sample statistics.
1058 * @tab Indentation in XML output.
1059 * @itv Interval of time in jiffies.
1060 ***************************************************************************
1062 __print_funct_t xml_print_net_eip_stats(struct activity *a, int curr, int tab,
1063 unsigned long long itv)
1065 struct stats_net_eip
1066 *sneic = (struct stats_net_eip *) a->buf[curr],
1067 *sneip = (struct stats_net_eip *) a->buf[!curr];
1069 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1070 goto close_xml_markup;
1072 xml_markup_network(tab, OPEN_XML_MARKUP);
1075 xprintf(tab, "<net-eip "
1084 S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1085 S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1086 S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1087 S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1088 S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1089 S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1090 S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1091 S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1095 if (CLOSE_MARKUP(a->options)) {
1096 xml_markup_network(tab, CLOSE_XML_MARKUP);
1101 ***************************************************************************
1102 * Display ICMP network statistics in XML.
1105 * @a Activity structure with statistics.
1106 * @curr Index in array for current sample statistics.
1107 * @tab Indentation in XML output.
1108 * @itv Interval of time in jiffies.
1109 ***************************************************************************
1111 __print_funct_t xml_print_net_icmp_stats(struct activity *a, int curr, int tab,
1112 unsigned long long itv)
1114 struct stats_net_icmp
1115 *snic = (struct stats_net_icmp *) a->buf[curr],
1116 *snip = (struct stats_net_icmp *) a->buf[!curr];
1118 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1119 goto close_xml_markup;
1121 xml_markup_network(tab, OPEN_XML_MARKUP);
1124 xprintf(tab, "<net-icmp "
1138 "oadrmkr=\"%.2f\"/>",
1139 S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1140 S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1141 S_VALUE(snip->InEchos, snic->InEchos, itv),
1142 S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1143 S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1144 S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1145 S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1146 S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1147 S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1148 S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1149 S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1150 S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1151 S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1152 S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1156 if (CLOSE_MARKUP(a->options)) {
1157 xml_markup_network(tab, CLOSE_XML_MARKUP);
1162 ***************************************************************************
1163 * Display ICMP error message statistics in XML.
1166 * @a Activity structure with statistics.
1167 * @curr Index in array for current sample statistics.
1168 * @tab Indentation in XML output.
1169 * @itv Interval of time in jiffies.
1170 ***************************************************************************
1172 __print_funct_t xml_print_net_eicmp_stats(struct activity *a, int curr, int tab,
1173 unsigned long long itv)
1175 struct stats_net_eicmp
1176 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1177 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1179 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1180 goto close_xml_markup;
1182 xml_markup_network(tab, OPEN_XML_MARKUP);
1185 xprintf(tab, "<net-eicmp "
1197 "oredir=\"%.2f\"/>",
1198 S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1199 S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1200 S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1201 S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1202 S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1203 S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1204 S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1205 S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1206 S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1207 S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1208 S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1209 S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1213 if (CLOSE_MARKUP(a->options)) {
1214 xml_markup_network(tab, CLOSE_XML_MARKUP);
1219 ***************************************************************************
1220 * Display TCP network statistics in XML.
1223 * @a Activity structure with statistics.
1224 * @curr Index in array for current sample statistics.
1225 * @tab Indentation in XML output.
1226 * @itv Interval of time in jiffies.
1227 ***************************************************************************
1229 __print_funct_t xml_print_net_tcp_stats(struct activity *a, int curr, int tab,
1230 unsigned long long itv)
1232 struct stats_net_tcp
1233 *sntc = (struct stats_net_tcp *) a->buf[curr],
1234 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1236 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1237 goto close_xml_markup;
1239 xml_markup_network(tab, OPEN_XML_MARKUP);
1242 xprintf(tab, "<net-tcp "
1247 S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1248 S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1249 S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1250 S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1254 if (CLOSE_MARKUP(a->options)) {
1255 xml_markup_network(tab, CLOSE_XML_MARKUP);
1260 ***************************************************************************
1261 * Display TCP network error statistics in XML.
1264 * @a Activity structure with statistics.
1265 * @curr Index in array for current sample statistics.
1266 * @tab Indentation in XML output.
1267 * @itv Interval of time in jiffies.
1268 ***************************************************************************
1270 __print_funct_t xml_print_net_etcp_stats(struct activity *a, int curr, int tab,
1271 unsigned long long itv)
1273 struct stats_net_etcp
1274 *snetc = (struct stats_net_etcp *) a->buf[curr],
1275 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1277 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1278 goto close_xml_markup;
1280 xml_markup_network(tab, OPEN_XML_MARKUP);
1283 xprintf(tab, "<net-etcp "
1289 S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1290 S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1291 S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1292 S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1293 S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1297 if (CLOSE_MARKUP(a->options)) {
1298 xml_markup_network(tab, CLOSE_XML_MARKUP);
1303 ***************************************************************************
1304 * Display UDP network statistics in XML.
1307 * @a Activity structure with statistics.
1308 * @curr Index in array for current sample statistics.
1309 * @tab Indentation in XML output.
1310 * @itv Interval of time in jiffies.
1311 ***************************************************************************
1313 __print_funct_t xml_print_net_udp_stats(struct activity *a, int curr, int tab,
1314 unsigned long long itv)
1316 struct stats_net_udp
1317 *snuc = (struct stats_net_udp *) a->buf[curr],
1318 *snup = (struct stats_net_udp *) a->buf[!curr];
1320 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1321 goto close_xml_markup;
1323 xml_markup_network(tab, OPEN_XML_MARKUP);
1326 xprintf(tab, "<net-udp "
1330 "idgmerr=\"%.2f\"/>",
1331 S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1332 S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1333 S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1334 S_VALUE(snup->InErrors, snuc->InErrors, itv));
1338 if (CLOSE_MARKUP(a->options)) {
1339 xml_markup_network(tab, CLOSE_XML_MARKUP);
1344 ***************************************************************************
1345 * Display IPv6 network socket statistics in XML.
1348 * @a Activity structure with statistics.
1349 * @curr Index in array for current sample statistics.
1350 * @tab Indentation in XML output.
1351 * @itv Interval of time in jiffies.
1352 ***************************************************************************
1354 __print_funct_t xml_print_net_sock6_stats(struct activity *a, int curr, int tab,
1355 unsigned long long itv)
1357 struct stats_net_sock6
1358 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1360 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1361 goto close_xml_markup;
1363 xml_markup_network(tab, OPEN_XML_MARKUP);
1366 xprintf(tab, "<net-sock6 "
1370 "ip6-frag=\"%u\"/>",
1378 if (CLOSE_MARKUP(a->options)) {
1379 xml_markup_network(tab, CLOSE_XML_MARKUP);
1384 ***************************************************************************
1385 * Display IPv6 network statistics in XML.
1388 * @a Activity structure with statistics.
1389 * @curr Index in array for current sample statistics.
1390 * @tab Indentation in XML output.
1391 * @itv Interval of time in jiffies.
1392 ***************************************************************************
1394 __print_funct_t xml_print_net_ip6_stats(struct activity *a, int curr, int tab,
1395 unsigned long long itv)
1397 struct stats_net_ip6
1398 *snic = (struct stats_net_ip6 *) a->buf[curr],
1399 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1401 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1402 goto close_xml_markup;
1404 xml_markup_network(tab, OPEN_XML_MARKUP);
1407 xprintf(tab, "<net-ip6 "
1417 "fragcr6=\"%.2f\"/>",
1418 S_VALUE(snip->InReceives6, snic->InReceives6, itv),
1419 S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1420 S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
1421 S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
1422 S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
1423 S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
1424 S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
1425 S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
1426 S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
1427 S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1431 if (CLOSE_MARKUP(a->options)) {
1432 xml_markup_network(tab, CLOSE_XML_MARKUP);
1437 ***************************************************************************
1438 * Display IPv6 network error statistics in XML.
1441 * @a Activity structure with statistics.
1442 * @curr Index in array for current sample statistics.
1443 * @tab Indentation in XML output.
1444 * @itv Interval of time in jiffies.
1445 ***************************************************************************
1447 __print_funct_t xml_print_net_eip6_stats(struct activity *a, int curr, int tab,
1448 unsigned long long itv)
1450 struct stats_net_eip6
1451 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1452 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1454 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1455 goto close_xml_markup;
1457 xml_markup_network(tab, OPEN_XML_MARKUP);
1460 xprintf(tab, "<net-eip6 "
1471 "itrpck6=\"%.2f\"/>",
1472 S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
1473 S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
1474 S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1475 S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
1476 S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
1477 S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
1478 S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
1479 S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
1480 S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
1481 S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
1482 S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1486 if (CLOSE_MARKUP(a->options)) {
1487 xml_markup_network(tab, CLOSE_XML_MARKUP);
1492 ***************************************************************************
1493 * Display ICMPv6 network statistics in XML.
1496 * @a Activity structure with statistics.
1497 * @curr Index in array for current sample statistics.
1498 * @tab Indentation in XML output.
1499 * @itv Interval of time in jiffies.
1500 ***************************************************************************
1502 __print_funct_t xml_print_net_icmp6_stats(struct activity *a, int curr, int tab,
1503 unsigned long long itv)
1505 struct stats_net_icmp6
1506 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1507 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1509 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1510 goto close_xml_markup;
1512 xml_markup_network(tab, OPEN_XML_MARKUP);
1515 xprintf(tab, "<net-icmp6 "
1532 "onbad6=\"%.2f\"/>",
1533 S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
1534 S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
1535 S_VALUE(snip->InEchos6, snic->InEchos6, itv),
1536 S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
1537 S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
1538 S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
1539 S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
1540 S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
1541 S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
1542 S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
1543 S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
1544 S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
1545 S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
1546 S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
1547 S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
1548 S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
1549 S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1553 if (CLOSE_MARKUP(a->options)) {
1554 xml_markup_network(tab, CLOSE_XML_MARKUP);
1559 ***************************************************************************
1560 * Display ICMPv6 error message statistics in XML.
1563 * @a Activity structure with statistics.
1564 * @curr Index in array for current sample statistics.
1565 * @tab Indentation in XML output.
1566 * @itv Interval of time in jiffies.
1567 ***************************************************************************
1569 __print_funct_t xml_print_net_eicmp6_stats(struct activity *a, int curr, int tab,
1570 unsigned long long itv)
1572 struct stats_net_eicmp6
1573 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1574 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1576 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1577 goto close_xml_markup;
1579 xml_markup_network(tab, OPEN_XML_MARKUP);
1582 xprintf(tab, "<net-eicmp6 "
1593 "opck2b6=\"%.2f\"/>",
1594 S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
1595 S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
1596 S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1597 S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
1598 S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
1599 S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
1600 S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1601 S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
1602 S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
1603 S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
1604 S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
1608 if (CLOSE_MARKUP(a->options)) {
1609 xml_markup_network(tab, CLOSE_XML_MARKUP);
1614 ***************************************************************************
1615 * Display UDPv6 network statistics in XML.
1618 * @a Activity structure with statistics.
1619 * @curr Index in array for current sample statistics.
1620 * @tab Indentation in XML output.
1621 * @itv Interval of time in jiffies.
1622 ***************************************************************************
1624 __print_funct_t xml_print_net_udp6_stats(struct activity *a, int curr, int tab,
1625 unsigned long long itv)
1627 struct stats_net_udp6
1628 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1629 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1631 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1632 goto close_xml_markup;
1634 xml_markup_network(tab, OPEN_XML_MARKUP);
1637 xprintf(tab, "<net-udp6 "
1641 "idgmer6=\"%.2f\"/>",
1642 S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
1643 S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1644 S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
1645 S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
1649 if (CLOSE_MARKUP(a->options)) {
1650 xml_markup_network(tab, CLOSE_XML_MARKUP);
1655 ***************************************************************************
1656 * Display CPU frequency statistics in XML.
1659 * @a Activity structure with statistics.
1660 * @curr Index in array for current sample statistics.
1661 * @tab Indentation in XML output.
1662 * @itv Interval of time in jiffies.
1663 ***************************************************************************
1665 __print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int tab,
1666 unsigned long long itv)
1669 struct stats_pwr_cpufreq *spc;
1672 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1673 goto close_xml_markup;
1675 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1678 xprintf(tab++, "<cpu-frequency unit=\"MHz\">");
1680 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1682 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1684 /* Should current CPU (including CPU "all") be displayed? */
1685 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1687 /* Yes: Display it */
1689 /* This is CPU "all" */
1690 strcpy(cpuno, "all");
1693 sprintf(cpuno, "%d", i - 1);
1696 xprintf(tab, "<cpufreq number=\"%s\" "
1697 "frequency=\"%.2f\"/>",
1699 ((double) spc->cpufreq) / 100);
1703 xprintf(--tab, "</cpu-frequency>");
1707 if (CLOSE_MARKUP(a->options)) {
1708 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1713 ***************************************************************************
1714 * Display fan statistics in XML.
1717 * @a Activity structure with statistics.
1718 * @curr Index in array for current sample statistics.
1719 * @tab Indentation in XML output.
1720 * @itv Interval of time in jiffies.
1721 ***************************************************************************
1723 __print_funct_t xml_print_pwr_fan_stats(struct activity *a, int curr, int tab,
1724 unsigned long long itv)
1727 struct stats_pwr_fan *spc;
1729 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1730 goto close_xml_markup;
1732 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1735 xprintf(tab++, "<fan-speed unit=\"rpm\">");
1737 for (i = 0; i < a->nr; i++) {
1738 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1740 xprintf(tab, "<fan number=\"%d\" rpm=\"%llu\" drpm=\"%llu\" device=\"%s\"/>",
1742 (unsigned long long) spc->rpm,
1743 (unsigned long long) (spc->rpm - spc->rpm_min),
1747 xprintf(--tab, "</fan-speed>");
1751 if (CLOSE_MARKUP(a->options)) {
1752 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1757 ***************************************************************************
1758 * Display temperature statistics in XML.
1761 * @a Activity structure with statistics.
1762 * @curr Index in array for current sample statistics.
1763 * @tab Indentation in XML output.
1764 * @itv Interval of time in jiffies.
1765 ***************************************************************************
1767 __print_funct_t xml_print_pwr_temp_stats(struct activity *a, int curr, int tab,
1768 unsigned long long itv)
1771 struct stats_pwr_temp *spc;
1773 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1774 goto close_xml_markup;
1776 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1779 xprintf(tab++, "<temperature unit=\"degree Celsius\">");
1781 for (i = 0; i < a->nr; i++) {
1782 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1784 xprintf(tab, "<temp number=\"%d\" degC=\"%.2f\" percent-temp=\"%.2f\" device=\"%s\"/>",
1787 (spc->temp_max - spc->temp_min) ?
1788 (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
1793 xprintf(--tab, "</temperature>");
1797 if (CLOSE_MARKUP(a->options)) {
1798 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1803 ***************************************************************************
1804 * Display voltage inputs 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 jiffies.
1811 ***************************************************************************
1813 __print_funct_t xml_print_pwr_in_stats(struct activity *a, int curr, int tab,
1814 unsigned long long itv)
1817 struct stats_pwr_in *spc;
1819 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1820 goto close_xml_markup;
1822 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1825 xprintf(tab++, "<voltage-input unit=\"V\">");
1827 for (i = 0; i < a->nr; i++) {
1828 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1830 xprintf(tab, "<in number=\"%d\" inV=\"%.2f\" percent-in=\"%.2f\" device=\"%s\"/>",
1833 (spc->in_max - spc->in_min) ?
1834 (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
1839 xprintf(--tab, "</voltage-input>");
1843 if (CLOSE_MARKUP(a->options)) {
1844 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1849 ***************************************************************************
1850 * Display huge pages statistics in XML.
1853 * @a Activity structure with statistics.
1854 * @curr Index in array for current sample statistics.
1855 * @tab Indentation in XML output.
1856 * @itv Interval of time in jiffies.
1857 ***************************************************************************
1859 __print_funct_t xml_print_huge_stats(struct activity *a, int curr, int tab,
1860 unsigned long long itv)
1863 *smc = (struct stats_huge *) a->buf[curr];
1865 xprintf(tab, "<hugepages unit=\"kB\">");
1867 xprintf(++tab, "<hugfree>%lu</hugfree>",
1870 xprintf(tab, "<hugused>%lu</hugused>",
1871 smc->tlhkb - smc->frhkb);
1873 xprintf(tab--, "<hugused-percent>%.2f</hugused-percent>",
1875 SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
1878 xprintf(tab, "</hugepages>");
1882 ***************************************************************************
1883 * Display weighted CPU frequency statistics in XML.
1886 * @a Activity structure with statistics.
1887 * @curr Index in array for current sample statistics.
1888 * @tab Indentation in XML output.
1889 * @itv Interval of time in jiffies.
1890 ***************************************************************************
1892 __print_funct_t xml_print_pwr_wghfreq_stats(struct activity *a, int curr, int tab,
1893 unsigned long long itv)
1896 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1897 unsigned long long tis, tisfreq;
1900 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1901 goto close_xml_markup;
1903 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1906 xprintf(tab++, "<cpu-weighted-frequency unit=\"MHz\">");
1908 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1910 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
1911 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
1913 /* Should current CPU (including CPU "all") be displayed? */
1914 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1920 for (k = 0; k < a->nr2; k++) {
1922 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
1925 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
1927 tisfreq += (spc_k->freq / 1000) *
1928 (spc_k->time_in_state - spp_k->time_in_state);
1929 tis += (spc_k->time_in_state - spp_k->time_in_state);
1933 /* This is CPU "all" */
1934 strcpy(cpuno, "all");
1937 sprintf(cpuno, "%d", i - 1);
1940 xprintf(tab, "<cpuwfreq number=\"%s\" "
1941 "weighted-frequency=\"%.2f\"/>",
1943 tis ? ((double) tisfreq) / tis : 0.0);
1947 xprintf(--tab, "</cpu-weighted-frequency>");
1951 if (CLOSE_MARKUP(a->options)) {
1952 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
1957 ***************************************************************************
1958 * Display USB devices statistics in XML.
1961 * @a Activity structure with statistics.
1962 * @curr Index in array for current sample statistics.
1963 * @tab Indentation in XML output.
1964 * @itv Interval of time in jiffies.
1965 ***************************************************************************
1967 __print_funct_t xml_print_pwr_usb_stats(struct activity *a, int curr, int tab,
1968 unsigned long long itv)
1971 struct stats_pwr_usb *suc;
1973 if (!IS_SELECTED(a->options) || (a->nr <= 0))
1974 goto close_xml_markup;
1976 xml_markup_power_management(tab, OPEN_XML_MARKUP);
1979 xprintf(tab++, "<usb-devices>");
1981 for (i = 0; i < a->nr; i++) {
1982 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
1985 /* Bus#0 doesn't exist: We are at the end of the list */
1988 xprintf(tab, "<usb bus_number=\"%d\" idvendor=\"%x\" idprod=\"%x\" "
1989 "maxpower=\"%u\" manufact=\"%s\" product=\"%s\"/>",
1993 suc->bmaxpower << 1,
1998 xprintf(--tab, "</usb-devices>");
2002 if (CLOSE_MARKUP(a->options)) {
2003 xml_markup_power_management(tab, CLOSE_XML_MARKUP);
2008 ***************************************************************************
2009 * Display filesystems statistics in XML.
2012 * @a Activity structure with statistics.
2013 * @curr Index in array for current sample statistics.
2014 * @tab Indentation in XML output.
2015 * @itv Interval of time in jiffies.
2016 ***************************************************************************
2018 __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
2019 unsigned long long itv)
2022 struct stats_filesystem *sfc;
2024 xprintf(tab++, "<filesystems>");
2026 for (i = 0; i < a->nr; i++) {
2028 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2031 /* Size of filesystem is null: We are at the end of the list */
2034 xprintf(tab, "<filesystem %s=\"%s\" "
2035 "MBfsfree=\"%.0f\" "
2036 "MBfsused=\"%.0f\" "
2037 "fsused-percent=\"%.2f\" "
2038 "ufsused-percent=\"%.2f\" "
2041 "Iused-percent=\"%.2f\"/>",
2042 DISPLAY_MOUNT(a->opt_flags) ? "mountp" : "fsname",
2043 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name,
2044 (double) sfc->f_bfree / 1024 / 1024,
2045 (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2046 /* f_blocks is not null. But test it anyway ;-) */
2047 sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2049 sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2052 sfc->f_files - sfc->f_ffree,
2053 sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2057 xprintf(--tab, "</filesystems>");
2061 ***************************************************************************
2062 * Display Fibre Channel HBA statistics in XML.
2065 * @a Activity structure with statistics.
2066 * @curr Index in array for current sample statistics.
2067 * @tab Indentation in XML output.
2068 * @itv Interval of time in jiffies.
2069 ***************************************************************************
2071 __print_funct_t xml_print_fchost_stats(struct activity *a, int curr, int tab,
2072 unsigned long long itv)
2075 struct stats_fchost *sfcc, *sfcp;
2077 if (!IS_SELECTED(a->options) || (a->nr <= 0))
2078 goto close_xml_markup;
2080 xml_markup_network(tab, OPEN_XML_MARKUP);
2083 for (i = 0; i < a->nr; i++) {
2085 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2086 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + i * a->msize);
2088 if (!sfcc->fchost_name[0])
2089 /* We are at the end of the list */
2092 xprintf(tab, "<fchost name=\"%s\" "
2096 "fch_txw=\"%.2f\"/>",
2098 S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2099 S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2100 S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2101 S_VALUE(sfcp->f_txwords, sfcc->f_rxwords, itv));
2106 if (CLOSE_MARKUP(a->options)) {
2107 xml_markup_network(tab, CLOSE_XML_MARKUP);