2 * raw_stats.c: Functions used by sar to display statistics in raw format.
3 * (C) 1999-2019 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
29 #include "raw_stats.h"
31 extern unsigned int flags;
34 ***************************************************************************
35 * Display current field name.
38 * @hdr_line On the first call, complete header line, containing all the
39 * metric names. In each subsequent call, must be NULL.
40 * @pos Index in @hdr_line string, 0 being the first one (headers
41 * are delimited by the '|' character).
44 * Pointer on string containing field name.
45 ***************************************************************************
47 char *pfield(char *hdr_line, int pos)
49 char hline[HEADER_LINE_LEN] = "";
50 static char field[HEADER_LINE_LEN] = "";
56 strncpy(hline, hdr_line, sizeof(hline) - 1);
57 hline[sizeof(hline) - 1] = '\0';
60 for (hl = strtok(hline, "|"); hl && (pos > 0); hl = strtok(NULL, "|"), pos--);
62 /* Bad @pos arg given to function */
66 if (strchr(hl, '&')) {
70 strncpy(field, hl, sizeof(field));
71 field[sizeof(field) - 1] = '\0';
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 if (DISPLAY_DEBUG_MODE(flags)) {
98 /* Field's value has decreased */
102 printf("; %llu; %llu;", valp, valc);
106 ***************************************************************************
107 * Display CPU statistics in raw format.
108 * Note: Values displayed for CPU "all" may slightly differ from those you
109 * would get if you were displaying them in pr_stats.c:print_cpu_stats().
110 * This is because values for CPU "all" are recalculated there as the sum of
111 * all individual CPU values (done by a call to get_global_cpu_statistics()
115 * @a Activity structure with statistics.
116 * @timestr Time for current statistics sample.
117 * @curr Index in array for current statistics sample.
118 ***************************************************************************
120 __print_funct_t raw_print_cpu_stats(struct activity *a, char *timestr, int curr)
123 struct stats_cpu *scc, *scp;
125 /* @nr[curr] cannot normally be greater than @nr_ini */
126 if (a->nr[curr] > a->nr_ini) {
127 a->nr_ini = a->nr[curr];
130 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
133 * The size of a->buf[...] CPU structure may be different from the default
134 * sizeof(struct stats_cpu) value if data have been read from a file!
135 * That's why we don't use a syntax like:
136 * scc = (struct stats_cpu *) a->buf[...] + i;
138 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
139 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
141 /* Should current CPU (including CPU "all") be displayed? */
142 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
146 /* Yes: Display it */
147 printf("%s; %s", timestr, pfield(a->hdr_line, DISPLAY_CPU_ALL(a->opt_flags)));
148 if (DISPLAY_DEBUG_MODE(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 */
162 printf("; %d;", i - 1);
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[curr]) && (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_dio, sic->dk_drive_dio);
343 printf(" %s", pfield(NULL, 0));
344 pval(sip->dk_drive_rblk, sic->dk_drive_rblk);
345 printf(" %s", pfield(NULL, 0));
346 pval(sip->dk_drive_wblk, sic->dk_drive_wblk);
347 printf(" %s", pfield(NULL, 0));
348 pval(sip->dk_drive_dblk, sic->dk_drive_dblk);
353 ***************************************************************************
354 * Display memory statistics in raw format.
357 * @a Activity structure with statistics.
358 * @timestr Time for current statistics sample.
359 * @curr Index in array for current sample statistics.
360 ***************************************************************************
362 __print_funct_t raw_print_memory_stats(struct activity *a, char *timestr, int curr)
365 *smc = (struct stats_memory *) a->buf[curr];
367 if (DISPLAY_MEMORY(a->opt_flags)) {
368 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frmkb);
369 printf(" %s; %llu;", pfield(NULL, 0), smc->availablekb);
370 printf(" kbttlmem; %llu;", smc->tlmkb);
371 pfield(NULL, 0); /* Skip kbmemused */
372 pfield(NULL, 0); /* Skip %memused */
373 printf(" %s; %llu;", pfield(NULL, 0), smc->bufkb);
374 printf(" %s; %llu;", pfield(NULL, 0), smc->camkb);
375 printf(" %s; %llu;", pfield(NULL, 0), smc->comkb);
376 pfield(NULL, 0); /* Skip %commit */
377 printf(" %s; %llu;", pfield(NULL, 0), smc->activekb);
378 printf(" %s; %llu;", pfield(NULL, 0), smc->inactkb);
379 printf(" %s; %llu;", pfield(NULL, 0), smc->dirtykb);
381 if (DISPLAY_MEM_ALL(a->opt_flags)) {
382 printf(" %s; %llu;", pfield(NULL, 0), smc->anonpgkb);
383 printf(" %s; %llu;", pfield(NULL, 0), smc->slabkb);
384 printf(" %s; %llu;", pfield(NULL, 0), smc->kstackkb);
385 printf(" %s; %llu;", pfield(NULL, 0), smc->pgtblkb);
386 printf(" %s; %llu;", pfield(NULL, 0), smc->vmusedkb);
391 if (DISPLAY_SWAP(a->opt_flags)) {
392 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, SECOND), smc->frskb);
393 printf(" kbttlswp; %llu;", smc->tlskb);
394 pfield(NULL, 0); /* Skip kbswpused */
395 pfield(NULL, 0); /* Skip %swpused */
396 printf(" %s; %llu;", pfield(NULL, 0), smc->caskb);
402 ***************************************************************************
403 * Display kernel tables statistics in raw format.
406 * @a Activity structure with statistics.
407 * @timestr Time for current statistics sample.
408 * @curr Index in array for current sample statistics.
409 ***************************************************************************
411 __print_funct_t raw_print_ktables_stats(struct activity *a, char *timestr, int curr)
414 *skc = (struct stats_ktables *) a->buf[curr];
416 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), skc->dentry_stat);
417 printf(" %s; %llu;", pfield(NULL, 0), skc->file_used);
418 printf(" %s; %llu;", pfield(NULL, 0), skc->inode_used);
419 printf(" %s; %llu;", pfield(NULL, 0), skc->pty_nr);
424 ***************************************************************************
425 * Display queue and load statistics in raw format.
428 * @a Activity structure with statistics.
429 * @timestr Time for current statistics sample.
430 * @curr Index in array for current sample statistics.
431 ***************************************************************************
433 __print_funct_t raw_print_queue_stats(struct activity *a, char *timestr, int curr)
436 *sqc = (struct stats_queue *) a->buf[curr];
438 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), sqc->nr_running);
439 printf(" %s; %llu;", pfield(NULL, 0), sqc->nr_threads);
440 printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_1);
441 printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_5);
442 printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_15);
443 printf(" %s; %llu;", pfield(NULL, 0), sqc->procs_blocked);
448 ***************************************************************************
449 * Display serial lines statistics in raw format.
452 * @a Activity structure with statistics.
453 * @timestr Time for current statistics sample.
454 * @curr Index in array for current sample statistics.
455 ***************************************************************************
457 __print_funct_t raw_print_serial_stats(struct activity *a, char *timestr, int curr)
460 struct stats_serial *ssc, *ssp;
462 for (i = 0; i < a->nr[curr]; i++) {
465 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
467 if (a->nr[!curr] > 0) {
469 /* Look for corresponding serial line in previous iteration */
472 if (j >= a->nr[!curr]) {
473 j = a->nr[!curr] - 1;
479 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + j * a->msize);
480 if (ssc->line == ssp->line) {
484 if (++j >= a->nr[!curr]) {
491 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
492 if (!found && DISPLAY_DEBUG_MODE(flags)) {
495 printf("; %u;", ssc->line);
501 printf(" %s", pfield(NULL, 0));
502 pval((unsigned long long) ssp->rx, (unsigned long long)ssc->rx);
503 printf(" %s", pfield(NULL, 0));
504 pval((unsigned long long) ssp->tx, (unsigned long long) ssc->tx);
505 printf(" %s", pfield(NULL, 0));
506 pval((unsigned long long) ssp->frame, (unsigned long long) ssc->frame);
507 printf(" %s", pfield(NULL, 0));
508 pval((unsigned long long) ssp->parity, (unsigned long long) ssc->parity);
509 printf(" %s", pfield(NULL, 0));
510 pval((unsigned long long) ssp->brk, (unsigned long long) ssc->brk);
511 printf(" %s", pfield(NULL, 0));
512 pval((unsigned long long) ssp->overrun, (unsigned long long) ssc->overrun);
518 ***************************************************************************
519 * Display disks statistics in raw format.
522 * @a Activity structure with statistics.
523 * @timestr Time for current statistics sample.
524 * @curr Index in array for current sample statistics.
525 ***************************************************************************
527 __print_funct_t raw_print_disk_stats(struct activity *a, char *timestr, int curr)
530 struct stats_disk *sdc, *sdp, sdpzero;
533 memset(&sdpzero, 0, STATS_DISK_SIZE);
535 for (i = 0; i < a->nr[curr]; i++) {
537 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
539 /* Get device name */
540 dev_name = get_sa_devname(sdc->major, sdc->minor,
541 sdc->wwn, sdc->part_nr, flags);
543 if (a->item_list != NULL) {
544 /* A list of devices has been entered on the command line */
545 if (!search_list_item(a->item_list, dev_name))
546 /* Device not found */
550 printf("%s; major; %u; minor; %u; %s",
551 timestr, sdc->major, sdc->minor, pfield(a->hdr_line, FIRST));
553 j = check_disk_reg(a, curr, !curr, i);
555 /* This is a newly registered interface. Previous stats are zero */
557 if (DISPLAY_DEBUG_MODE(flags)) {
558 printf(" [%s]", j == -1 ? "NEW" : "BCK");
562 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
565 printf("; %s;", dev_name);
566 printf(" %s", pfield(NULL, 0));
567 pval(sdp->nr_ios, sdc->nr_ios);
568 printf(" %s", pfield(NULL, 0));
569 pval((unsigned long long) sdp->rd_sect, (unsigned long long) sdc->rd_sect);
570 printf(" %s", pfield(NULL, 0));
571 pval((unsigned long long) sdp->wr_sect, (unsigned long long) sdc->wr_sect);
572 printf(" %s", pfield(NULL, 0));
573 pval((unsigned long long) sdp->dc_sect, (unsigned long long) sdc->dc_sect);
575 pval((unsigned long long) sdp->rd_ticks, (unsigned long long) sdc->rd_ticks);
577 pval((unsigned long long) sdp->wr_ticks, (unsigned long long) sdc->wr_ticks);
579 pval((unsigned long long) sdp->dc_ticks, (unsigned long long) sdc->dc_ticks);
580 printf(" tot_ticks");
581 pval((unsigned long long) sdp->tot_ticks, (unsigned long long) sdc->tot_ticks);
582 pfield(NULL, 0); /* Skip areq-sz */
583 printf(" %s", pfield(NULL, 0));
584 pval((unsigned long long) sdp->rq_ticks, (unsigned long long) sdc->rq_ticks);
590 ***************************************************************************
591 * Display network interfaces statistics in raw format.
594 * @a Activity structure with statistics.
595 * @timestr Time for current statistics sample.
596 * @curr Index in array for current sample statistics.
597 ***************************************************************************
599 __print_funct_t raw_print_net_dev_stats(struct activity *a, char *timestr, int curr)
602 struct stats_net_dev *sndc, *sndp, sndzero;
604 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
606 for (i = 0; i < a->nr[curr]; i++) {
608 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
610 if (a->item_list != NULL) {
611 /* A list of devices has been entered on the command line */
612 if (!search_list_item(a->item_list, sndc->interface))
613 /* Device not found */
617 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
618 j = check_net_dev_reg(a, curr, !curr, i);
620 /* This is a newly registered interface. Previous stats are zero */
622 if (DISPLAY_DEBUG_MODE(flags)) {
623 printf(" [%s]", j == -1 ? "NEW" : "BCK");
627 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
629 printf("; %s;", sndc->interface);
631 printf(" %s", pfield(NULL, 0));
632 pval(sndp->rx_packets, sndc->rx_packets);
633 printf(" %s", pfield(NULL, 0));
634 pval(sndp->tx_packets, sndc->tx_packets);
635 printf(" %s", pfield(NULL, 0));
636 pval(sndp->rx_bytes, sndc->rx_bytes);
637 printf(" %s", pfield(NULL, 0));
638 pval(sndp->tx_bytes, sndc->tx_bytes);
639 printf(" %s", pfield(NULL, 0));
640 pval(sndp->rx_compressed, sndc->rx_compressed);
641 printf(" %s", pfield(NULL, 0));
642 pval(sndp->tx_compressed, sndc->tx_compressed);
643 printf(" %s", pfield(NULL, 0));
644 pval(sndp->multicast, sndc->multicast);
645 printf(" speed; %u; duplex; %u;\n", sndc->speed, sndc->duplex);
650 ***************************************************************************
651 * Display network interfaces errors statistics in raw format.
654 * @a Activity structure with statistics.
655 * @timestr Time for current statistics sample.
656 * @curr Index in array for current sample statistics.
657 ***************************************************************************
659 __print_funct_t raw_print_net_edev_stats(struct activity *a, char *timestr, int curr)
662 struct stats_net_edev *snedc, *snedp, snedzero;
664 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
666 for (i = 0; i < a->nr[curr]; i++) {
668 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
670 if (a->item_list != NULL) {
671 /* A list of devices has been entered on the command line */
672 if (!search_list_item(a->item_list, snedc->interface))
673 /* Device not found */
677 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
678 j = check_net_edev_reg(a, curr, !curr, i);
680 /* This is a newly registered interface. Previous stats are zero */
682 if (DISPLAY_DEBUG_MODE(flags)) {
683 printf(" [%s]", j == -1 ? "NEW" : "BCK");
687 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
689 printf("; %s;", snedc->interface);
691 printf(" %s", pfield(NULL, 0));
692 pval(snedp->rx_errors, snedc->rx_errors);
693 printf(" %s", pfield(NULL, 0));
694 pval(snedp->tx_errors, snedc->tx_errors);
695 printf(" %s", pfield(NULL, 0));
696 pval(snedp->collisions, snedc->collisions);
697 printf(" %s", pfield(NULL, 0));
698 pval(snedp->rx_dropped, snedc->rx_dropped);
699 printf(" %s", pfield(NULL, 0));
700 pval(snedp->tx_dropped, snedc->tx_dropped);
701 printf(" %s", pfield(NULL, 0));
702 pval(snedp->tx_carrier_errors, snedc->tx_carrier_errors);
703 printf(" %s", pfield(NULL, 0));
704 pval(snedp->rx_frame_errors, snedc->rx_frame_errors);
705 printf(" %s", pfield(NULL, 0));
706 pval(snedp->rx_fifo_errors, snedc->rx_fifo_errors);
707 printf(" %s", pfield(NULL, 0));
708 pval(snedp->tx_fifo_errors, snedc->tx_fifo_errors);
714 ***************************************************************************
715 * Display NFS client statistics in raw format.
718 * @a Activity structure with statistics.
719 * @timestr Time for current statistics sample.
720 * @curr Index in array for current sample statistics.
721 ***************************************************************************
723 __print_funct_t raw_print_net_nfs_stats(struct activity *a, char *timestr, int curr)
726 *snnc = (struct stats_net_nfs *) a->buf[curr],
727 *snnp = (struct stats_net_nfs *) a->buf[!curr];
729 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
730 pval((unsigned long long) snnp->nfs_rpccnt, (unsigned long long) snnc->nfs_rpccnt);
731 printf(" %s", pfield(NULL, 0));
732 pval((unsigned long long) snnp->nfs_rpcretrans, (unsigned long long) snnc->nfs_rpcretrans);
733 printf(" %s", pfield(NULL, 0));
734 pval((unsigned long long) snnp->nfs_readcnt, (unsigned long long) snnc->nfs_readcnt);
735 printf(" %s", pfield(NULL, 0));
736 pval((unsigned long long) snnp->nfs_writecnt, (unsigned long long) snnc->nfs_writecnt);
737 printf(" %s", pfield(NULL, 0));
738 pval((unsigned long long) snnp->nfs_accesscnt, (unsigned long long) snnc->nfs_accesscnt);
739 printf(" %s", pfield(NULL, 0));
740 pval((unsigned long long) snnp->nfs_getattcnt, (unsigned long long) snnc->nfs_getattcnt);
745 ***************************************************************************
746 * Display NFS server statistics in raw format.
749 * @a Activity structure with statistics.
750 * @timestr Time for current statistics sample.
751 * @curr Index in array for current sample statistics.
752 ***************************************************************************
754 __print_funct_t raw_print_net_nfsd_stats(struct activity *a, char *timestr, int curr)
756 struct stats_net_nfsd
757 *snndc = (struct stats_net_nfsd *) a->buf[curr],
758 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
760 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
761 pval((unsigned long long) snndp->nfsd_rpccnt, (unsigned long long) snndc->nfsd_rpccnt);
762 printf(" %s", pfield(NULL, 0));
763 pval((unsigned long long) snndp->nfsd_rpcbad, (unsigned long long) snndc->nfsd_rpcbad);
764 printf(" %s", pfield(NULL, 0));
765 pval((unsigned long long) snndp->nfsd_netcnt, (unsigned long long) snndc->nfsd_netcnt);
766 printf(" %s", pfield(NULL, 0));
767 pval((unsigned long long) snndp->nfsd_netudpcnt, (unsigned long long) snndc->nfsd_netudpcnt);
768 printf(" %s", pfield(NULL, 0));
769 pval((unsigned long long) snndp->nfsd_nettcpcnt, (unsigned long long) snndc->nfsd_nettcpcnt);
770 printf(" %s", pfield(NULL, 0));
771 pval((unsigned long long) snndp->nfsd_rchits, (unsigned long long) snndc->nfsd_rchits);
772 printf(" %s", pfield(NULL, 0));
773 pval((unsigned long long) snndp->nfsd_rcmisses, (unsigned long long) snndc->nfsd_rcmisses);
774 printf(" %s", pfield(NULL, 0));
775 pval((unsigned long long) snndp->nfsd_readcnt, (unsigned long long) snndc->nfsd_readcnt);
776 printf(" %s", pfield(NULL, 0));
777 pval((unsigned long long) snndp->nfsd_writecnt, (unsigned long long) snndc->nfsd_writecnt);
778 printf(" %s", pfield(NULL, 0));
779 pval((unsigned long long) snndp->nfsd_accesscnt, (unsigned long long) snndc->nfsd_accesscnt);
780 printf(" %s", pfield(NULL, 0));
781 pval((unsigned long long) snndp->nfsd_getattcnt, (unsigned long long) snndc->nfsd_getattcnt);
786 ***************************************************************************
787 * Display network socket statistics in raw format.
790 * @a Activity structure with statistics.
791 * @timestr Time for current statistics sample.
792 * @curr Index in array for current sample statistics.
793 ***************************************************************************
795 __print_funct_t raw_print_net_sock_stats(struct activity *a, char *timestr, int curr)
797 struct stats_net_sock
798 *snsc = (struct stats_net_sock *) a->buf[curr];
800 printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->sock_inuse);
801 printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_inuse);
802 printf(" %s; %u;", pfield(NULL, 0), snsc->udp_inuse);
803 printf(" %s; %u;", pfield(NULL, 0), snsc->raw_inuse);
804 printf(" %s; %u;", pfield(NULL, 0), snsc->frag_inuse);
805 printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_tw);
810 ***************************************************************************
811 * Display IP network statistics in raw format.
814 * @a Activity structure with statistics.
815 * @timestr Time for current statistics sample.
816 * @curr Index in array for current sample statistics.
817 ***************************************************************************
819 __print_funct_t raw_print_net_ip_stats(struct activity *a, char *timestr, int curr)
822 *snic = (struct stats_net_ip *) a->buf[curr],
823 *snip = (struct stats_net_ip *) a->buf[!curr];
825 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
826 pval(snip->InReceives, snic->InReceives);
827 printf(" %s", pfield(NULL, 0));
828 pval(snip->ForwDatagrams, snic->ForwDatagrams);
829 printf(" %s", pfield(NULL, 0));
830 pval(snip->InDelivers, snic->InDelivers);
831 printf(" %s", pfield(NULL, 0));
832 pval(snip->OutRequests, snic->OutRequests);
833 printf(" %s", pfield(NULL, 0));
834 pval(snip->ReasmReqds, snic->ReasmReqds);
835 printf(" %s", pfield(NULL, 0));
836 pval(snip->ReasmOKs, snic->ReasmOKs);
837 printf(" %s", pfield(NULL, 0));
838 pval(snip->FragOKs, snic->FragOKs);
839 printf(" %s", pfield(NULL, 0));
840 pval(snip->FragCreates, snic->FragCreates);
845 ***************************************************************************
846 * Display IP network errors statistics in raw format.
849 * @a Activity structure with statistics.
850 * @timestr Time for current statistics sample.
851 * @curr Index in array for current sample statistics.
852 ***************************************************************************
854 __print_funct_t raw_print_net_eip_stats(struct activity *a, char *timestr, int curr)
857 *sneic = (struct stats_net_eip *) a->buf[curr],
858 *sneip = (struct stats_net_eip *) a->buf[!curr];
860 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
861 pval(sneip->InHdrErrors, sneic->InHdrErrors);
862 printf(" %s", pfield(NULL, 0));
863 pval(sneip->InAddrErrors, sneic->InAddrErrors);
864 printf(" %s", pfield(NULL, 0));
865 pval(sneip->InUnknownProtos, sneic->InUnknownProtos);
866 printf(" %s", pfield(NULL, 0));
867 pval(sneip->InDiscards, sneic->InDiscards);
868 printf(" %s", pfield(NULL, 0));
869 pval(sneip->OutDiscards, sneic->OutDiscards);
870 printf(" %s", pfield(NULL, 0));
871 pval(sneip->OutNoRoutes, sneic->OutNoRoutes);
872 printf(" %s", pfield(NULL, 0));
873 pval(sneip->ReasmFails, sneic->ReasmFails);
874 printf(" %s", pfield(NULL, 0));
875 pval(sneip->FragFails, sneic->FragFails);
880 ***************************************************************************
881 * Display ICMP network statistics in raw format.
884 * @a Activity structure with statistics.
885 * @timestr Time for current statistics sample.
886 * @curr Index in array for current sample statistics.
887 ***************************************************************************
889 __print_funct_t raw_print_net_icmp_stats(struct activity *a, char *timestr, int curr)
891 struct stats_net_icmp
892 *snic = (struct stats_net_icmp *) a->buf[curr],
893 *snip = (struct stats_net_icmp *) a->buf[!curr];
895 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
896 pval((unsigned long long) snip->InMsgs, (unsigned long long) snic->InMsgs);
897 printf(" %s", pfield(NULL, 0));
898 pval((unsigned long long) snip->OutMsgs, (unsigned long long) snic->OutMsgs);
899 printf(" %s", pfield(NULL, 0));
900 pval((unsigned long long) snip->InEchos, (unsigned long long) snic->InEchos);
901 printf(" %s", pfield(NULL, 0));
902 pval((unsigned long long) snip->InEchoReps, (unsigned long long) snic->InEchoReps);
903 printf(" %s", pfield(NULL, 0));
904 pval((unsigned long long) snip->OutEchos, (unsigned long long) snic->OutEchos);
905 printf(" %s", pfield(NULL, 0));
906 pval((unsigned long long) snip->OutEchoReps, (unsigned long long) snic->OutEchoReps);
907 printf(" %s", pfield(NULL, 0));
908 pval((unsigned long long) snip->InTimestamps, (unsigned long long) snic->InTimestamps);
909 printf(" %s", pfield(NULL, 0));
910 pval((unsigned long long) snip->InTimestampReps, (unsigned long long) snic->InTimestampReps);
911 printf(" %s", pfield(NULL, 0));
912 pval((unsigned long long) snip->OutTimestamps, (unsigned long long) snic->OutTimestamps);
913 printf(" %s", pfield(NULL, 0));
914 pval((unsigned long long) snip->OutTimestampReps, (unsigned long long) snic->OutTimestampReps);
915 printf(" %s", pfield(NULL, 0));
916 pval((unsigned long long) snip->InAddrMasks, (unsigned long long) snic->InAddrMasks);
917 printf(" %s", pfield(NULL, 0));
918 pval((unsigned long long) snip->InAddrMaskReps, (unsigned long long) snic->InAddrMaskReps);
919 printf(" %s", pfield(NULL, 0));
920 pval((unsigned long long) snip->OutAddrMasks, (unsigned long long) snic->OutAddrMasks);
921 printf(" %s", pfield(NULL, 0));
922 pval((unsigned long long) snip->OutAddrMaskReps, (unsigned long long) snic->OutAddrMaskReps);
927 ***************************************************************************
928 * Display ICMP errors message statistics in raw format.
931 * @a Activity structure with statistics.
932 * @timestr Time for current statistics sample.
933 * @curr Index in array for current sample statistics.
934 ***************************************************************************
936 __print_funct_t raw_print_net_eicmp_stats(struct activity *a, char *timestr, int curr)
938 struct stats_net_eicmp
939 *sneic = (struct stats_net_eicmp *) a->buf[curr],
940 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
942 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
943 pval((unsigned long long) sneip->InErrors, (unsigned long long) sneic->InErrors);
944 printf(" %s", pfield(NULL, 0));
945 pval((unsigned long long) sneip->OutErrors, (unsigned long long) sneic->OutErrors);
946 printf(" %s", pfield(NULL, 0));
947 pval((unsigned long long) sneip->InDestUnreachs, (unsigned long long) sneic->InDestUnreachs);
948 printf(" %s", pfield(NULL, 0));
949 pval((unsigned long long) sneip->OutDestUnreachs, (unsigned long long) sneic->OutDestUnreachs);
950 printf(" %s", pfield(NULL, 0));
951 pval((unsigned long long) sneip->InTimeExcds, (unsigned long long) sneic->InTimeExcds);
952 printf(" %s", pfield(NULL, 0));
953 pval((unsigned long long) sneip->OutTimeExcds, (unsigned long long) sneic->OutTimeExcds);
954 printf(" %s", pfield(NULL, 0));
955 pval((unsigned long long) sneip->InParmProbs, (unsigned long long) sneic->InParmProbs);
956 printf(" %s", pfield(NULL, 0));
957 pval((unsigned long long) sneip->OutParmProbs, (unsigned long long) sneic->OutParmProbs);
958 printf(" %s", pfield(NULL, 0));
959 pval((unsigned long long) sneip->InSrcQuenchs, (unsigned long long) sneic->InSrcQuenchs);
960 printf(" %s", pfield(NULL, 0));
961 pval((unsigned long long) sneip->OutSrcQuenchs, (unsigned long long) sneic->OutSrcQuenchs);
962 printf(" %s", pfield(NULL, 0));
963 pval((unsigned long long) sneip->InRedirects, (unsigned long long) sneic->InRedirects);
964 printf(" %s", pfield(NULL, 0));
965 pval((unsigned long long) sneip->OutRedirects, (unsigned long long) sneic->OutRedirects);
970 ***************************************************************************
971 * Display TCP network statistics in raw format.
974 * @a Activity structure with statistics.
975 * @timestr Time for current statistics sample.
976 * @curr Index in array for current sample statistics.
977 ***************************************************************************
979 __print_funct_t raw_print_net_tcp_stats(struct activity *a, char *timestr, int curr)
982 *sntc = (struct stats_net_tcp *) a->buf[curr],
983 *sntp = (struct stats_net_tcp *) a->buf[!curr];
985 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
986 pval((unsigned long long) sntp->ActiveOpens, (unsigned long long) sntc->ActiveOpens);
987 printf(" %s", pfield(NULL, 0));
988 pval((unsigned long long) sntp->PassiveOpens, (unsigned long long) sntc->PassiveOpens);
989 printf(" %s", pfield(NULL, 0));
990 pval((unsigned long long) sntp->InSegs, (unsigned long long) sntc->InSegs);
991 printf(" %s", pfield(NULL, 0));
992 pval((unsigned long long) sntp->OutSegs, (unsigned long long) sntc->OutSegs);
997 ***************************************************************************
998 * Display TCP network errors statistics in raw format.
1001 * @a Activity structure with statistics.
1002 * @timestr Time for current statistics sample.
1003 * @curr Index in array for current sample statistics.
1004 ***************************************************************************
1006 __print_funct_t raw_print_net_etcp_stats(struct activity *a, char *timestr, int curr)
1008 struct stats_net_etcp
1009 *snetc = (struct stats_net_etcp *) a->buf[curr],
1010 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1012 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1013 pval((unsigned long long) snetp->AttemptFails, (unsigned long long) snetc->AttemptFails);
1014 printf(" %s", pfield(NULL, 0));
1015 pval((unsigned long long) snetp->EstabResets, (unsigned long long) snetc->EstabResets);
1016 printf(" %s", pfield(NULL, 0));
1017 pval((unsigned long long) snetp->RetransSegs, (unsigned long long) snetc->RetransSegs);
1018 printf(" %s", pfield(NULL, 0));
1019 pval((unsigned long long) snetp->InErrs, (unsigned long long) snetc->InErrs);
1020 printf(" %s", pfield(NULL, 0));
1021 pval((unsigned long long) snetp->OutRsts, (unsigned long long) snetc->OutRsts);
1026 ***************************************************************************
1027 * Display UDP network statistics in raw format.
1030 * @a Activity structure with statistics.
1031 * @timestr Time for current statistics sample.
1032 * @curr Index in array for current sample statistics.
1033 ***************************************************************************
1035 __print_funct_t raw_print_net_udp_stats(struct activity *a, char *timestr, int curr)
1037 struct stats_net_udp
1038 *snuc = (struct stats_net_udp *) a->buf[curr],
1039 *snup = (struct stats_net_udp *) a->buf[!curr];
1041 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1042 pval((unsigned long long) snup->InDatagrams, (unsigned long long) snuc->InDatagrams);
1043 printf(" %s", pfield(NULL, 0));
1044 pval((unsigned long long) snup->OutDatagrams, (unsigned long long) snuc->OutDatagrams);
1045 printf(" %s", pfield(NULL, 0));
1046 pval((unsigned long long) snup->NoPorts, (unsigned long long) snuc->NoPorts);
1047 printf(" %s", pfield(NULL, 0));
1048 pval((unsigned long long) snup->InErrors, (unsigned long long) snuc->InErrors);
1053 ***************************************************************************
1054 * Display IPv6 network socket statistics in raw format.
1057 * @a Activity structure with statistics.
1058 * @timestr Time for current statistics sample.
1059 * @curr Index in array for current sample statistics.
1060 ***************************************************************************
1062 __print_funct_t raw_print_net_sock6_stats(struct activity *a, char *timestr, int curr)
1064 struct stats_net_sock6
1065 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1067 printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->tcp6_inuse);
1068 printf(" %s; %u;", pfield(NULL, 0), snsc->udp6_inuse);
1069 printf(" %s; %u;", pfield(NULL, 0), snsc->raw6_inuse);
1070 printf(" %s; %u;", pfield(NULL, 0), snsc->frag6_inuse);
1075 ***************************************************************************
1076 * Display IPv6 network statistics in raw format.
1079 * @a Activity structure with statistics.
1080 * @timestr Time for current statistics sample.
1081 * @curr Index in array for current sample statistics.
1082 ***************************************************************************
1084 __print_funct_t raw_print_net_ip6_stats(struct activity *a, char *timestr, int curr)
1086 struct stats_net_ip6
1087 *snic = (struct stats_net_ip6 *) a->buf[curr],
1088 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1090 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1091 pval(snip->InReceives6, snic->InReceives6);
1092 printf(" %s", pfield(NULL, 0));
1093 pval(snip->OutForwDatagrams6, snic->OutForwDatagrams6);
1094 printf(" %s", pfield(NULL, 0));
1095 pval(snip->InDelivers6, snic->InDelivers6);
1096 printf(" %s", pfield(NULL, 0));
1097 pval(snip->OutRequests6, snic->OutRequests6);
1098 printf(" %s", pfield(NULL, 0));
1099 pval(snip->ReasmReqds6, snic->ReasmReqds6);
1100 printf(" %s", pfield(NULL, 0));
1101 pval(snip->ReasmOKs6, snic->ReasmOKs6);
1102 printf(" %s", pfield(NULL, 0));
1103 pval(snip->InMcastPkts6, snic->InMcastPkts6);
1104 printf(" %s", pfield(NULL, 0));
1105 pval(snip->OutMcastPkts6, snic->OutMcastPkts6);
1106 printf(" %s", pfield(NULL, 0));
1107 pval(snip->FragOKs6, snic->FragOKs6);
1108 printf(" %s", pfield(NULL, 0));
1109 pval(snip->FragCreates6, snic->FragCreates6);
1114 ***************************************************************************
1115 * Display IPv6 network errors statistics in raw format.
1118 * @a Activity structure with statistics.
1119 * @timestr Time for current statistics sample.
1120 * @curr Index in array for current sample statistics.
1121 ***************************************************************************
1123 __print_funct_t raw_print_net_eip6_stats(struct activity *a, char *timestr, int curr)
1125 struct stats_net_eip6
1126 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1127 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1129 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1130 pval(sneip->InHdrErrors6, sneic->InHdrErrors6);
1131 printf(" %s", pfield(NULL, 0));
1132 pval(sneip->InAddrErrors6, sneic->InAddrErrors6);
1133 printf(" %s", pfield(NULL, 0));
1134 pval(sneip->InUnknownProtos6, sneic->InUnknownProtos6);
1135 printf(" %s", pfield(NULL, 0));
1136 pval(sneip->InTooBigErrors6, sneic->InTooBigErrors6);
1137 printf(" %s", pfield(NULL, 0));
1138 pval(sneip->InDiscards6, sneic->InDiscards6);
1139 printf(" %s", pfield(NULL, 0));
1140 pval(sneip->OutDiscards6, sneic->OutDiscards6);
1141 printf(" %s", pfield(NULL, 0));
1142 pval(sneip->InNoRoutes6, sneic->InNoRoutes6);
1143 printf(" %s", pfield(NULL, 0));
1144 pval(sneip->OutNoRoutes6, sneic->OutNoRoutes6);
1145 printf(" %s", pfield(NULL, 0));
1146 pval(sneip->ReasmFails6, sneic->ReasmFails6);
1147 printf(" %s", pfield(NULL, 0));
1148 pval(sneip->FragFails6, sneic->FragFails6);
1149 printf(" %s", pfield(NULL, 0));
1150 pval(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6);
1155 ***************************************************************************
1156 * Display ICMPv6 network statistics in raw format.
1159 * @a Activity structure with statistics.
1160 * @timestr Time for current statistics sample.
1161 * @curr Index in array for current sample statistics.
1162 ***************************************************************************
1164 __print_funct_t raw_print_net_icmp6_stats(struct activity *a, char *timestr, int curr)
1166 struct stats_net_icmp6
1167 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1168 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1170 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1171 pval((unsigned long long) snip->InMsgs6,
1172 (unsigned long long) snic->InMsgs6);
1173 printf(" %s", pfield(NULL, 0));
1174 pval((unsigned long long) snip->OutMsgs6,
1175 (unsigned long long) snic->OutMsgs6);
1176 printf(" %s", pfield(NULL, 0));
1177 pval((unsigned long long) snip->InEchos6,
1178 (unsigned long long) snic->InEchos6);
1179 printf(" %s", pfield(NULL, 0));
1180 pval((unsigned long long) snip->InEchoReplies6,
1181 (unsigned long long) snic->InEchoReplies6);
1182 printf(" %s", pfield(NULL, 0));
1183 pval((unsigned long long) snip->OutEchoReplies6,
1184 (unsigned long long) snic->OutEchoReplies6);
1185 printf(" %s", pfield(NULL, 0));
1186 pval((unsigned long long) snip->InGroupMembQueries6,
1187 (unsigned long long) snic->InGroupMembQueries6);
1188 printf(" %s", pfield(NULL, 0));
1189 pval((unsigned long long) snip->InGroupMembResponses6,
1190 (unsigned long long) snic->InGroupMembResponses6);
1191 printf(" %s", pfield(NULL, 0));
1192 pval((unsigned long long) snip->OutGroupMembResponses6,
1193 (unsigned long long) snic->OutGroupMembResponses6);
1194 printf(" %s", pfield(NULL, 0));
1195 pval((unsigned long long) snip->InGroupMembReductions6,
1196 (unsigned long long) snic->InGroupMembReductions6);
1197 printf(" %s", pfield(NULL, 0));
1198 pval((unsigned long long) snip->OutGroupMembReductions6,
1199 (unsigned long long) snic->OutGroupMembReductions6);
1200 printf(" %s", pfield(NULL, 0));
1201 pval((unsigned long long) snip->InRouterSolicits6,
1202 (unsigned long long) snic->InRouterSolicits6);
1203 printf(" %s", pfield(NULL, 0));
1204 pval((unsigned long long) snip->OutRouterSolicits6,
1205 (unsigned long long) snic->OutRouterSolicits6);
1206 printf(" %s", pfield(NULL, 0));
1207 pval((unsigned long long) snip->InRouterAdvertisements6,
1208 (unsigned long long) snic->InRouterAdvertisements6);
1209 printf(" %s", pfield(NULL, 0));
1210 pval((unsigned long long) snip->InNeighborSolicits6,
1211 (unsigned long long) snic->InNeighborSolicits6);
1212 printf(" %s", pfield(NULL, 0));
1213 pval((unsigned long long) snip->OutNeighborSolicits6,
1214 (unsigned long long) snic->OutNeighborSolicits6);
1215 printf(" %s", pfield(NULL, 0));
1216 pval((unsigned long long) snip->InNeighborAdvertisements6,
1217 (unsigned long long) snic->InNeighborAdvertisements6);
1218 printf(" %s", pfield(NULL, 0));
1219 pval((unsigned long long) snip->OutNeighborAdvertisements6,
1220 (unsigned long long) snic->OutNeighborAdvertisements6);
1225 ***************************************************************************
1226 * Display ICMPv6 error messages statistics in rw format.
1229 * @a Activity structure with statistics.
1230 * @timestr Time for current statistics sample.
1231 * @curr Index in array for current sample statistics.
1232 ***************************************************************************
1234 __print_funct_t raw_print_net_eicmp6_stats(struct activity *a, char *timestr, int curr)
1236 struct stats_net_eicmp6
1237 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1238 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1240 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1241 pval((unsigned long long) sneip->InErrors6, (unsigned long long) sneic->InErrors6);
1242 printf(" %s", pfield(NULL, 0));
1243 pval((unsigned long long) sneip->InDestUnreachs6, (unsigned long long) sneic->InDestUnreachs6);
1244 printf(" %s", pfield(NULL, 0));
1245 pval((unsigned long long) sneip->OutDestUnreachs6, (unsigned long long) sneic->OutDestUnreachs6);
1246 printf(" %s", pfield(NULL, 0));
1247 pval((unsigned long long) sneip->InTimeExcds6, (unsigned long long) sneic->InTimeExcds6);
1248 printf(" %s", pfield(NULL, 0));
1249 pval((unsigned long long) sneip->OutTimeExcds6, (unsigned long long) sneic->OutTimeExcds6);
1250 printf(" %s", pfield(NULL, 0));
1251 pval((unsigned long long) sneip->InParmProblems6, (unsigned long long) sneic->InParmProblems6);
1252 printf(" %s", pfield(NULL, 0));
1253 pval((unsigned long long) sneip->OutParmProblems6, (unsigned long long) sneic->OutParmProblems6);
1254 printf(" %s", pfield(NULL, 0));
1255 pval((unsigned long long) sneip->InRedirects6, (unsigned long long) sneic->InRedirects6);
1256 printf(" %s", pfield(NULL, 0));
1257 pval((unsigned long long) sneip->OutRedirects6, (unsigned long long) sneic->OutRedirects6);
1258 printf(" %s", pfield(NULL, 0));
1259 pval((unsigned long long) sneip->InPktTooBigs6, (unsigned long long) sneic->InPktTooBigs6);
1260 printf(" %s", pfield(NULL, 0));
1261 pval((unsigned long long) sneip->OutPktTooBigs6, (unsigned long long) sneic->OutPktTooBigs6);
1266 ***************************************************************************
1267 * Display UDPv6 network statistics in raw format.
1270 * @a Activity structure with statistics.
1271 * @timestr Time for current statistics sample.
1272 * @curr Index in array for current sample statistics.
1273 ***************************************************************************
1275 __print_funct_t raw_print_net_udp6_stats(struct activity *a, char *timestr, int curr)
1277 struct stats_net_udp6
1278 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1279 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1281 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1282 pval((unsigned long long) snup->InDatagrams6, (unsigned long long) snuc->InDatagrams6);
1283 printf(" %s", pfield(NULL, 0));
1284 pval((unsigned long long) snup->OutDatagrams6, (unsigned long long) snuc->OutDatagrams6);
1285 printf(" %s", pfield(NULL, 0));
1286 pval((unsigned long long) snup->NoPorts6, (unsigned long long) snuc->NoPorts6);
1287 printf(" %s", pfield(NULL, 0));
1288 pval((unsigned long long) snup->InErrors6, (unsigned long long) snuc->InErrors6);
1293 ***************************************************************************
1294 * Display CPU frequency statistics in raw format.
1297 * @a Activity structure with statistics.
1298 * @timestr Time for current statistics sample.
1299 * @curr Index in array for current sample statistics.
1300 ***************************************************************************
1302 __print_funct_t raw_print_pwr_cpufreq_stats(struct activity *a, char *timestr, int curr)
1305 struct stats_pwr_cpufreq *spc;
1307 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1309 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1311 /* Should current CPU (including CPU "all") be displayed? */
1312 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1313 /* Yes: Display it */
1314 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1315 printf(" %s; %lu;\n", pfield(NULL, 0), spc->cpufreq);
1321 ***************************************************************************
1322 * Display fan statistics in raw format.
1325 * @a Activity structure with statistics.
1326 * @timestr Time for current statistics sample.
1327 * @curr Index in array for current sample statistics.
1328 ***************************************************************************
1330 __print_funct_t raw_print_pwr_fan_stats(struct activity *a, char *timestr, int curr)
1333 struct stats_pwr_fan *spc;
1335 for (i = 0; i < a->nr[curr]; i++) {
1336 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1338 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1339 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1340 printf(" %s; %f;", pfield(NULL, 0), spc->rpm);
1341 printf(" rpm_min; %f;\n", spc->rpm_min);
1346 ***************************************************************************
1347 * Display temperature statistics in raw format.
1350 * @a Activity structure with statistics.
1351 * @timestr Time for current statistics sample.
1352 * @curr Index in array for current sample statistics.
1353 ***************************************************************************
1355 __print_funct_t raw_print_pwr_temp_stats(struct activity *a, char *timestr, int curr)
1358 struct stats_pwr_temp *spc;
1360 for (i = 0; i < a->nr[curr]; i++) {
1361 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1363 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1364 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1365 printf(" %s; %f;", pfield(NULL, 0), spc->temp);
1366 printf(" temp_min; %f;", spc->temp_min);
1367 printf(" temp_max; %f;\n", spc->temp_max);
1372 ***************************************************************************
1373 * Display voltage inputs statistics in raw format.
1376 * @a Activity structure with statistics.
1377 * @timestr Time for current statistics sample.
1378 * @curr Index in array for current sample statistics.
1379 ***************************************************************************
1381 __print_funct_t raw_print_pwr_in_stats(struct activity *a, char *timestr, int curr)
1384 struct stats_pwr_in *spc;
1386 for (i = 0; i < a->nr[curr]; i++) {
1387 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1389 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i);
1390 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1391 printf(" %s; %f;", pfield(NULL, 0), spc->in);
1392 printf(" in_min; %f;", spc->in_min);
1393 printf(" in_max; %f;\n", spc->in_max);
1398 ***************************************************************************
1399 * Display huge pages statistics in raw format.
1402 * @a Activity structure with statistics.
1403 * @timestr Time for current statistics sample.
1404 * @curr Index in array for current sample statistics.
1405 ***************************************************************************
1407 __print_funct_t raw_print_huge_stats(struct activity *a, char *timestr, int curr)
1410 *smc = (struct stats_huge *) a->buf[curr];
1412 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frhkb);
1413 printf(" hugtotal; %llu;", smc->tlhkb);
1414 pfield(NULL, 0); /* Skip kbhugused */
1415 pfield(NULL, 0); /* Skip %hugused */
1416 printf(" %s; %llu;", pfield(NULL, 0), smc->rsvdhkb);
1417 printf(" %s; %llu;\n", pfield(NULL, 0), smc->surphkb);
1421 ***************************************************************************
1422 * Display weighted CPU frequency statistics in raw format.
1425 * @a Activity structure with statistics.
1426 * @timestr Time for current statistics sample.
1427 * @curr Index in array for current sample statistics.
1428 ***************************************************************************
1430 __print_funct_t raw_print_pwr_wghfreq_stats(struct activity *a, char *timestr, int curr)
1433 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1435 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1437 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
1438 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
1440 /* Should current CPU (including CPU "all") be displayed? */
1441 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1445 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1447 for (k = 0; k < a->nr2; k++) {
1449 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
1452 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
1454 printf(" freq; %lu;", spc_k->freq);
1456 pval(spp_k->time_in_state, spc_k->time_in_state);
1463 ***************************************************************************
1464 * Display USB devices statistics in raw format.
1467 * @a Activity structure with statistics.
1468 * @timestr Time for current statistics sample.
1469 * @curr Index in array for current sample statistics.
1470 ***************************************************************************
1472 __print_funct_t raw_print_pwr_usb_stats(struct activity *a, char *timestr, int curr)
1475 struct stats_pwr_usb *suc;
1477 for (i = 0; i < a->nr[curr]; i++) {
1478 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
1480 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST), suc->manufacturer);
1481 printf(" %s; \"%s\";", pfield(NULL, 0), suc->product);
1482 printf(" %s; %d;", pfield(NULL, 0), suc->bus_nr);
1483 printf(" %s; %x;", pfield(NULL, 0), suc->vendor_id);
1484 printf(" %s; %x;", pfield(NULL, 0), suc->product_id);
1485 printf(" %s; %u;\n", pfield(NULL, 0), suc->bmaxpower);
1490 ***************************************************************************
1491 * Display filesystems statistics in raw format.
1494 * @a Activity structure with statistics.
1495 * @timestr Time for current statistics sample.
1496 * @curr Index in array for current sample statistics.
1497 ***************************************************************************
1499 __print_funct_t raw_print_filesystem_stats(struct activity *a, char *timestr, int curr)
1502 struct stats_filesystem *sfc;
1504 for (i = 0; i < a->nr[curr]; i++) {
1505 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
1507 if (a->item_list != NULL) {
1508 /* A list of devices has been entered on the command line */
1509 if (!search_list_item(a->item_list,
1510 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name))
1511 /* Device not found */
1515 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST + DISPLAY_MOUNT(a->opt_flags)),
1516 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name);
1517 printf(" f_bfree; %llu;", sfc->f_bfree);
1518 printf(" f_blocks; %llu;", sfc->f_blocks);
1519 printf(" f_bavail; %llu;", sfc->f_bavail);
1520 pfield(NULL, 0); /* Skip MBfsfree */
1521 pfield(NULL, 0); /* Skip MBfsused */
1522 pfield(NULL, 0); /* Skip %fsused */
1523 pfield(NULL, 0); /* Skip %ufsused */
1524 printf(" %s; %llu;", pfield(NULL, 0), sfc->f_ffree);
1525 printf(" f_files; %llu;\n", sfc->f_files);
1531 ***************************************************************************
1532 * Display Fibre Channel HBA statistics in raw format.
1535 * @a Activity structure with statistics.
1536 * @timestr Time for current statistics sample.
1537 * @curr Index in array for current sample statistics.
1538 ***************************************************************************
1540 __print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int curr)
1542 int i, j, j0, found;
1543 struct stats_fchost *sfcc, *sfcp, sfczero;
1545 memset(&sfczero, 0, sizeof(struct stats_fchost));
1547 for (i = 0; i < a->nr[curr]; i++) {
1550 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
1552 if (a->nr[!curr] > 0) {
1553 /* Look for corresponding structure in previous iteration */
1556 if (j >= a->nr[!curr]) {
1557 j = a->nr[!curr] - 1;
1563 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
1564 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
1568 if (++j >= a->nr[!curr]) {
1575 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1578 /* This is a newly registered host. Previous stats are zero */
1580 if (DISPLAY_DEBUG_MODE(flags)) {
1585 printf("; %s;", sfcc->fchost_name);
1586 printf(" %s", pfield(NULL, 0));
1587 pval((unsigned long long) sfcp->f_rxframes, (unsigned long long) sfcc->f_rxframes);
1588 printf(" %s", pfield(NULL, 0));
1589 pval((unsigned long long) sfcp->f_txframes, (unsigned long long) sfcc->f_txframes);
1590 printf(" %s", pfield(NULL, 0));
1591 pval((unsigned long long) sfcp->f_rxwords, (unsigned long long) sfcc->f_rxwords);
1592 printf(" %s", pfield(NULL, 0));
1593 pval((unsigned long long) sfcp->f_txwords, (unsigned long long) sfcc->f_txwords);
1599 ***************************************************************************
1600 * Display softnet statistics in raw format.
1603 * @a Activity structure with statistics.
1604 * @timestr Time for current statistics sample.
1605 * @curr Index in array for current sample statistics.
1606 ***************************************************************************
1608 __print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int curr)
1611 struct stats_softnet *ssnc, *ssnp;
1613 /* @nr[curr] cannot normally be greater than @nr_ini */
1614 if (a->nr[curr] > a->nr_ini) {
1615 a->nr_ini = a->nr[curr];
1618 /* Don't display CPU "all" which doesn't exist in file */
1619 for (i = 1; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
1622 * The size of a->buf[...] CPU structure may be different from the default
1623 * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1624 * That's why we don't use a syntax like:
1625 * ssnc = (struct stats_softnet *) a->buf[...] + i;
1627 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
1628 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
1631 * Note: a->nr is in [1, NR_CPUS + 1].
1632 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1633 * Anyway, NR_CPUS may vary between the version of sysstat
1634 * used by sadc to create a file, and the version of sysstat
1635 * used by sar to read it...
1638 /* Should current CPU (including CPU "all") be displayed? */
1639 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1643 /* Yes: Display current CPU stats */
1644 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1645 if (DISPLAY_DEBUG_MODE(flags) && i) {
1646 if (ssnc->processed + ssnc->dropped + ssnc->time_squeeze +
1647 ssnc->received_rps + ssnc->flow_limit == 0) {
1648 /* CPU is considered offline */
1652 printf("; %d;", i - 1);
1654 printf(" %s", pfield(NULL, 0));
1655 pval((unsigned long long) ssnp->processed, (unsigned long long) ssnc->processed);
1656 printf(" %s", pfield(NULL, 0));
1657 pval((unsigned long long) ssnp->dropped, (unsigned long long) ssnc->dropped);
1658 printf(" %s", pfield(NULL, 0));
1659 pval((unsigned long long) ssnp->time_squeeze, (unsigned long long) ssnc->time_squeeze);
1660 printf(" %s", pfield(NULL, 0));
1661 pval((unsigned long long) ssnp->received_rps, (unsigned long long) ssnc->received_rps);
1662 printf(" %s", pfield(NULL, 0));
1663 pval((unsigned long long) ssnp->flow_limit, (unsigned long long) ssnc->flow_limit);
1669 ***************************************************************************
1670 * Display pressure-stall CPU statistics in raw format.
1673 * @a Activity structure with statistics.
1674 * @timestr Time for current statistics sample.
1675 * @curr Index in array for current sample statistics.
1676 ***************************************************************************
1678 __print_funct_t raw_print_psicpu_stats(struct activity *a, char *timestr, int curr)
1680 struct stats_psi_cpu
1681 *psic = (struct stats_psi_cpu *) a->buf[curr],
1682 *psip = (struct stats_psi_cpu *) a->buf[!curr];
1684 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_acpu_10);
1685 printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_60);
1686 printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_300);
1687 printf(" %s", pfield(NULL, 0));
1688 pval((unsigned long long) psip->some_cpu_total, (unsigned long long) psic->some_cpu_total);
1693 ***************************************************************************
1694 * Display pressure-stall I/O statistics in raw format.
1697 * @a Activity structure with statistics.
1698 * @timestr Time for current statistics sample.
1699 * @curr Index in array for current sample statistics.
1700 ***************************************************************************
1702 __print_funct_t raw_print_psiio_stats(struct activity *a, char *timestr, int curr)
1705 *psic = (struct stats_psi_io *) a->buf[curr],
1706 *psip = (struct stats_psi_io *) a->buf[!curr];
1708 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_aio_10);
1709 printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_60);
1710 printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_300);
1711 printf(" %s", pfield(NULL, 0));
1712 pval((unsigned long long) psip->some_io_total, (unsigned long long) psic->some_io_total);
1714 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_10);
1715 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_60);
1716 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_300);
1717 printf(" %s", pfield(NULL, 0));
1718 pval((unsigned long long) psip->full_io_total, (unsigned long long) psic->full_io_total);
1723 ***************************************************************************
1724 * Display pressure-stall mem statistics in raw format.
1727 * @a Activity structure with statistics.
1728 * @timestr Time for current statistics sample.
1729 * @curr Index in array for current sample statistics.
1730 ***************************************************************************
1732 __print_funct_t raw_print_psimem_stats(struct activity *a, char *timestr, int curr)
1734 struct stats_psi_mem
1735 *psic = (struct stats_psi_mem *) a->buf[curr],
1736 *psip = (struct stats_psi_mem *) a->buf[!curr];
1738 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_amem_10);
1739 printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_60);
1740 printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_300);
1741 printf(" %s", pfield(NULL, 0));
1742 pval((unsigned long long) psip->some_mem_total, (unsigned long long) psic->some_mem_total);
1744 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_10);
1745 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_60);
1746 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_300);
1747 printf(" %s", pfield(NULL, 0));
1748 pval((unsigned long long) psip->full_mem_total, (unsigned long long) psic->full_mem_total);