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, '&')) {
74 /* Display current field */
75 if (strchr(field + idx, ';')) {
76 j = strcspn(field + idx, ";");
77 *(field + idx + j) = '\0';
86 ***************************************************************************
87 * Display field values.
90 * @valp Field's value from previous statistics sample.
91 * @valc Field's value from current statistics sample.
92 ***************************************************************************
94 void pval(unsigned long long valp, unsigned long long valc)
96 printf("%llu>%llu", valp, valc);
97 if (DISPLAY_HINTS(flags)) {
99 /* Field's value has decreased */
106 ***************************************************************************
107 * Display CPU statistics in raw format.
110 * @a Activity structure with statistics.
111 * @timestr Time for current statistics sample.
112 * @curr Index in array for current statistics sample.
113 ***************************************************************************
115 __print_funct_t raw_print_cpu_stats(struct activity *a, char *timestr, int curr)
118 struct stats_cpu *scc, *scp;
120 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
123 * The size of a->buf[...] CPU structure may be different from the default
124 * sizeof(struct stats_cpu) value if data have been read from a file!
125 * That's why we don't use a syntax like:
126 * scc = (struct stats_cpu *) a->buf[...] + i;
128 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
129 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
132 * Note: a->nr is in [1, NR_CPUS + 1].
133 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
134 * Anyway, NR_CPUS may vary between the version of sysstat
135 * used by sadc to create a file, and the version of sysstat
136 * used by sar to read it...
139 /* Should current CPU (including CPU "all") be displayed? */
140 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
144 /* Yes: Display it */
145 printf("%s %s:%d", timestr,
146 pfield(a->hdr_line, DISPLAY_CPU_ALL(a->opt_flags)), i - 1);
148 if (DISPLAY_HINTS(flags) && i) {
149 if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
150 scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
151 scc->cpu_hardirq + scc->cpu_softirq) == 0) {
156 if (!get_per_cpu_interval(scc, scp)) {
157 /* CPU is tickless */
163 if (DISPLAY_CPU_DEF(a->opt_flags)) {
164 printf(" %s:", pfield(NULL, 0));
165 pval(scp->cpu_user, scc->cpu_user);
166 printf(" %s:", pfield(NULL, 0));
167 pval(scp->cpu_nice, scc->cpu_nice);
168 printf(" %s:", pfield(NULL, 0));
169 pval(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
170 scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq);
171 printf(" %s:", pfield(NULL, 0));
172 pval(scp->cpu_iowait, scc->cpu_iowait);
173 printf(" %s:", pfield(NULL, 0));
174 pval(scp->cpu_steal, scc->cpu_steal);
175 printf(" %s:", pfield(NULL, 0));
176 pval(scp->cpu_idle, scc->cpu_idle);
178 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
179 printf(" %s:", pfield(NULL, 0));
180 pval(scp->cpu_user - scp->cpu_guest, scc->cpu_user - scc->cpu_guest);
181 printf(" %s:", pfield(NULL, 0));
182 pval(scp->cpu_nice - scp->cpu_guest_nice, scc->cpu_nice - scc->cpu_guest_nice);
183 printf(" %s:", pfield(NULL, 0));
184 pval(scp->cpu_sys, scc->cpu_sys);
185 printf(" %s:", pfield(NULL, 0));
186 pval(scp->cpu_iowait, scc->cpu_iowait);
187 printf(" %s:", pfield(NULL, 0));
188 pval(scp->cpu_steal, scc->cpu_steal);
189 printf(" %s:", pfield(NULL, 0));
190 pval(scp->cpu_hardirq, scc->cpu_hardirq);
191 printf(" %s:", pfield(NULL, 0));
192 pval(scp->cpu_softirq, scc->cpu_softirq);
193 printf(" %s:", pfield(NULL, 0));
194 pval(scp->cpu_guest, scc->cpu_guest);
195 printf(" %s:", pfield(NULL, 0));
196 pval(scp->cpu_guest_nice, scc->cpu_guest_nice);
197 printf(" %s:", pfield(NULL, 0));
198 pval(scp->cpu_idle, scc->cpu_idle);
205 ***************************************************************************
206 * Display tasks creation and context switches statistics in raw format.
209 * @a Activity structure with statistics.
210 * @timestr Time for current statistics sample.
211 * @curr Index in array for current sample statistics.
212 ***************************************************************************
214 __print_funct_t raw_print_pcsw_stats(struct activity *a, char *timestr, int curr)
217 *spc = (struct stats_pcsw *) a->buf[curr],
218 *spp = (struct stats_pcsw *) a->buf[!curr];
220 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
221 pval(spp->processes, spc->processes);
222 printf(" %s:", pfield(NULL, 0));
223 pval(spp->context_switch, spc->context_switch);
228 ***************************************************************************
229 * Display interrupts statistics in raw format.
232 * @a Activity structure with statistics.
233 * @timestr Time for current statistics sample.
234 * @curr Index in array for current sample statistics.
235 ***************************************************************************
237 __print_funct_t raw_print_irq_stats(struct activity *a, char *timestr, int curr)
240 struct stats_irq *sic, *sip;
242 for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
244 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
245 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
247 /* Should current interrupt (including int "sum") be displayed? */
248 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
250 /* Yes: Display it */
251 printf("%s %s:%d", timestr,
252 pfield(a->hdr_line, FIRST), i - 1);
253 printf(" %s:", pfield(NULL, 0));
254 pval(sip->irq_nr, sic->irq_nr);
261 ***************************************************************************
262 * Display swapping statistics in raw format.
265 * @a Activity structure with statistics.
266 * @timestr Time for current statistics sample.
267 * @curr Index in array for current sample statistics.
268 ***************************************************************************
270 __print_funct_t raw_print_swap_stats(struct activity *a, char *timestr, int curr)
273 *ssc = (struct stats_swap *) a->buf[curr],
274 *ssp = (struct stats_swap *) a->buf[!curr];
276 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
277 pval(ssp->pswpin, ssc->pswpin);
278 printf(" %s:", pfield(NULL, 0));
279 pval(ssp->pswpout, ssc->pswpout);
284 ***************************************************************************
285 * Display paging statistics in raw format.
288 * @a Activity structure with statistics.
289 * @timestr Time for current statistics sample.
290 * @curr Index in array for current sample statistics.
291 ***************************************************************************
293 __print_funct_t raw_print_paging_stats(struct activity *a, char *timestr, int curr)
296 *spc = (struct stats_paging *) a->buf[curr],
297 *spp = (struct stats_paging *) a->buf[!curr];
299 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
300 pval(spp->pgpgin, spc->pgpgin);
301 printf(" %s:", pfield(NULL, 0));
302 pval(spp->pgpgout, spc->pgpgout);
303 printf(" %s:", pfield(NULL, 0));
304 pval(spp->pgfault, spc->pgfault);
305 printf(" %s:", pfield(NULL, 0));
306 pval(spp->pgmajfault, spc->pgmajfault);
307 printf(" %s:", pfield(NULL, 0));
308 pval(spp->pgfree, spc->pgfree);
309 printf(" %s:", pfield(NULL, 0));
310 pval(spp->pgscan_kswapd, spc->pgscan_kswapd);
311 printf(" %s:", pfield(NULL, 0));
312 pval(spp->pgscan_direct, spc->pgscan_direct);
313 printf(" %s:", pfield(NULL, 0));
314 pval(spp->pgsteal, spc->pgsteal);
319 ***************************************************************************
320 * Display I/O and transfer rate statistics in raw format.
323 * @a Activity structure with statistics.
324 * @timestr Time for current statistics sample.
325 * @curr Index in array for current sample statistics.
326 ***************************************************************************
328 __print_funct_t raw_print_io_stats(struct activity *a, char *timestr, int curr)
331 *sic = (struct stats_io *) a->buf[curr],
332 *sip = (struct stats_io *) a->buf[!curr];
334 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
335 pval(sip->dk_drive, sic->dk_drive);
336 printf(" %s:", pfield(NULL, 0));
337 pval(sip->dk_drive_rio, sic->dk_drive_rio);
338 printf(" %s:", pfield(NULL, 0));
339 pval(sip->dk_drive_wio, sic->dk_drive_wio);
340 printf(" %s:", pfield(NULL, 0));
341 pval(sip->dk_drive_rblk, sic->dk_drive_rblk);
342 printf(" %s:", pfield(NULL, 0));
343 pval(sip->dk_drive_wblk, sic->dk_drive_wblk);
348 ***************************************************************************
349 * Display memory statistics in raw format.
352 * @a Activity structure with statistics.
353 * @timestr Time for current statistics sample.
354 * @curr Index in array for current sample statistics.
355 ***************************************************************************
357 __print_funct_t raw_print_memory_stats(struct activity *a, char *timestr, int curr)
360 *smc = (struct stats_memory *) a->buf[curr];
362 if (DISPLAY_MEM_AMT(a->opt_flags)) {
363 printf("%s %s:%lu", timestr, pfield(a->hdr_line, SECOND), smc->frmkb);
364 printf(" %s:%lu", pfield(NULL, 0), smc->availablekb);
365 printf(" kbttlmem:%lu", smc->tlmkb);
366 pfield(NULL, 0); /* Skip kbmemused */
367 pfield(NULL, 0); /* Skip %memused */
368 printf(" %s:%lu", pfield(NULL, 0), smc->bufkb);
369 printf(" %s:%lu", pfield(NULL, 0), smc->camkb);
370 printf(" %s:%lu", pfield(NULL, 0), smc->comkb);
371 pfield(NULL, 0); /* Skip %commit */
372 printf(" %s:%lu", pfield(NULL, 0), smc->activekb);
373 printf(" %s:%lu", pfield(NULL, 0), smc->inactkb);
374 printf(" %s:%lu", pfield(NULL, 0), smc->dirtykb);
376 if (DISPLAY_MEM_ALL(a->opt_flags)) {
377 printf(" %s:%lu", pfield(NULL, 0), smc->anonpgkb);
378 printf(" %s:%lu", pfield(NULL, 0), smc->slabkb);
379 printf(" %s:%lu", pfield(NULL, 0), smc->kstackkb);
380 printf(" %s:%lu", pfield(NULL, 0), smc->pgtblkb);
381 printf(" %s:%lu", pfield(NULL, 0), smc->vmusedkb);
386 if (DISPLAY_SWAP(a->opt_flags)) {
387 printf("%s %s:%lu", timestr, pfield(a->hdr_line, THIRD), smc->frskb);
388 printf(" kbttlswp:%lu", smc->tlskb);
389 pfield(NULL, 0); /* Skip kbswpused */
390 pfield(NULL, 0); /* Skip %swpused */
391 printf(" %s:%lu", pfield(NULL, 0), smc->caskb);
397 ***************************************************************************
398 * Display kernel tables statistics in raw format.
401 * @a Activity structure with statistics.
402 * @timestr Time for current statistics sample.
403 * @curr Index in array for current sample statistics.
404 ***************************************************************************
406 __print_funct_t raw_print_ktables_stats(struct activity *a, char *timestr, int curr)
409 *skc = (struct stats_ktables *) a->buf[curr];
411 printf("%s %s:%u", timestr, pfield(a->hdr_line, FIRST), skc->dentry_stat);
412 printf(" %s:%u", pfield(NULL, 0), skc->file_used);
413 printf(" %s:%u", pfield(NULL, 0), skc->inode_used);
414 printf(" %s:%u", pfield(NULL, 0), skc->pty_nr);
419 ***************************************************************************
420 * Display queue and load statistics in raw format.
423 * @a Activity structure with statistics.
424 * @timestr Time for current statistics sample.
425 * @curr Index in array for current sample statistics.
426 ***************************************************************************
428 __print_funct_t raw_print_queue_stats(struct activity *a, char *timestr, int curr)
431 *sqc = (struct stats_queue *) a->buf[curr];
433 printf("%s %s:%lu", timestr, pfield(a->hdr_line, FIRST), sqc->nr_running);
434 printf(" %s:%u", pfield(NULL, 0), sqc->nr_threads);
435 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_1);
436 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_5);
437 printf(" %s:%u", pfield(NULL, 0), sqc->load_avg_15);
438 printf(" %s:%lu", pfield(NULL, 0), sqc->procs_blocked);
443 ***************************************************************************
444 * Display serial lines statistics in raw format.
447 * @a Activity structure with statistics.
448 * @timestr Time for current statistics sample.
449 * @curr Index in array for current sample statistics.
450 ***************************************************************************
452 __print_funct_t raw_print_serial_stats(struct activity *a, char *timestr, int curr)
455 struct stats_serial *ssc, *ssp;
457 for (i = 0; i < a->nr; i++) {
459 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
460 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
462 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
463 pval(ssp->line, ssc->line);
465 if (ssc->line == 0) {
466 if (DISPLAY_HINTS(flags)) {
473 if (ssc->line == ssp->line) {
474 printf(" %s:", pfield(NULL, 0));
475 pval(ssp->rx, ssc->rx);
476 printf(" %s:", pfield(NULL, 0));
477 pval(ssp->tx, ssc->tx);
478 printf(" %s:", pfield(NULL, 0));
479 pval(ssp->frame, ssc->frame);
480 printf(" %s:", pfield(NULL, 0));
481 pval(ssp->parity, ssc->parity);
482 printf(" %s:", pfield(NULL, 0));
483 pval(ssp->brk, ssc->brk);
484 printf(" %s:", pfield(NULL, 0));
485 pval(ssp->overrun, ssc->overrun);
487 else if (DISPLAY_HINTS(flags)) {
496 ***************************************************************************
497 * Display disks statistics in raw format.
500 * @a Activity structure with statistics.
501 * @timestr Time for current statistics sample.
502 * @curr Index in array for current sample statistics.
503 ***************************************************************************
505 __print_funct_t raw_print_disk_stats(struct activity *a, char *timestr, int curr)
508 struct stats_disk *sdc, *sdp, sdpzero;
509 char *dev_name, *persist_dev_name;
511 memset(&sdpzero, 0, STATS_DISK_SIZE);
513 for (i = 0; i < a->nr; i++) {
515 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
517 printf("%s major:%u minor:%u", timestr, sdc->major, sdc->minor);
519 if (!(sdc->major + sdc->minor)) {
520 if (DISPLAY_HINTS(flags)) {
527 j = check_disk_reg(a, curr, !curr, i);
529 /* This is a newly registered interface. Previous stats are zero */
531 if (DISPLAY_HINTS(flags)) {
536 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
540 persist_dev_name = NULL;
542 if (DISPLAY_PERSIST_NAME_S(flags)) {
543 persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
546 if (persist_dev_name) {
547 dev_name = persist_dev_name;
550 /* Always use pretty option (-p) */
551 if (sdc->major == dm_major) {
552 dev_name = transform_devmapname(sdc->major, sdc->minor);
556 dev_name = get_devname(sdc->major, sdc->minor, TRUE);
560 printf(" %s:%s", pfield(a->hdr_line, FIRST), dev_name);
561 printf(" %s:", pfield(NULL, 0));
562 pval(sdp->nr_ios, sdc->nr_ios);
563 printf(" %s:", pfield(NULL, 0));
564 pval(sdp->rd_sect, sdc->rd_sect);
565 printf(" %s:", pfield(NULL, 0));
566 pval(sdp->wr_sect, sdc->wr_sect);
567 printf(" tot_ticks:");
568 pval(sdp->tot_ticks, sdc->tot_ticks);
569 pfield(NULL, 0); /* Skip avgrq-sz */
570 printf(" %s:", pfield(NULL, 0));
571 pval(sdp->rq_ticks, sdc->rq_ticks);
577 ***************************************************************************
578 * Display network interfaces statistics in raw format.
581 * @a Activity structure with statistics.
582 * @timestr Time for current statistics sample.
583 * @curr Index in array for current sample statistics.
584 ***************************************************************************
586 __print_funct_t raw_print_net_dev_stats(struct activity *a, char *timestr, int curr)
589 struct stats_net_dev *sndc, *sndp, sndzero;
591 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
593 for (i = 0; i < a->nr; i++) {
595 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
597 if (!strcmp(sndc->interface, ""))
600 printf("%s %s:%s", timestr, pfield(a->hdr_line, FIRST), sndc->interface);
602 j = check_net_dev_reg(a, curr, !curr, i);
604 /* This is a newly registered interface. Previous stats are zero */
606 if (DISPLAY_HINTS(flags)) {
611 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
614 printf(" %s:", pfield(NULL, 0));
615 pval(sndp->rx_packets, sndc->rx_packets);
616 printf(" %s:", pfield(NULL, 0));
617 pval(sndp->tx_packets, sndc->tx_packets);
618 printf(" %s:", pfield(NULL, 0));
619 pval(sndp->rx_bytes, sndc->rx_bytes);
620 printf(" %s:", pfield(NULL, 0));
621 pval(sndp->tx_bytes, sndc->tx_bytes);
622 printf(" %s:", pfield(NULL, 0));
623 pval(sndp->rx_compressed, sndc->rx_compressed);
624 printf(" %s:", pfield(NULL, 0));
625 pval(sndp->tx_compressed, sndc->tx_compressed);
626 printf(" %s:", pfield(NULL, 0));
627 pval(sndp->multicast, sndc->multicast);
628 printf(" speed:%u duplex:%u\n", sndc->speed, sndc->duplex);
633 ***************************************************************************
634 * Display network interfaces errors statistics in raw format.
637 * @a Activity structure with statistics.
638 * @timestr Time for current statistics sample.
639 * @curr Index in array for current sample statistics.
640 ***************************************************************************
642 __print_funct_t raw_print_net_edev_stats(struct activity *a, char *timestr, int curr)
645 struct stats_net_edev *snedc, *snedp, snedzero;
647 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
649 for (i = 0; i < a->nr; i++) {
651 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
653 if (!strcmp(snedc->interface, ""))
656 printf("%s %s:%s", timestr, pfield(a->hdr_line, FIRST), snedc->interface);
658 j = check_net_edev_reg(a, curr, !curr, i);
660 /* This is a newly registered interface. Previous stats are zero */
662 if (DISPLAY_HINTS(flags)) {
667 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
670 printf(" %s:", pfield(NULL, 0));
671 pval(snedp->rx_errors, snedc->rx_errors);
672 printf(" %s:", pfield(NULL, 0));
673 pval(snedp->tx_errors, snedc->tx_errors);
674 printf(" %s:", pfield(NULL, 0));
675 pval(snedp->collisions, snedc->collisions);
676 printf(" %s:", pfield(NULL, 0));
677 pval(snedp->rx_dropped, snedc->rx_dropped);
678 printf(" %s:", pfield(NULL, 0));
679 pval(snedp->tx_dropped, snedc->tx_dropped);
680 printf(" %s:", pfield(NULL, 0));
681 pval(snedp->tx_carrier_errors, snedc->tx_carrier_errors);
682 printf(" %s:", pfield(NULL, 0));
683 pval(snedp->rx_frame_errors, snedc->rx_frame_errors);
684 printf(" %s:", pfield(NULL, 0));
685 pval(snedp->rx_fifo_errors, snedc->rx_fifo_errors);
686 printf(" %s:", pfield(NULL, 0));
687 pval(snedp->tx_fifo_errors, snedc->tx_fifo_errors);
693 ***************************************************************************
694 * Display NFS client statistics in raw format.
697 * @a Activity structure with statistics.
698 * @timestr Time for current statistics sample.
699 * @curr Index in array for current sample statistics.
700 ***************************************************************************
702 __print_funct_t raw_print_net_nfs_stats(struct activity *a, char *timestr, int curr)
705 *snnc = (struct stats_net_nfs *) a->buf[curr],
706 *snnp = (struct stats_net_nfs *) a->buf[!curr];
708 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
709 pval(snnp->nfs_rpccnt, snnc->nfs_rpccnt);
710 printf(" %s:", pfield(NULL, 0));
711 pval(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans);
712 printf(" %s:", pfield(NULL, 0));
713 pval(snnp->nfs_readcnt, snnc->nfs_readcnt);
714 printf(" %s:", pfield(NULL, 0));
715 pval(snnp->nfs_writecnt, snnc->nfs_writecnt);
716 printf(" %s:", pfield(NULL, 0));
717 pval(snnp->nfs_accesscnt, snnc->nfs_accesscnt);
718 printf(" %s:", pfield(NULL, 0));
719 pval(snnp->nfs_getattcnt, snnc->nfs_getattcnt);
724 ***************************************************************************
725 * Display NFS server statistics in raw format.
728 * @a Activity structure with statistics.
729 * @timestr Time for current statistics sample.
730 * @curr Index in array for current sample statistics.
731 ***************************************************************************
733 __print_funct_t raw_print_net_nfsd_stats(struct activity *a, char *timestr, int curr)
735 struct stats_net_nfsd
736 *snndc = (struct stats_net_nfsd *) a->buf[curr],
737 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
739 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
740 pval(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt);
741 printf(" %s:", pfield(NULL, 0));
742 pval(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad);
743 printf(" %s:", pfield(NULL, 0));
744 pval(snndp->nfsd_netcnt, snndc->nfsd_netcnt);
745 printf(" %s:", pfield(NULL, 0));
746 pval(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt);
747 printf(" %s:", pfield(NULL, 0));
748 pval(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt);
749 printf(" %s:", pfield(NULL, 0));
750 pval(snndp->nfsd_rchits, snndc->nfsd_rchits);
751 printf(" %s:", pfield(NULL, 0));
752 pval(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses);
753 printf(" %s:", pfield(NULL, 0));
754 pval(snndp->nfsd_readcnt, snndc->nfsd_readcnt);
755 printf(" %s:", pfield(NULL, 0));
756 pval(snndp->nfsd_writecnt, snndc->nfsd_writecnt);
757 printf(" %s:", pfield(NULL, 0));
758 pval(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt);
759 printf(" %s:", pfield(NULL, 0));
760 pval(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt);
765 ***************************************************************************
766 * Display network socket statistics in raw format.
769 * @a Activity structure with statistics.
770 * @timestr Time for current statistics sample.
771 * @curr Index in array for current sample statistics.
772 ***************************************************************************
774 __print_funct_t raw_print_net_sock_stats(struct activity *a, char *timestr, int curr)
776 struct stats_net_sock
777 *snsc = (struct stats_net_sock *) a->buf[curr];
779 printf("%s %s:%u", timestr, pfield(a->hdr_line, FIRST), snsc->sock_inuse);
780 printf(" %s:%u", pfield(NULL, 0), snsc->tcp_inuse);
781 printf(" %s:%u", pfield(NULL, 0), snsc->udp_inuse);
782 printf(" %s:%u", pfield(NULL, 0), snsc->raw_inuse);
783 printf(" %s:%u", pfield(NULL, 0), snsc->frag_inuse);
784 printf(" %s:%u", pfield(NULL, 0), snsc->tcp_tw);
789 ***************************************************************************
790 * Display IP network statistics in raw format.
793 * @a Activity structure with statistics.
794 * @timestr Time for current statistics sample.
795 * @curr Index in array for current sample statistics.
796 ***************************************************************************
798 __print_funct_t raw_print_net_ip_stats(struct activity *a, char *timestr, int curr)
801 *snic = (struct stats_net_ip *) a->buf[curr],
802 *snip = (struct stats_net_ip *) a->buf[!curr];
804 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
805 pval(snip->InReceives, snic->InReceives);
806 printf(" %s:", pfield(NULL, 0));
807 pval(snip->ForwDatagrams, snic->ForwDatagrams);
808 printf(" %s:", pfield(NULL, 0));
809 pval(snip->InDelivers, snic->InDelivers);
810 printf(" %s:", pfield(NULL, 0));
811 pval(snip->OutRequests, snic->OutRequests);
812 printf(" %s:", pfield(NULL, 0));
813 pval(snip->ReasmReqds, snic->ReasmReqds);
814 printf(" %s:", pfield(NULL, 0));
815 pval(snip->ReasmOKs, snic->ReasmOKs);
816 printf(" %s:", pfield(NULL, 0));
817 pval(snip->FragOKs, snic->FragOKs);
818 printf(" %s:", pfield(NULL, 0));
819 pval(snip->FragCreates, snic->FragCreates);
824 ***************************************************************************
825 * Display IP network errors statistics in raw format.
828 * @a Activity structure with statistics.
829 * @timestr Time for current statistics sample.
830 * @curr Index in array for current sample statistics.
831 ***************************************************************************
833 __print_funct_t raw_print_net_eip_stats(struct activity *a, char *timestr, int curr)
836 *sneic = (struct stats_net_eip *) a->buf[curr],
837 *sneip = (struct stats_net_eip *) a->buf[!curr];
839 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
840 pval(sneip->InHdrErrors, sneic->InHdrErrors);
841 printf(" %s:", pfield(NULL, 0));
842 pval(sneip->InAddrErrors, sneic->InAddrErrors);
843 printf(" %s:", pfield(NULL, 0));
844 pval(sneip->InUnknownProtos, sneic->InUnknownProtos);
845 printf(" %s:", pfield(NULL, 0));
846 pval(sneip->InDiscards, sneic->InDiscards);
847 printf(" %s:", pfield(NULL, 0));
848 pval(sneip->OutDiscards, sneic->OutDiscards);
849 printf(" %s:", pfield(NULL, 0));
850 pval(sneip->OutNoRoutes, sneic->OutNoRoutes);
851 printf(" %s:", pfield(NULL, 0));
852 pval(sneip->ReasmFails, sneic->ReasmFails);
853 printf(" %s:", pfield(NULL, 0));
854 pval(sneip->FragFails, sneic->FragFails);
859 ***************************************************************************
860 * Display ICMP network statistics in raw format.
863 * @a Activity structure with statistics.
864 * @timestr Time for current statistics sample.
865 * @curr Index in array for current sample statistics.
866 ***************************************************************************
868 __print_funct_t raw_print_net_icmp_stats(struct activity *a, char *timestr, int curr)
870 struct stats_net_icmp
871 *snic = (struct stats_net_icmp *) a->buf[curr],
872 *snip = (struct stats_net_icmp *) a->buf[!curr];
874 printf("%s %s:", timestr, pfield(a->hdr_line, FIRST));
875 pval((unsigned long long) snip->InMsgs, (unsigned long long) snic->InMsgs);
876 printf(" %s:", pfield(NULL, 0));
877 pval((unsigned long long) snip->OutMsgs, (unsigned long long) snic->OutMsgs);
878 printf(" %s:", pfield(NULL, 0));
879 pval((unsigned long long) snip->InEchos, (unsigned long long) snic->InEchos);
880 printf(" %s:", pfield(NULL, 0));
881 pval((unsigned long long) snip->InEchoReps, (unsigned long long) snic->InEchoReps);
882 printf(" %s:", pfield(NULL, 0));
883 pval((unsigned long long) snip->OutEchos, (unsigned long long) snic->OutEchos);
884 printf(" %s:", pfield(NULL, 0));
885 pval((unsigned long long) snip->OutEchoReps, (unsigned long long) snic->OutEchoReps);
886 printf(" %s:", pfield(NULL, 0));
887 pval((unsigned long long) snip->InTimestamps, (unsigned long long) snic->InTimestamps);
888 printf(" %s:", pfield(NULL, 0));
889 pval((unsigned long long) snip->InTimestampReps, (unsigned long long) snic->InTimestampReps);
890 printf(" %s:", pfield(NULL, 0));
891 pval((unsigned long long) snip->OutTimestamps, (unsigned long long) snic->OutTimestamps);
892 printf(" %s:", pfield(NULL, 0));
893 pval((unsigned long long) snip->OutTimestampReps, (unsigned long long) snic->OutTimestampReps);
894 printf(" %s:", pfield(NULL, 0));
895 pval((unsigned long long) snip->InAddrMasks, (unsigned long long) snic->InAddrMasks);
896 printf(" %s:", pfield(NULL, 0));
897 pval((unsigned long long) snip->InAddrMaskReps, (unsigned long long) snic->InAddrMaskReps);
898 printf(" %s:", pfield(NULL, 0));
899 pval((unsigned long long) snip->OutAddrMasks, (unsigned long long) snic->OutAddrMasks);
900 printf(" %s:", pfield(NULL, 0));
901 pval((unsigned long long) snip->OutAddrMaskReps, (unsigned long long) snic->OutAddrMaskReps);