2 * raw_stats.c: Functions used by sar to display statistics in raw format.
3 * (C) 1999-2017 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 "raw_stats.h"
31 extern unsigned int flags;
32 extern unsigned int dm_major;
35 ***************************************************************************
36 * Display current field name.
39 * @hdr_line On the first call, complete header line, containing all the
40 * metric names. In each subsequent call, must be NULL.
41 * @pos Index in @hdr_line string, 0 being the first one (headers
42 * are delimited by the '|' character).
45 * Pointer on string containing field name.
46 ***************************************************************************
48 char *pfield(char *hdr_line, int pos)
50 char hline[HEADER_LINE_LEN] = "";
51 static char field[HEADER_LINE_LEN] = "";
57 strncpy(hline, hdr_line, HEADER_LINE_LEN - 1);
58 hline[HEADER_LINE_LEN - 1] = '\0';
61 for (hl = strtok(hline, "|"); hl && (pos > 0); hl = strtok(NULL, "|"), pos--);
63 /* Bad @pos arg given to function */
67 if (strchr(hl, '&')) {
71 strncpy(field, hl, HEADER_LINE_LEN);
72 field[HEADER_LINE_LEN - 1] = '\0';
75 /* Display current field */
76 if (strchr(field + idx, ';')) {
77 j = strcspn(field + idx, ";");
78 *(field + idx + j) = '\0';
87 ***************************************************************************
88 * Display field values.
91 * @valp Field's value from previous statistics sample.
92 * @valc Field's value from current statistics sample.
93 ***************************************************************************
95 void pval(unsigned long long valp, unsigned long long valc)
97 printf("%llu>%llu", valp, valc);
98 if (DISPLAY_HINTS(flags)) {
100 /* Field's value has decreased */
107 ***************************************************************************
108 * Display CPU statistics in raw format.
111 * @a Activity structure with statistics.
112 * @timestr Time for current statistics sample.
113 * @curr Index in array for current statistics sample.
114 ***************************************************************************
116 __print_funct_t raw_print_cpu_stats(struct activity *a, char *timestr, int curr)
119 struct stats_cpu *scc, *scp;
121 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
124 * The size of a->buf[...] CPU structure may be different from the default
125 * sizeof(struct stats_cpu) value if data have been read from a file!
126 * That's why we don't use a syntax like:
127 * scc = (struct stats_cpu *) a->buf[...] + i;
129 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
130 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
133 * Note: a->nr is in [1, NR_CPUS + 1].
134 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
135 * Anyway, NR_CPUS may vary between the version of sysstat
136 * used by sadc to create a file, and the version of sysstat
137 * used by sar to read it...
140 /* Should current CPU (including CPU "all") be displayed? */
141 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
145 /* Yes: Display it */
146 printf("%s %s:%d", timestr,
147 pfield(a->hdr_line, DISPLAY_CPU_ALL(a->opt_flags)), i - 1);
149 if (DISPLAY_HINTS(flags) && i) {
150 if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
151 scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
152 scc->cpu_hardirq + scc->cpu_softirq) == 0) {
157 if (!get_per_cpu_interval(scc, scp)) {
158 /* CPU is tickless */
164 if (DISPLAY_CPU_DEF(a->opt_flags)) {
165 printf(" %s:", pfield(NULL, 0));
166 pval(scp->cpu_user, scc->cpu_user);
167 printf(" %s:", pfield(NULL, 0));
168 pval(scp->cpu_nice, scc->cpu_nice);
169 printf(" %s:", pfield(NULL, 0));
170 pval(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
171 scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq);
172 printf(" %s:", pfield(NULL, 0));
173 pval(scp->cpu_iowait, scc->cpu_iowait);
174 printf(" %s:", pfield(NULL, 0));
175 pval(scp->cpu_steal, scc->cpu_steal);
176 printf(" %s:", pfield(NULL, 0));
177 pval(scp->cpu_idle, scc->cpu_idle);
179 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
180 printf(" %s:", pfield(NULL, 0));
181 pval(scp->cpu_user - scp->cpu_guest, scc->cpu_user - scc->cpu_guest);
182 printf(" %s:", pfield(NULL, 0));
183 pval(scp->cpu_nice - scp->cpu_guest_nice, scc->cpu_nice - scc->cpu_guest_nice);
184 printf(" %s:", pfield(NULL, 0));
185 pval(scp->cpu_sys, scc->cpu_sys);
186 printf(" %s:", pfield(NULL, 0));
187 pval(scp->cpu_iowait, scc->cpu_iowait);
188 printf(" %s:", pfield(NULL, 0));
189 pval(scp->cpu_steal, scc->cpu_steal);
190 printf(" %s:", pfield(NULL, 0));
191 pval(scp->cpu_hardirq, scc->cpu_hardirq);
192 printf(" %s:", pfield(NULL, 0));
193 pval(scp->cpu_softirq, scc->cpu_softirq);
194 printf(" %s:", pfield(NULL, 0));
195 pval(scp->cpu_guest, scc->cpu_guest);
196 printf(" %s:", pfield(NULL, 0));
197 pval(scp->cpu_guest_nice, scc->cpu_guest_nice);
198 printf(" %s:", pfield(NULL, 0));
199 pval(scp->cpu_idle, scc->cpu_idle);
206 ***************************************************************************
207 * Display tasks creation and context switches statistics in raw format.
210 * @a Activity structure with statistics.
211 * @timestr Time for current statistics sample.
212 * @curr Index in array for current sample statistics.
213 ***************************************************************************
215 __print_funct_t raw_print_pcsw_stats(struct activity *a, char *timestr, int curr)
218 *spc = (struct stats_pcsw *) a->buf[curr],
219 *spp = (struct stats_pcsw *) a->buf[!curr];
221 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
222 pval((unsigned long long) spp->processes, (unsigned long long) spc->processes);
223 printf(" %s:", pfield(NULL, 0));
224 pval(spp->context_switch, spc->context_switch);
229 ***************************************************************************
230 * Display interrupts statistics in raw format.
233 * @a Activity structure with statistics.
234 * @timestr Time for current statistics sample.
235 * @curr Index in array for current sample statistics.
236 ***************************************************************************
238 __print_funct_t raw_print_irq_stats(struct activity *a, char *timestr, int curr)
241 struct stats_irq *sic, *sip;
243 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
245 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
246 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
248 /* Should current interrupt (including int "sum") be displayed? */
249 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
251 /* Yes: Display it */
252 printf("%s %s:%d", timestr,
253 pfield(a->hdr_line, FIRST), i - 1);
254 printf(" %s:", pfield(NULL, 0));
255 pval(sip->irq_nr, sic->irq_nr);
262 ***************************************************************************
263 * Display swapping statistics in raw format.
266 * @a Activity structure with statistics.
267 * @timestr Time for current statistics sample.
268 * @curr Index in array for current sample statistics.
269 ***************************************************************************
271 __print_funct_t raw_print_swap_stats(struct activity *a, char *timestr, int curr)
274 *ssc = (struct stats_swap *) a->buf[curr],
275 *ssp = (struct stats_swap *) a->buf[!curr];
277 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
278 pval((unsigned long long) ssp->pswpin, (unsigned long long) ssc->pswpin);
279 printf(" %s:", pfield(NULL, 0));
280 pval((unsigned long long) ssp->pswpout, (unsigned long long) ssc->pswpout);
285 ***************************************************************************
286 * Display paging statistics in raw format.
289 * @a Activity structure with statistics.
290 * @timestr Time for current statistics sample.
291 * @curr Index in array for current sample statistics.
292 ***************************************************************************
294 __print_funct_t raw_print_paging_stats(struct activity *a, char *timestr, int curr)
297 *spc = (struct stats_paging *) a->buf[curr],
298 *spp = (struct stats_paging *) a->buf[!curr];
300 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
301 pval((unsigned long long) spp->pgpgin, (unsigned long long) spc->pgpgin);
302 printf(" %s:", pfield(NULL, 0));
303 pval((unsigned long long) spp->pgpgout, (unsigned long long) spc->pgpgout);
304 printf(" %s:", pfield(NULL, 0));
305 pval((unsigned long long) spp->pgfault, (unsigned long long) spc->pgfault);
306 printf(" %s:", pfield(NULL, 0));
307 pval((unsigned long long) spp->pgmajfault, (unsigned long long) spc->pgmajfault);
308 printf(" %s:", pfield(NULL, 0));
309 pval((unsigned long long) spp->pgfree, (unsigned long long) spc->pgfree);
310 printf(" %s:", pfield(NULL, 0));
311 pval((unsigned long long) spp->pgscan_kswapd, (unsigned long long) spc->pgscan_kswapd);
312 printf(" %s:", pfield(NULL, 0));
313 pval((unsigned long long) spp->pgscan_direct, (unsigned long long) spc->pgscan_direct);
314 printf(" %s:", pfield(NULL, 0));
315 pval((unsigned long long) spp->pgsteal, (unsigned long long) spc->pgsteal);
320 ***************************************************************************
321 * Display I/O and transfer rate statistics in raw format.
324 * @a Activity structure with statistics.
325 * @timestr Time for current statistics sample.
326 * @curr Index in array for current sample statistics.
327 ***************************************************************************
329 __print_funct_t raw_print_io_stats(struct activity *a, char *timestr, int curr)
332 *sic = (struct stats_io *) a->buf[curr],
333 *sip = (struct stats_io *) a->buf[!curr];
335 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
336 pval(sip->dk_drive, sic->dk_drive);
337 printf(" %s:", pfield(NULL, 0));
338 pval(sip->dk_drive_rio, sic->dk_drive_rio);
339 printf(" %s:", pfield(NULL, 0));
340 pval(sip->dk_drive_wio, sic->dk_drive_wio);
341 printf(" %s:", pfield(NULL, 0));
342 pval(sip->dk_drive_rblk, sic->dk_drive_rblk);
343 printf(" %s:", pfield(NULL, 0));
344 pval(sip->dk_drive_wblk, sic->dk_drive_wblk);
349 ***************************************************************************
350 * Display memory statistics in raw format.
353 * @a Activity structure with statistics.
354 * @timestr Time for current statistics sample.
355 * @curr Index in array for current sample statistics.
356 ***************************************************************************
358 __print_funct_t raw_print_memory_stats(struct activity *a, char *timestr, int curr)
361 *smc = (struct stats_memory *) a->buf[curr];
363 if (DISPLAY_MEMORY(a->opt_flags)) {
364 printf("%s %s:%lu", timestr, pfield(a->hdr_line, FIRST), smc->frmkb);
365 printf(" %s:%lu", pfield(NULL, 0), smc->availablekb);
366 printf(" kbttlmem:%lu", smc->tlmkb);
367 pfield(NULL, 0); /* Skip kbmemused */
368 pfield(NULL, 0); /* Skip %memused */
369 printf(" %s:%lu", pfield(NULL, 0), smc->bufkb);
370 printf(" %s:%lu", pfield(NULL, 0), smc->camkb);
371 printf(" %s:%lu", pfield(NULL, 0), smc->comkb);
372 pfield(NULL, 0); /* Skip %commit */
373 printf(" %s:%lu", pfield(NULL, 0), smc->activekb);
374 printf(" %s:%lu", pfield(NULL, 0), smc->inactkb);
375 printf(" %s:%lu", pfield(NULL, 0), smc->dirtykb);
377 if (DISPLAY_MEM_ALL(a->opt_flags)) {
378 printf(" %s:%lu", pfield(NULL, 0), smc->anonpgkb);
379 printf(" %s:%lu", pfield(NULL, 0), smc->slabkb);
380 printf(" %s:%lu", pfield(NULL, 0), smc->kstackkb);
381 printf(" %s:%lu", pfield(NULL, 0), smc->pgtblkb);
382 printf(" %s:%lu", pfield(NULL, 0), smc->vmusedkb);
387 if (DISPLAY_SWAP(a->opt_flags)) {
388 printf("%s %s:%lu", timestr, pfield(a->hdr_line, SECOND), smc->frskb);
389 printf(" kbttlswp:%lu", smc->tlskb);
390 pfield(NULL, 0); /* Skip kbswpused */
391 pfield(NULL, 0); /* Skip %swpused */
392 printf(" %s:%lu", pfield(NULL, 0), smc->caskb);
398 ***************************************************************************
399 * Display kernel tables statistics in raw format.
402 * @a Activity structure with statistics.
403 * @timestr Time for current statistics sample.
404 * @curr Index in array for current sample statistics.
405 ***************************************************************************
407 __print_funct_t raw_print_ktables_stats(struct activity *a, char *timestr, int curr)
410 *skc = (struct stats_ktables *) a->buf[curr];
412 printf("%s %s:%u", timestr, pfield(a->hdr_line, FIRST), skc->dentry_stat);
413 printf(" %s:%u", pfield(NULL, 0), skc->file_used);
414 printf(" %s:%u", pfield(NULL, 0), skc->inode_used);
415 printf(" %s:%u", pfield(NULL, 0), skc->pty_nr);
420 ***************************************************************************
421 * Display queue and load statistics in raw format.
424 * @a Activity structure with statistics.
425 * @timestr Time for current statistics sample.
426 * @curr Index in array for current sample statistics.
427 ***************************************************************************
429 __print_funct_t raw_print_queue_stats(struct activity *a, char *timestr, int curr)
432 *sqc = (struct stats_queue *) a->buf[curr];
434 printf("%s %s:%lu", timestr, pfield(a->hdr_line, FIRST), sqc->nr_running);
435 printf(" %s:%u", pfield(NULL, 0), sqc->nr_threads);
436 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_1);
437 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_5);
438 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_15);
439 printf(" %s:%lu", pfield(NULL, 0), sqc->procs_blocked);
444 ***************************************************************************
445 * Display serial lines statistics in raw format.
448 * @a Activity structure with statistics.
449 * @timestr Time for current statistics sample.
450 * @curr Index in array for current sample statistics.
451 ***************************************************************************
453 __print_funct_t raw_print_serial_stats(struct activity *a, char *timestr, int curr)
456 struct stats_serial *ssc, *ssp;
458 for (i = 0; i < a->nr; i++) {
460 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
461 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
463 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
464 pval((unsigned long long) ssp->line, (unsigned long long) ssc->line);
466 if (ssc->line == 0) {
467 if (DISPLAY_HINTS(flags)) {
474 if (ssc->line == ssp->line) {
475 printf(" %s:", pfield(NULL, 0));
476 pval((unsigned long long) ssp->rx, (unsigned long long)ssc->rx);
477 printf(" %s:", pfield(NULL, 0));
478 pval((unsigned long long) ssp->tx, (unsigned long long) ssc->tx);
479 printf(" %s:", pfield(NULL, 0));
480 pval((unsigned long long) ssp->frame, (unsigned long long) ssc->frame);
481 printf(" %s:", pfield(NULL, 0));
482 pval((unsigned long long) ssp->parity, (unsigned long long) ssc->parity);
483 printf(" %s:", pfield(NULL, 0));
484 pval((unsigned long long) ssp->brk, (unsigned long long) ssc->brk);
485 printf(" %s:", pfield(NULL, 0));
486 pval((unsigned long long) ssp->overrun, (unsigned long long) ssc->overrun);
488 else if (DISPLAY_HINTS(flags)) {
497 ***************************************************************************
498 * Display disks statistics in raw format.
501 * @a Activity structure with statistics.
502 * @timestr Time for current statistics sample.
503 * @curr Index in array for current sample statistics.
504 ***************************************************************************
506 __print_funct_t raw_print_disk_stats(struct activity *a, char *timestr, int curr)
509 struct stats_disk *sdc, *sdp, sdpzero;
510 char *dev_name, *persist_dev_name;
512 memset(&sdpzero, 0, STATS_DISK_SIZE);
514 for (i = 0; i < a->nr; i++) {
516 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
518 printf("%s major:%u minor:%u", timestr, sdc->major, sdc->minor);
520 if (!(sdc->major + sdc->minor)) {
521 if (DISPLAY_HINTS(flags)) {
528 j = check_disk_reg(a, curr, !curr, i);
530 /* This is a newly registered interface. Previous stats are zero */
532 if (DISPLAY_HINTS(flags)) {
537 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
541 persist_dev_name = NULL;
543 if (DISPLAY_PERSIST_NAME_S(flags)) {
544 persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
547 if (persist_dev_name) {
548 dev_name = persist_dev_name;
551 /* Always use pretty option (-p) */
552 if (sdc->major == dm_major) {
553 dev_name = transform_devmapname(sdc->major, sdc->minor);
557 dev_name = get_devname(sdc->major, sdc->minor, TRUE);
561 printf(" %s:%s", pfield(a->hdr_line, FIRST), dev_name);
562 printf(" %s:", pfield(NULL, 0));
563 pval(sdp->nr_ios, sdc->nr_ios);
564 printf(" %s:", pfield(NULL, 0));
565 pval((unsigned long long) sdp->rd_sect, (unsigned long long) sdc->rd_sect);
566 printf(" %s:", pfield(NULL, 0));
567 pval((unsigned long long) sdp->wr_sect, (unsigned long long) sdc->wr_sect);
568 printf(" tot_ticks:");
569 pval((unsigned long long) sdp->tot_ticks, (unsigned long long) sdc->tot_ticks);
570 pfield(NULL, 0); /* Skip areq-sz */
571 printf(" %s:", pfield(NULL, 0));
572 pval((unsigned long long) sdp->rq_ticks, (unsigned long long) sdc->rq_ticks);
578 ***************************************************************************
579 * Display network interfaces statistics in raw format.
582 * @a Activity structure with statistics.
583 * @timestr Time for current statistics sample.
584 * @curr Index in array for current sample statistics.
585 ***************************************************************************
587 __print_funct_t raw_print_net_dev_stats(struct activity *a, char *timestr, int curr)
590 struct stats_net_dev *sndc, *sndp, sndzero;
592 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
594 for (i = 0; i < a->nr; i++) {
596 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
598 if (!strcmp(sndc->interface, ""))
601 printf("%s %s:%s", timestr, pfield(a->hdr_line, FIRST), sndc->interface);
603 j = check_net_dev_reg(a, curr, !curr, i);
605 /* This is a newly registered interface. Previous stats are zero */
607 if (DISPLAY_HINTS(flags)) {
612 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
615 printf(" %s:", pfield(NULL, 0));
616 pval(sndp->rx_packets, sndc->rx_packets);
617 printf(" %s:", pfield(NULL, 0));
618 pval(sndp->tx_packets, sndc->tx_packets);
619 printf(" %s:", pfield(NULL, 0));
620 pval(sndp->rx_bytes, sndc->rx_bytes);
621 printf(" %s:", pfield(NULL, 0));
622 pval(sndp->tx_bytes, sndc->tx_bytes);
623 printf(" %s:", pfield(NULL, 0));
624 pval(sndp->rx_compressed, sndc->rx_compressed);
625 printf(" %s:", pfield(NULL, 0));
626 pval(sndp->tx_compressed, sndc->tx_compressed);
627 printf(" %s:", pfield(NULL, 0));
628 pval(sndp->multicast, sndc->multicast);
629 printf(" speed:%u duplex:%u\n", sndc->speed, sndc->duplex);
634 ***************************************************************************
635 * Display network interfaces errors statistics in raw format.
638 * @a Activity structure with statistics.
639 * @timestr Time for current statistics sample.
640 * @curr Index in array for current sample statistics.
641 ***************************************************************************
643 __print_funct_t raw_print_net_edev_stats(struct activity *a, char *timestr, int curr)
646 struct stats_net_edev *snedc, *snedp, snedzero;
648 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
650 for (i = 0; i < a->nr; i++) {
652 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
654 if (!strcmp(snedc->interface, ""))
657 printf("%s %s:%s", timestr, pfield(a->hdr_line, FIRST), snedc->interface);
659 j = check_net_edev_reg(a, curr, !curr, i);
661 /* This is a newly registered interface. Previous stats are zero */
663 if (DISPLAY_HINTS(flags)) {
668 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
671 printf(" %s:", pfield(NULL, 0));
672 pval(snedp->rx_errors, snedc->rx_errors);
673 printf(" %s:", pfield(NULL, 0));
674 pval(snedp->tx_errors, snedc->tx_errors);
675 printf(" %s:", pfield(NULL, 0));
676 pval(snedp->collisions, snedc->collisions);
677 printf(" %s:", pfield(NULL, 0));
678 pval(snedp->rx_dropped, snedc->rx_dropped);
679 printf(" %s:", pfield(NULL, 0));
680 pval(snedp->tx_dropped, snedc->tx_dropped);
681 printf(" %s:", pfield(NULL, 0));
682 pval(snedp->tx_carrier_errors, snedc->tx_carrier_errors);
683 printf(" %s:", pfield(NULL, 0));
684 pval(snedp->rx_frame_errors, snedc->rx_frame_errors);
685 printf(" %s:", pfield(NULL, 0));
686 pval(snedp->rx_fifo_errors, snedc->rx_fifo_errors);
687 printf(" %s:", pfield(NULL, 0));
688 pval(snedp->tx_fifo_errors, snedc->tx_fifo_errors);
694 ***************************************************************************
695 * Display NFS client statistics in raw format.
698 * @a Activity structure with statistics.
699 * @timestr Time for current statistics sample.
700 * @curr Index in array for current sample statistics.
701 ***************************************************************************
703 __print_funct_t raw_print_net_nfs_stats(struct activity *a, char *timestr, int curr)
706 *snnc = (struct stats_net_nfs *) a->buf[curr],
707 *snnp = (struct stats_net_nfs *) a->buf[!curr];
709 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
710 pval((unsigned long long) snnp->nfs_rpccnt, (unsigned long long) snnc->nfs_rpccnt);
711 printf(" %s:", pfield(NULL, 0));
712 pval((unsigned long long) snnp->nfs_rpcretrans, (unsigned long long) snnc->nfs_rpcretrans);
713 printf(" %s:", pfield(NULL, 0));
714 pval((unsigned long long) snnp->nfs_readcnt, (unsigned long long) snnc->nfs_readcnt);
715 printf(" %s:", pfield(NULL, 0));
716 pval((unsigned long long) snnp->nfs_writecnt, (unsigned long long) snnc->nfs_writecnt);
717 printf(" %s:", pfield(NULL, 0));
718 pval((unsigned long long) snnp->nfs_accesscnt, (unsigned long long) snnc->nfs_accesscnt);
719 printf(" %s:", pfield(NULL, 0));
720 pval((unsigned long long) snnp->nfs_getattcnt, (unsigned long long) snnc->nfs_getattcnt);
725 ***************************************************************************
726 * Display NFS server statistics in raw format.
729 * @a Activity structure with statistics.
730 * @timestr Time for current statistics sample.
731 * @curr Index in array for current sample statistics.
732 ***************************************************************************
734 __print_funct_t raw_print_net_nfsd_stats(struct activity *a, char *timestr, int curr)
736 struct stats_net_nfsd
737 *snndc = (struct stats_net_nfsd *) a->buf[curr],
738 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
740 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
741 pval((unsigned long long) snndp->nfsd_rpccnt, (unsigned long long) snndc->nfsd_rpccnt);
742 printf(" %s:", pfield(NULL, 0));
743 pval((unsigned long long) snndp->nfsd_rpcbad, (unsigned long long) snndc->nfsd_rpcbad);
744 printf(" %s:", pfield(NULL, 0));
745 pval((unsigned long long) snndp->nfsd_netcnt, (unsigned long long) snndc->nfsd_netcnt);
746 printf(" %s:", pfield(NULL, 0));
747 pval((unsigned long long) snndp->nfsd_netudpcnt, (unsigned long long) snndc->nfsd_netudpcnt);
748 printf(" %s:", pfield(NULL, 0));
749 pval((unsigned long long) snndp->nfsd_nettcpcnt, (unsigned long long) snndc->nfsd_nettcpcnt);
750 printf(" %s:", pfield(NULL, 0));
751 pval((unsigned long long) snndp->nfsd_rchits, (unsigned long long) snndc->nfsd_rchits);
752 printf(" %s:", pfield(NULL, 0));
753 pval((unsigned long long) snndp->nfsd_rcmisses, (unsigned long long) snndc->nfsd_rcmisses);
754 printf(" %s:", pfield(NULL, 0));
755 pval((unsigned long long) snndp->nfsd_readcnt, (unsigned long long) snndc->nfsd_readcnt);
756 printf(" %s:", pfield(NULL, 0));
757 pval((unsigned long long) snndp->nfsd_writecnt, (unsigned long long) snndc->nfsd_writecnt);
758 printf(" %s:", pfield(NULL, 0));
759 pval((unsigned long long) snndp->nfsd_accesscnt, (unsigned long long) snndc->nfsd_accesscnt);
760 printf(" %s:", pfield(NULL, 0));
761 pval((unsigned long long) snndp->nfsd_getattcnt, (unsigned long long) snndc->nfsd_getattcnt);
766 ***************************************************************************
767 * Display network socket statistics in raw format.
770 * @a Activity structure with statistics.
771 * @timestr Time for current statistics sample.
772 * @curr Index in array for current sample statistics.
773 ***************************************************************************
775 __print_funct_t raw_print_net_sock_stats(struct activity *a, char *timestr, int curr)
777 struct stats_net_sock
778 *snsc = (struct stats_net_sock *) a->buf[curr];
780 printf("%s %s:%u", timestr, pfield(a->hdr_line, FIRST), snsc->sock_inuse);
781 printf(" %s:%u", pfield(NULL, 0), snsc->tcp_inuse);
782 printf(" %s:%u", pfield(NULL, 0), snsc->udp_inuse);
783 printf(" %s:%u", pfield(NULL, 0), snsc->raw_inuse);
784 printf(" %s:%u", pfield(NULL, 0), snsc->frag_inuse);
785 printf(" %s:%u", pfield(NULL, 0), snsc->tcp_tw);
790 ***************************************************************************
791 * Display IP network statistics in raw format.
794 * @a Activity structure with statistics.
795 * @timestr Time for current statistics sample.
796 * @curr Index in array for current sample statistics.
797 ***************************************************************************
799 __print_funct_t raw_print_net_ip_stats(struct activity *a, char *timestr, int curr)
802 *snic = (struct stats_net_ip *) a->buf[curr],
803 *snip = (struct stats_net_ip *) a->buf[!curr];
805 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
806 pval(snip->InReceives, snic->InReceives);
807 printf(" %s:", pfield(NULL, 0));
808 pval(snip->ForwDatagrams, snic->ForwDatagrams);
809 printf(" %s:", pfield(NULL, 0));
810 pval(snip->InDelivers, snic->InDelivers);
811 printf(" %s:", pfield(NULL, 0));
812 pval(snip->OutRequests, snic->OutRequests);
813 printf(" %s:", pfield(NULL, 0));
814 pval(snip->ReasmReqds, snic->ReasmReqds);
815 printf(" %s:", pfield(NULL, 0));
816 pval(snip->ReasmOKs, snic->ReasmOKs);
817 printf(" %s:", pfield(NULL, 0));
818 pval(snip->FragOKs, snic->FragOKs);
819 printf(" %s:", pfield(NULL, 0));
820 pval(snip->FragCreates, snic->FragCreates);
825 ***************************************************************************
826 * Display IP network errors statistics in raw format.
829 * @a Activity structure with statistics.
830 * @timestr Time for current statistics sample.
831 * @curr Index in array for current sample statistics.
832 ***************************************************************************
834 __print_funct_t raw_print_net_eip_stats(struct activity *a, char *timestr, int curr)
837 *sneic = (struct stats_net_eip *) a->buf[curr],
838 *sneip = (struct stats_net_eip *) a->buf[!curr];
840 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
841 pval(sneip->InHdrErrors, sneic->InHdrErrors);
842 printf(" %s:", pfield(NULL, 0));
843 pval(sneip->InAddrErrors, sneic->InAddrErrors);
844 printf(" %s:", pfield(NULL, 0));
845 pval(sneip->InUnknownProtos, sneic->InUnknownProtos);
846 printf(" %s:", pfield(NULL, 0));
847 pval(sneip->InDiscards, sneic->InDiscards);
848 printf(" %s:", pfield(NULL, 0));
849 pval(sneip->OutDiscards, sneic->OutDiscards);
850 printf(" %s:", pfield(NULL, 0));
851 pval(sneip->OutNoRoutes, sneic->OutNoRoutes);
852 printf(" %s:", pfield(NULL, 0));
853 pval(sneip->ReasmFails, sneic->ReasmFails);
854 printf(" %s:", pfield(NULL, 0));
855 pval(sneip->FragFails, sneic->FragFails);
860 ***************************************************************************
861 * Display ICMP network statistics in raw format.
864 * @a Activity structure with statistics.
865 * @timestr Time for current statistics sample.
866 * @curr Index in array for current sample statistics.
867 ***************************************************************************
869 __print_funct_t raw_print_net_icmp_stats(struct activity *a, char *timestr, int curr)
871 struct stats_net_icmp
872 *snic = (struct stats_net_icmp *) a->buf[curr],
873 *snip = (struct stats_net_icmp *) a->buf[!curr];
875 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
876 pval((unsigned long long) snip->InMsgs, (unsigned long long) snic->InMsgs);
877 printf(" %s:", pfield(NULL, 0));
878 pval((unsigned long long) snip->OutMsgs, (unsigned long long) snic->OutMsgs);
879 printf(" %s:", pfield(NULL, 0));
880 pval((unsigned long long) snip->InEchos, (unsigned long long) snic->InEchos);
881 printf(" %s:", pfield(NULL, 0));
882 pval((unsigned long long) snip->InEchoReps, (unsigned long long) snic->InEchoReps);
883 printf(" %s:", pfield(NULL, 0));
884 pval((unsigned long long) snip->OutEchos, (unsigned long long) snic->OutEchos);
885 printf(" %s:", pfield(NULL, 0));
886 pval((unsigned long long) snip->OutEchoReps, (unsigned long long) snic->OutEchoReps);
887 printf(" %s:", pfield(NULL, 0));
888 pval((unsigned long long) snip->InTimestamps, (unsigned long long) snic->InTimestamps);
889 printf(" %s:", pfield(NULL, 0));
890 pval((unsigned long long) snip->InTimestampReps, (unsigned long long) snic->InTimestampReps);
891 printf(" %s:", pfield(NULL, 0));
892 pval((unsigned long long) snip->OutTimestamps, (unsigned long long) snic->OutTimestamps);
893 printf(" %s:", pfield(NULL, 0));
894 pval((unsigned long long) snip->OutTimestampReps, (unsigned long long) snic->OutTimestampReps);
895 printf(" %s:", pfield(NULL, 0));
896 pval((unsigned long long) snip->InAddrMasks, (unsigned long long) snic->InAddrMasks);
897 printf(" %s:", pfield(NULL, 0));
898 pval((unsigned long long) snip->InAddrMaskReps, (unsigned long long) snic->InAddrMaskReps);
899 printf(" %s:", pfield(NULL, 0));
900 pval((unsigned long long) snip->OutAddrMasks, (unsigned long long) snic->OutAddrMasks);
901 printf(" %s:", pfield(NULL, 0));
902 pval((unsigned long long) snip->OutAddrMaskReps, (unsigned long long) snic->OutAddrMaskReps);
907 ***************************************************************************
908 * Display ICMP errors message statistics in raw format.
911 * @a Activity structure with statistics.
912 * @timestr Time for current statistics sample.
913 * @curr Index in array for current sample statistics.
914 ***************************************************************************
916 __print_funct_t raw_print_net_eicmp_stats(struct activity *a, char *timestr, int curr)
918 struct stats_net_eicmp
919 *sneic = (struct stats_net_eicmp *) a->buf[curr],
920 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
922 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
923 pval((unsigned long long) sneip->InErrors, (unsigned long long) sneic->InErrors);
924 printf(" %s:", pfield(NULL, 0));
925 pval((unsigned long long) sneip->OutErrors, (unsigned long long) sneic->OutErrors);
926 printf(" %s:", pfield(NULL, 0));
927 pval((unsigned long long) sneip->InDestUnreachs, (unsigned long long) sneic->InDestUnreachs);
928 printf(" %s:", pfield(NULL, 0));
929 pval((unsigned long long) sneip->OutDestUnreachs, (unsigned long long) sneic->OutDestUnreachs);
930 printf(" %s:", pfield(NULL, 0));
931 pval((unsigned long long) sneip->InTimeExcds, (unsigned long long) sneic->InTimeExcds);
932 printf(" %s:", pfield(NULL, 0));
933 pval((unsigned long long) sneip->OutTimeExcds, (unsigned long long) sneic->OutTimeExcds);
934 printf(" %s:", pfield(NULL, 0));
935 pval((unsigned long long) sneip->InParmProbs, (unsigned long long) sneic->InParmProbs);
936 printf(" %s:", pfield(NULL, 0));
937 pval((unsigned long long) sneip->OutParmProbs, (unsigned long long) sneic->OutParmProbs);
938 printf(" %s:", pfield(NULL, 0));
939 pval((unsigned long long) sneip->InSrcQuenchs, (unsigned long long) sneic->InSrcQuenchs);
940 printf(" %s:", pfield(NULL, 0));
941 pval((unsigned long long) sneip->OutSrcQuenchs, (unsigned long long) sneic->OutSrcQuenchs);
942 printf(" %s:", pfield(NULL, 0));
943 pval((unsigned long long) sneip->InRedirects, (unsigned long long) sneic->InRedirects);
944 printf(" %s:", pfield(NULL, 0));
945 pval((unsigned long long) sneip->OutRedirects, (unsigned long long) sneic->OutRedirects);
950 ***************************************************************************
951 * Display TCP network statistics in raw format.
954 * @a Activity structure with statistics.
955 * @timestr Time for current statistics sample.
956 * @curr Index in array for current sample statistics.
957 ***************************************************************************
959 __print_funct_t raw_print_net_tcp_stats(struct activity *a, char *timestr, int curr)
962 *sntc = (struct stats_net_tcp *) a->buf[curr],
963 *sntp = (struct stats_net_tcp *) a->buf[!curr];
965 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
966 pval((unsigned long long) sntp->ActiveOpens, (unsigned long long) sntc->ActiveOpens);
967 printf(" %s:", pfield(NULL, 0));
968 pval((unsigned long long) sntp->PassiveOpens, (unsigned long long) sntc->PassiveOpens);
969 printf(" %s:", pfield(NULL, 0));
970 pval((unsigned long long) sntp->InSegs, (unsigned long long) sntc->InSegs);
971 printf(" %s:", pfield(NULL, 0));
972 pval((unsigned long long) sntp->OutSegs, (unsigned long long) sntc->OutSegs);
977 ***************************************************************************
978 * Display TCP network errors statistics in raw format.
981 * @a Activity structure with statistics.
982 * @timestr Time for current statistics sample.
983 * @curr Index in array for current sample statistics.
984 ***************************************************************************
986 __print_funct_t raw_print_net_etcp_stats(struct activity *a, char *timestr, int curr)
988 struct stats_net_etcp
989 *snetc = (struct stats_net_etcp *) a->buf[curr],
990 *snetp = (struct stats_net_etcp *) a->buf[!curr];
992 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
993 pval((unsigned long long) snetp->AttemptFails, (unsigned long long) snetc->AttemptFails);
994 printf(" %s:", pfield(NULL, 0));
995 pval((unsigned long long) snetp->EstabResets, (unsigned long long) snetc->EstabResets);
996 printf(" %s:", pfield(NULL, 0));
997 pval((unsigned long long) snetp->RetransSegs, (unsigned long long) snetc->RetransSegs);
998 printf(" %s:", pfield(NULL, 0));
999 pval((unsigned long long) snetp->InErrs, (unsigned long long) snetc->InErrs);
1000 printf(" %s:", pfield(NULL, 0));
1001 pval((unsigned long long) snetp->OutRsts, (unsigned long long) snetc->OutRsts);
1006 ***************************************************************************
1007 * Display UDP network statistics in raw format.
1010 * @a Activity structure with statistics.
1011 * @timestr Time for current statistics sample.
1012 * @curr Index in array for current sample statistics.
1013 ***************************************************************************
1015 __print_funct_t raw_print_net_udp_stats(struct activity *a, char *timestr, int curr)
1017 struct stats_net_udp
1018 *snuc = (struct stats_net_udp *) a->buf[curr],
1019 *snup = (struct stats_net_udp *) a->buf[!curr];
1021 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1022 pval((unsigned long long) snup->InDatagrams, (unsigned long long) snuc->InDatagrams);
1023 printf(" %s:", pfield(NULL, 0));
1024 pval((unsigned long long) snup->OutDatagrams, (unsigned long long) snuc->OutDatagrams);
1025 printf(" %s:", pfield(NULL, 0));
1026 pval((unsigned long long) snup->NoPorts, (unsigned long long) snuc->NoPorts);
1027 printf(" %s:", pfield(NULL, 0));
1028 pval((unsigned long long) snup->InErrors, (unsigned long long) snuc->InErrors);
1033 ***************************************************************************
1034 * Display IPv6 network socket statistics in raw format.
1037 * @a Activity structure with statistics.
1038 * @timestr Time for current statistics sample.
1039 * @curr Index in array for current sample statistics.
1040 ***************************************************************************
1042 __print_funct_t raw_print_net_sock6_stats(struct activity *a, char *timestr, int curr)
1044 struct stats_net_sock6
1045 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1047 printf("%s %s:%u", timestr, pfield(a->hdr_line, FIRST), snsc->tcp6_inuse);
1048 printf(" %s:%u", pfield(NULL, 0), snsc->udp6_inuse);
1049 printf(" %s:%u", pfield(NULL, 0), snsc->raw6_inuse);
1050 printf(" %s:%u", pfield(NULL, 0), snsc->frag6_inuse);
1055 ***************************************************************************
1056 * Display IPv6 network statistics in raw format.
1059 * @a Activity structure with statistics.
1060 * @timestr Time for current statistics sample.
1061 * @curr Index in array for current sample statistics.
1062 ***************************************************************************
1064 __print_funct_t raw_print_net_ip6_stats(struct activity *a, char *timestr, int curr)
1066 struct stats_net_ip6
1067 *snic = (struct stats_net_ip6 *) a->buf[curr],
1068 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1070 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1071 pval(snip->InReceives6, snic->InReceives6);
1072 printf(" %s:", pfield(NULL, 0));
1073 pval(snip->OutForwDatagrams6, snic->OutForwDatagrams6);
1074 printf(" %s:", pfield(NULL, 0));
1075 pval(snip->InDelivers6, snic->InDelivers6);
1076 printf(" %s:", pfield(NULL, 0));
1077 pval(snip->OutRequests6, snic->OutRequests6);
1078 printf(" %s:", pfield(NULL, 0));
1079 pval(snip->ReasmReqds6, snic->ReasmReqds6);
1080 printf(" %s:", pfield(NULL, 0));
1081 pval(snip->ReasmOKs6, snic->ReasmOKs6);
1082 printf(" %s:", pfield(NULL, 0));
1083 pval(snip->InMcastPkts6, snic->InMcastPkts6);
1084 printf(" %s:", pfield(NULL, 0));
1085 pval(snip->OutMcastPkts6, snic->OutMcastPkts6);
1086 printf(" %s:", pfield(NULL, 0));
1087 pval(snip->FragOKs6, snic->FragOKs6);
1088 printf(" %s:", pfield(NULL, 0));
1089 pval(snip->FragCreates6, snic->FragCreates6);
1094 ***************************************************************************
1095 * Display IPv6 network errors statistics in raw format.
1098 * @a Activity structure with statistics.
1099 * @timestr Time for current statistics sample.
1100 * @curr Index in array for current sample statistics.
1101 ***************************************************************************
1103 __print_funct_t raw_print_net_eip6_stats(struct activity *a, char *timestr, int curr)
1105 struct stats_net_eip6
1106 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1107 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1109 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1110 pval(sneip->InHdrErrors6, sneic->InHdrErrors6);
1111 printf(" %s:", pfield(NULL, 0));
1112 pval(sneip->InAddrErrors6, sneic->InAddrErrors6);
1113 printf(" %s:", pfield(NULL, 0));
1114 pval(sneip->InUnknownProtos6, sneic->InUnknownProtos6);
1115 printf(" %s:", pfield(NULL, 0));
1116 pval(sneip->InTooBigErrors6, sneic->InTooBigErrors6);
1117 printf(" %s:", pfield(NULL, 0));
1118 pval(sneip->InDiscards6, sneic->InDiscards6);
1119 printf(" %s:", pfield(NULL, 0));
1120 pval(sneip->OutDiscards6, sneic->OutDiscards6);
1121 printf(" %s:", pfield(NULL, 0));
1122 pval(sneip->InNoRoutes6, sneic->InNoRoutes6);
1123 printf(" %s:", pfield(NULL, 0));
1124 pval(sneip->OutNoRoutes6, sneic->OutNoRoutes6);
1125 printf(" %s:", pfield(NULL, 0));
1126 pval(sneip->ReasmFails6, sneic->ReasmFails6);
1127 printf(" %s:", pfield(NULL, 0));
1128 pval(sneip->FragFails6, sneic->FragFails6);
1129 printf(" %s:", pfield(NULL, 0));
1130 pval(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6);
1135 ***************************************************************************
1136 * Display ICMPv6 network statistics in raw format.
1139 * @a Activity structure with statistics.
1140 * @timestr Time for current statistics sample.
1141 * @curr Index in array for current sample statistics.
1142 ***************************************************************************
1144 __print_funct_t raw_print_net_icmp6_stats(struct activity *a, char *timestr, int curr)
1146 struct stats_net_icmp6
1147 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1148 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1150 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1151 pval((unsigned long long) snip->InMsgs6,
1152 (unsigned long long) snic->InMsgs6);
1153 printf(" %s:", pfield(NULL, 0));
1154 pval((unsigned long long) snip->OutMsgs6,
1155 (unsigned long long) snic->OutMsgs6);
1156 printf(" %s:", pfield(NULL, 0));
1157 pval((unsigned long long) snip->InEchos6,
1158 (unsigned long long) snic->InEchos6);
1159 printf(" %s:", pfield(NULL, 0));
1160 pval((unsigned long long) snip->InEchoReplies6,
1161 (unsigned long long) snic->InEchoReplies6);
1162 printf(" %s:", pfield(NULL, 0));
1163 pval((unsigned long long) snip->OutEchoReplies6,
1164 (unsigned long long) snic->OutEchoReplies6);
1165 printf(" %s:", pfield(NULL, 0));
1166 pval((unsigned long long) snip->InGroupMembQueries6,
1167 (unsigned long long) snic->InGroupMembQueries6);
1168 printf(" %s:", pfield(NULL, 0));
1169 pval((unsigned long long) snip->InGroupMembResponses6,
1170 (unsigned long long) snic->InGroupMembResponses6);
1171 printf(" %s:", pfield(NULL, 0));
1172 pval((unsigned long long) snip->OutGroupMembResponses6,
1173 (unsigned long long) snic->OutGroupMembResponses6);
1174 printf(" %s:", pfield(NULL, 0));
1175 pval((unsigned long long) snip->InGroupMembReductions6,
1176 (unsigned long long) snic->InGroupMembReductions6);
1177 printf(" %s:", pfield(NULL, 0));
1178 pval((unsigned long long) snip->OutGroupMembReductions6,
1179 (unsigned long long) snic->OutGroupMembReductions6);
1180 printf(" %s:", pfield(NULL, 0));
1181 pval((unsigned long long) snip->InRouterSolicits6,
1182 (unsigned long long) snic->InRouterSolicits6);
1183 printf(" %s:", pfield(NULL, 0));
1184 pval((unsigned long long) snip->OutRouterSolicits6,
1185 (unsigned long long) snic->OutRouterSolicits6);
1186 printf(" %s:", pfield(NULL, 0));
1187 pval((unsigned long long) snip->InRouterAdvertisements6,
1188 (unsigned long long) snic->InRouterAdvertisements6);
1189 printf(" %s:", pfield(NULL, 0));
1190 pval((unsigned long long) snip->InNeighborSolicits6,
1191 (unsigned long long) snic->InNeighborSolicits6);
1192 printf(" %s:", pfield(NULL, 0));
1193 pval((unsigned long long) snip->OutNeighborSolicits6,
1194 (unsigned long long) snic->OutNeighborSolicits6);
1195 printf(" %s:", pfield(NULL, 0));
1196 pval((unsigned long long) snip->InNeighborAdvertisements6,
1197 (unsigned long long) snic->InNeighborAdvertisements6);
1198 printf(" %s:", pfield(NULL, 0));
1199 pval((unsigned long long) snip->OutNeighborAdvertisements6,
1200 (unsigned long long) snic->OutNeighborAdvertisements6);
1205 ***************************************************************************
1206 * Display ICMPv6 error messages statistics in rw format.
1209 * @a Activity structure with statistics.
1210 * @timestr Time for current statistics sample.
1211 * @curr Index in array for current sample statistics.
1212 ***************************************************************************
1214 __print_funct_t raw_print_net_eicmp6_stats(struct activity *a, char *timestr, int curr)
1216 struct stats_net_eicmp6
1217 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1218 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1220 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1221 pval((unsigned long long) sneip->InErrors6, (unsigned long long) sneic->InErrors6);
1222 printf(" %s:", pfield(NULL, 0));
1223 pval((unsigned long long) sneip->InDestUnreachs6, (unsigned long long) sneic->InDestUnreachs6);
1224 printf(" %s:", pfield(NULL, 0));
1225 pval((unsigned long long) sneip->OutDestUnreachs6, (unsigned long long) sneic->OutDestUnreachs6);
1226 printf(" %s:", pfield(NULL, 0));
1227 pval((unsigned long long) sneip->InTimeExcds6, (unsigned long long) sneic->InTimeExcds6);
1228 printf(" %s:", pfield(NULL, 0));
1229 pval((unsigned long long) sneip->OutTimeExcds6, (unsigned long long) sneic->OutTimeExcds6);
1230 printf(" %s:", pfield(NULL, 0));
1231 pval((unsigned long long) sneip->InParmProblems6, (unsigned long long) sneic->InParmProblems6);
1232 printf(" %s:", pfield(NULL, 0));
1233 pval((unsigned long long) sneip->OutParmProblems6, (unsigned long long) sneic->OutParmProblems6);
1234 printf(" %s:", pfield(NULL, 0));
1235 pval((unsigned long long) sneip->InRedirects6, (unsigned long long) sneic->InRedirects6);
1236 printf(" %s:", pfield(NULL, 0));
1237 pval((unsigned long long) sneip->OutRedirects6, (unsigned long long) sneic->OutRedirects6);
1238 printf(" %s:", pfield(NULL, 0));
1239 pval((unsigned long long) sneip->InPktTooBigs6, (unsigned long long) sneic->InPktTooBigs6);
1240 printf(" %s:", pfield(NULL, 0));
1241 pval((unsigned long long) sneip->OutPktTooBigs6, (unsigned long long) sneic->OutPktTooBigs6);
1246 ***************************************************************************
1247 * Display UDPv6 network statistics in raw format.
1250 * @a Activity structure with statistics.
1251 * @timestr Time for current statistics sample.
1252 * @curr Index in array for current sample statistics.
1253 ***************************************************************************
1255 __print_funct_t raw_print_net_udp6_stats(struct activity *a, char *timestr, int curr)
1257 struct stats_net_udp6
1258 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1259 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1261 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
1262 pval((unsigned long long) snup->InDatagrams6, (unsigned long long) snuc->InDatagrams6);
1263 printf(" %s:", pfield(NULL, 0));
1264 pval((unsigned long long) snup->OutDatagrams6, (unsigned long long) snuc->OutDatagrams6);
1265 printf(" %s:", pfield(NULL, 0));
1266 pval((unsigned long long) snup->NoPorts6, (unsigned long long) snuc->NoPorts6);
1267 printf(" %s:", pfield(NULL, 0));
1268 pval((unsigned long long) snup->InErrors6, (unsigned long long) snuc->InErrors6);
1273 ***************************************************************************
1274 * Display CPU frequency statistics in raw format.
1277 * @a Activity structure with statistics.
1278 * @timestr Time for current statistics sample.
1279 * @curr Index in array for current sample statistics.
1280 ***************************************************************************
1282 __print_funct_t raw_print_pwr_cpufreq_stats(struct activity *a, char *timestr, int curr)
1285 struct stats_pwr_cpufreq *spc;
1287 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1289 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1291 /* Should current CPU (including CPU "all") be displayed? */
1292 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1293 /* Yes: Display it */
1294 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i - 1);
1295 printf(" %s:%lu\n", pfield(NULL, 0), spc->cpufreq);
1301 ***************************************************************************
1302 * Display fan statistics in raw format.
1305 * @a Activity structure with statistics.
1306 * @timestr Time for current statistics sample.
1307 * @curr Index in array for current sample statistics.
1308 ***************************************************************************
1310 __print_funct_t raw_print_pwr_fan_stats(struct activity *a, char *timestr, int curr)
1313 struct stats_pwr_fan *spc;
1315 for (i = 0; i < a->nr; i++) {
1316 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1318 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i + 1);
1319 printf(" %s:%s", pfield(NULL, 0), spc->device);
1320 printf(" %s:%f", pfield(NULL, 0), spc->rpm);
1321 printf(" rpm_min:%f\n", spc->rpm_min);
1326 ***************************************************************************
1327 * Display temperature statistics in raw format.
1330 * @a Activity structure with statistics.
1331 * @timestr Time for current statistics sample.
1332 * @curr Index in array for current sample statistics.
1333 ***************************************************************************
1335 __print_funct_t raw_print_pwr_temp_stats(struct activity *a, char *timestr, int curr)
1338 struct stats_pwr_temp *spc;
1340 for (i = 0; i < a->nr; i++) {
1341 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1343 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i + 1);
1344 printf(" %s:%s", pfield(NULL, 0), spc->device);
1345 printf(" %s:%f", pfield(NULL, 0), spc->temp);
1346 printf(" temp_min:%f", spc->temp_min);
1347 printf(" temp_max:%f\n", spc->temp_max);
1352 ***************************************************************************
1353 * Display voltage inputs statistics in raw format.
1356 * @a Activity structure with statistics.
1357 * @timestr Time for current statistics sample.
1358 * @curr Index in array for current sample statistics.
1359 ***************************************************************************
1361 __print_funct_t raw_print_pwr_in_stats(struct activity *a, char *timestr, int curr)
1364 struct stats_pwr_in *spc;
1366 for (i = 0; i < a->nr; i++) {
1367 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1369 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i);
1370 printf(" %s:%s", pfield(NULL, 0), spc->device);
1371 printf(" %s:%f", pfield(NULL, 0), spc->in);
1372 printf(" in_min:%f", spc->in_min);
1373 printf(" in_max:%f\n", spc->in_max);
1378 ***************************************************************************
1379 * Display huge pages statistics in raw format.
1382 * @a Activity structure with statistics.
1383 * @timestr Time for current statistics sample.
1384 * @curr Index in array for current sample statistics.
1385 ***************************************************************************
1387 __print_funct_t raw_print_huge_stats(struct activity *a, char *timestr, int curr)
1390 *smc = (struct stats_huge *) a->buf[curr];
1392 printf("%s %s:%lu", timestr, pfield(a->hdr_line, FIRST), smc->frhkb);
1393 printf(" hugtotal:%lu\n", smc->tlhkb);
1397 ***************************************************************************
1398 * Display weighted CPU frequency statistics in raw format.
1401 * @a Activity structure with statistics.
1402 * @timestr Time for current statistics sample.
1403 * @curr Index in array for current sample statistics.
1404 ***************************************************************************
1406 __print_funct_t raw_print_pwr_wghfreq_stats(struct activity *a, char *timestr, int curr)
1409 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1411 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1413 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
1414 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
1416 /* Should current CPU (including CPU "all") be displayed? */
1417 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1420 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i - 1);
1422 for (k = 0; k < a->nr2; k++) {
1424 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
1427 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
1429 printf(" freq: %lu", spc_k->freq);
1431 pval(spp_k->time_in_state, spc_k->time_in_state);
1439 ***************************************************************************
1440 * Display USB devices statistics in raw format.
1443 * @a Activity structure with statistics.
1444 * @timestr Time for current statistics sample.
1445 * @curr Index in array for current sample statistics.
1446 ***************************************************************************
1448 __print_funct_t raw_print_pwr_usb_stats(struct activity *a, char *timestr, int curr)
1451 struct stats_pwr_usb *suc;
1453 for (i = 0; i < a->nr; i++) {
1454 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
1457 /* Bus#0 doesn't exist: We are at the end of the list */
1460 printf("%s %s:\"%s\"", timestr, pfield(a->hdr_line, FIRST), suc->manufacturer);
1461 printf(" %s:\"%s\"", pfield(NULL, 0), suc->product);
1462 printf(" %s:%d", pfield(NULL, 0), suc->bus_nr);
1463 printf(" %s:%x", pfield(NULL, 0), suc->vendor_id);
1464 printf(" %s:%x", pfield(NULL, 0), suc->product_id);
1465 printf(" %s:%u\n", pfield(NULL, 0), suc->bmaxpower);
1470 ***************************************************************************
1471 * Display filesystems statistics in raw format.
1474 * @a Activity structure with statistics.
1475 * @timestr Time for current statistics sample.
1476 * @curr Index in array for current sample statistics.
1477 ***************************************************************************
1479 __print_funct_t raw_print_filesystem_stats(struct activity *a, char *timestr, int curr)
1482 struct stats_filesystem *sfc;
1485 for (i = 0; i < a->nr; i++) {
1486 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
1489 /* Size of filesystem is zero: We are at the end of the list */
1492 printf("%s %s:\"%s\"", timestr, pfield(a->hdr_line, FIRST + DISPLAY_MOUNT(a->opt_flags)),
1493 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name);
1494 printf(" f_bfree:%llu", sfc->f_bfree);
1495 printf(" f_blocks:%llu", sfc->f_blocks);
1496 printf(" f_bavail:%llu", sfc->f_bavail);
1497 pfield(NULL, 0); /* Skip MBfsfree */
1498 pfield(NULL, 0); /* Skip MBfsused */
1499 pfield(NULL, 0); /* Skip %fsused */
1500 pfield(NULL, 0); /* Skip %ufsused */
1501 printf(" %s:%llu", pfield(NULL, 0), sfc->f_ffree);
1502 printf(" f_files:%llu\n", sfc->f_files);
1508 ***************************************************************************
1509 * Display Fibre Channel HBA statistics in raw format.
1512 * @a Activity structure with statistics.
1513 * @timestr Time for current statistics sample.
1514 * @curr Index in array for current sample statistics.
1515 ***************************************************************************
1517 __print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int curr)
1520 struct stats_fchost *sfcc, *sfcp;
1522 for (i = 0; i < a->nr; i++) {
1523 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
1524 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + i * a->msize);
1526 if (!sfcc->fchost_name[0])
1527 /* We are at the end of the list */
1530 printf(" %s:%s", pfield(a->hdr_line, FIRST), sfcc->fchost_name);
1531 printf(" %s:", pfield(NULL, 0));
1532 pval((unsigned long long) sfcp->f_rxframes, (unsigned long long) sfcc->f_rxframes);
1533 printf(" %s:", pfield(NULL, 0));
1534 pval((unsigned long long) sfcp->f_txframes, (unsigned long long) sfcc->f_txframes);
1535 printf(" %s:", pfield(NULL, 0));
1536 pval((unsigned long long) sfcp->f_rxwords, (unsigned long long) sfcc->f_rxwords);
1537 printf(" %s:", pfield(NULL, 0));
1538 pval((unsigned long long) sfcp->f_txwords, (unsigned long long) sfcc->f_txwords);
1544 ***************************************************************************
1545 * Display softnet statistics in raw format.
1548 * @a Activity structure with statistics.
1549 * @timestr Time for current statistics sample.
1550 * @curr Index in array for current sample statistics.
1551 ***************************************************************************
1553 __print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int curr)
1556 struct stats_softnet *ssnc, *ssnp;
1558 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1561 * The size of a->buf[...] CPU structure may be different from the default
1562 * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1563 * That's why we don't use a syntax like:
1564 * ssnc = (struct stats_softnet *) a->buf[...] + i;
1566 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
1567 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
1570 * Note: a->nr is in [1, NR_CPUS + 1].
1571 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1572 * Anyway, NR_CPUS may vary between the version of sysstat
1573 * used by sadc to create a file, and the version of sysstat
1574 * used by sar to read it...
1577 /* Should current CPU (including CPU "all") be displayed? */
1578 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1582 /* Yes: Display current CPU stats */
1583 printf("%s %s:%d", timestr, pfield(a->hdr_line, FIRST), i - 1);
1584 printf(" %s:", pfield(NULL, 0));
1585 pval((unsigned long long) ssnp->processed, (unsigned long long) ssnc->processed);
1586 printf(" %s:", pfield(NULL, 0));
1587 pval((unsigned long long) ssnp->dropped, (unsigned long long) ssnc->dropped);
1588 printf(" %s:", pfield(NULL, 0));
1589 pval((unsigned long long) ssnp->time_squeeze, (unsigned long long) ssnc->time_squeeze);
1590 printf(" %s:", pfield(NULL, 0));
1591 pval((unsigned long long) ssnp->received_rps, (unsigned long long) ssnc->received_rps);
1592 printf(" %s:", pfield(NULL, 0));
1593 pval((unsigned long long) ssnp->flow_limit, (unsigned long long) ssnc->flow_limit);