2 * raw_stats.c: Functions used by sar to display statistics in raw format.
3 * (C) 1999-2020 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 uint64_t 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_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
541 DISPLAY_PRETTY(flags), DISPLAY_PERSIST_NAME_S(flags),
542 USE_STABLE_ID(flags), NULL);
544 if (a->item_list != NULL) {
545 /* A list of devices has been entered on the command line */
546 if (!search_list_item(a->item_list, dev_name))
547 /* Device not found */
551 printf("%s; major; %u; minor; %u; %s",
552 timestr, sdc->major, sdc->minor, pfield(a->hdr_line, FIRST));
554 j = check_disk_reg(a, curr, !curr, i);
556 /* This is a newly registered interface. Previous stats are zero */
558 if (DISPLAY_DEBUG_MODE(flags)) {
559 printf(" [%s]", j == -1 ? "NEW" : "BCK");
563 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
566 printf("; %s;", dev_name);
567 printf(" %s", pfield(NULL, 0));
568 pval(sdp->nr_ios, sdc->nr_ios);
569 printf(" %s", pfield(NULL, 0));
570 pval((unsigned long long) sdp->rd_sect, (unsigned long long) sdc->rd_sect);
571 printf(" %s", pfield(NULL, 0));
572 pval((unsigned long long) sdp->wr_sect, (unsigned long long) sdc->wr_sect);
573 printf(" %s", pfield(NULL, 0));
574 pval((unsigned long long) sdp->dc_sect, (unsigned long long) sdc->dc_sect);
576 pval((unsigned long long) sdp->rd_ticks, (unsigned long long) sdc->rd_ticks);
578 pval((unsigned long long) sdp->wr_ticks, (unsigned long long) sdc->wr_ticks);
580 pval((unsigned long long) sdp->dc_ticks, (unsigned long long) sdc->dc_ticks);
581 printf(" tot_ticks");
582 pval((unsigned long long) sdp->tot_ticks, (unsigned long long) sdc->tot_ticks);
583 pfield(NULL, 0); /* Skip areq-sz */
584 printf(" %s", pfield(NULL, 0));
585 pval((unsigned long long) sdp->rq_ticks, (unsigned long long) sdc->rq_ticks);
591 ***************************************************************************
592 * Display network interfaces statistics in raw format.
595 * @a Activity structure with statistics.
596 * @timestr Time for current statistics sample.
597 * @curr Index in array for current sample statistics.
598 ***************************************************************************
600 __print_funct_t raw_print_net_dev_stats(struct activity *a, char *timestr, int curr)
603 struct stats_net_dev *sndc, *sndp, sndzero;
605 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
607 for (i = 0; i < a->nr[curr]; i++) {
609 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
611 if (a->item_list != NULL) {
612 /* A list of devices has been entered on the command line */
613 if (!search_list_item(a->item_list, sndc->interface))
614 /* Device not found */
618 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
619 j = check_net_dev_reg(a, curr, !curr, i);
621 /* This is a newly registered interface. Previous stats are zero */
623 if (DISPLAY_DEBUG_MODE(flags)) {
624 printf(" [%s]", j == -1 ? "NEW" : "BCK");
628 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
630 printf("; %s;", sndc->interface);
632 printf(" %s", pfield(NULL, 0));
633 pval(sndp->rx_packets, sndc->rx_packets);
634 printf(" %s", pfield(NULL, 0));
635 pval(sndp->tx_packets, sndc->tx_packets);
636 printf(" %s", pfield(NULL, 0));
637 pval(sndp->rx_bytes, sndc->rx_bytes);
638 printf(" %s", pfield(NULL, 0));
639 pval(sndp->tx_bytes, sndc->tx_bytes);
640 printf(" %s", pfield(NULL, 0));
641 pval(sndp->rx_compressed, sndc->rx_compressed);
642 printf(" %s", pfield(NULL, 0));
643 pval(sndp->tx_compressed, sndc->tx_compressed);
644 printf(" %s", pfield(NULL, 0));
645 pval(sndp->multicast, sndc->multicast);
646 printf(" speed; %u; duplex; %u;\n", sndc->speed, sndc->duplex);
651 ***************************************************************************
652 * Display network interfaces errors statistics in raw format.
655 * @a Activity structure with statistics.
656 * @timestr Time for current statistics sample.
657 * @curr Index in array for current sample statistics.
658 ***************************************************************************
660 __print_funct_t raw_print_net_edev_stats(struct activity *a, char *timestr, int curr)
663 struct stats_net_edev *snedc, *snedp, snedzero;
665 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
667 for (i = 0; i < a->nr[curr]; i++) {
669 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
671 if (a->item_list != NULL) {
672 /* A list of devices has been entered on the command line */
673 if (!search_list_item(a->item_list, snedc->interface))
674 /* Device not found */
678 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
679 j = check_net_edev_reg(a, curr, !curr, i);
681 /* This is a newly registered interface. Previous stats are zero */
683 if (DISPLAY_DEBUG_MODE(flags)) {
684 printf(" [%s]", j == -1 ? "NEW" : "BCK");
688 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
690 printf("; %s;", snedc->interface);
692 printf(" %s", pfield(NULL, 0));
693 pval(snedp->rx_errors, snedc->rx_errors);
694 printf(" %s", pfield(NULL, 0));
695 pval(snedp->tx_errors, snedc->tx_errors);
696 printf(" %s", pfield(NULL, 0));
697 pval(snedp->collisions, snedc->collisions);
698 printf(" %s", pfield(NULL, 0));
699 pval(snedp->rx_dropped, snedc->rx_dropped);
700 printf(" %s", pfield(NULL, 0));
701 pval(snedp->tx_dropped, snedc->tx_dropped);
702 printf(" %s", pfield(NULL, 0));
703 pval(snedp->tx_carrier_errors, snedc->tx_carrier_errors);
704 printf(" %s", pfield(NULL, 0));
705 pval(snedp->rx_frame_errors, snedc->rx_frame_errors);
706 printf(" %s", pfield(NULL, 0));
707 pval(snedp->rx_fifo_errors, snedc->rx_fifo_errors);
708 printf(" %s", pfield(NULL, 0));
709 pval(snedp->tx_fifo_errors, snedc->tx_fifo_errors);
715 ***************************************************************************
716 * Display NFS client statistics in raw format.
719 * @a Activity structure with statistics.
720 * @timestr Time for current statistics sample.
721 * @curr Index in array for current sample statistics.
722 ***************************************************************************
724 __print_funct_t raw_print_net_nfs_stats(struct activity *a, char *timestr, int curr)
727 *snnc = (struct stats_net_nfs *) a->buf[curr],
728 *snnp = (struct stats_net_nfs *) a->buf[!curr];
730 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
731 pval((unsigned long long) snnp->nfs_rpccnt, (unsigned long long) snnc->nfs_rpccnt);
732 printf(" %s", pfield(NULL, 0));
733 pval((unsigned long long) snnp->nfs_rpcretrans, (unsigned long long) snnc->nfs_rpcretrans);
734 printf(" %s", pfield(NULL, 0));
735 pval((unsigned long long) snnp->nfs_readcnt, (unsigned long long) snnc->nfs_readcnt);
736 printf(" %s", pfield(NULL, 0));
737 pval((unsigned long long) snnp->nfs_writecnt, (unsigned long long) snnc->nfs_writecnt);
738 printf(" %s", pfield(NULL, 0));
739 pval((unsigned long long) snnp->nfs_accesscnt, (unsigned long long) snnc->nfs_accesscnt);
740 printf(" %s", pfield(NULL, 0));
741 pval((unsigned long long) snnp->nfs_getattcnt, (unsigned long long) snnc->nfs_getattcnt);
746 ***************************************************************************
747 * Display NFS server statistics in raw format.
750 * @a Activity structure with statistics.
751 * @timestr Time for current statistics sample.
752 * @curr Index in array for current sample statistics.
753 ***************************************************************************
755 __print_funct_t raw_print_net_nfsd_stats(struct activity *a, char *timestr, int curr)
757 struct stats_net_nfsd
758 *snndc = (struct stats_net_nfsd *) a->buf[curr],
759 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
761 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
762 pval((unsigned long long) snndp->nfsd_rpccnt, (unsigned long long) snndc->nfsd_rpccnt);
763 printf(" %s", pfield(NULL, 0));
764 pval((unsigned long long) snndp->nfsd_rpcbad, (unsigned long long) snndc->nfsd_rpcbad);
765 printf(" %s", pfield(NULL, 0));
766 pval((unsigned long long) snndp->nfsd_netcnt, (unsigned long long) snndc->nfsd_netcnt);
767 printf(" %s", pfield(NULL, 0));
768 pval((unsigned long long) snndp->nfsd_netudpcnt, (unsigned long long) snndc->nfsd_netudpcnt);
769 printf(" %s", pfield(NULL, 0));
770 pval((unsigned long long) snndp->nfsd_nettcpcnt, (unsigned long long) snndc->nfsd_nettcpcnt);
771 printf(" %s", pfield(NULL, 0));
772 pval((unsigned long long) snndp->nfsd_rchits, (unsigned long long) snndc->nfsd_rchits);
773 printf(" %s", pfield(NULL, 0));
774 pval((unsigned long long) snndp->nfsd_rcmisses, (unsigned long long) snndc->nfsd_rcmisses);
775 printf(" %s", pfield(NULL, 0));
776 pval((unsigned long long) snndp->nfsd_readcnt, (unsigned long long) snndc->nfsd_readcnt);
777 printf(" %s", pfield(NULL, 0));
778 pval((unsigned long long) snndp->nfsd_writecnt, (unsigned long long) snndc->nfsd_writecnt);
779 printf(" %s", pfield(NULL, 0));
780 pval((unsigned long long) snndp->nfsd_accesscnt, (unsigned long long) snndc->nfsd_accesscnt);
781 printf(" %s", pfield(NULL, 0));
782 pval((unsigned long long) snndp->nfsd_getattcnt, (unsigned long long) snndc->nfsd_getattcnt);
787 ***************************************************************************
788 * Display network socket statistics in raw format.
791 * @a Activity structure with statistics.
792 * @timestr Time for current statistics sample.
793 * @curr Index in array for current sample statistics.
794 ***************************************************************************
796 __print_funct_t raw_print_net_sock_stats(struct activity *a, char *timestr, int curr)
798 struct stats_net_sock
799 *snsc = (struct stats_net_sock *) a->buf[curr];
801 printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->sock_inuse);
802 printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_inuse);
803 printf(" %s; %u;", pfield(NULL, 0), snsc->udp_inuse);
804 printf(" %s; %u;", pfield(NULL, 0), snsc->raw_inuse);
805 printf(" %s; %u;", pfield(NULL, 0), snsc->frag_inuse);
806 printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_tw);
811 ***************************************************************************
812 * Display IP network statistics in raw format.
815 * @a Activity structure with statistics.
816 * @timestr Time for current statistics sample.
817 * @curr Index in array for current sample statistics.
818 ***************************************************************************
820 __print_funct_t raw_print_net_ip_stats(struct activity *a, char *timestr, int curr)
823 *snic = (struct stats_net_ip *) a->buf[curr],
824 *snip = (struct stats_net_ip *) a->buf[!curr];
826 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
827 pval(snip->InReceives, snic->InReceives);
828 printf(" %s", pfield(NULL, 0));
829 pval(snip->ForwDatagrams, snic->ForwDatagrams);
830 printf(" %s", pfield(NULL, 0));
831 pval(snip->InDelivers, snic->InDelivers);
832 printf(" %s", pfield(NULL, 0));
833 pval(snip->OutRequests, snic->OutRequests);
834 printf(" %s", pfield(NULL, 0));
835 pval(snip->ReasmReqds, snic->ReasmReqds);
836 printf(" %s", pfield(NULL, 0));
837 pval(snip->ReasmOKs, snic->ReasmOKs);
838 printf(" %s", pfield(NULL, 0));
839 pval(snip->FragOKs, snic->FragOKs);
840 printf(" %s", pfield(NULL, 0));
841 pval(snip->FragCreates, snic->FragCreates);
846 ***************************************************************************
847 * Display IP network errors statistics in raw format.
850 * @a Activity structure with statistics.
851 * @timestr Time for current statistics sample.
852 * @curr Index in array for current sample statistics.
853 ***************************************************************************
855 __print_funct_t raw_print_net_eip_stats(struct activity *a, char *timestr, int curr)
858 *sneic = (struct stats_net_eip *) a->buf[curr],
859 *sneip = (struct stats_net_eip *) a->buf[!curr];
861 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
862 pval(sneip->InHdrErrors, sneic->InHdrErrors);
863 printf(" %s", pfield(NULL, 0));
864 pval(sneip->InAddrErrors, sneic->InAddrErrors);
865 printf(" %s", pfield(NULL, 0));
866 pval(sneip->InUnknownProtos, sneic->InUnknownProtos);
867 printf(" %s", pfield(NULL, 0));
868 pval(sneip->InDiscards, sneic->InDiscards);
869 printf(" %s", pfield(NULL, 0));
870 pval(sneip->OutDiscards, sneic->OutDiscards);
871 printf(" %s", pfield(NULL, 0));
872 pval(sneip->OutNoRoutes, sneic->OutNoRoutes);
873 printf(" %s", pfield(NULL, 0));
874 pval(sneip->ReasmFails, sneic->ReasmFails);
875 printf(" %s", pfield(NULL, 0));
876 pval(sneip->FragFails, sneic->FragFails);
881 ***************************************************************************
882 * Display ICMP network statistics in raw format.
885 * @a Activity structure with statistics.
886 * @timestr Time for current statistics sample.
887 * @curr Index in array for current sample statistics.
888 ***************************************************************************
890 __print_funct_t raw_print_net_icmp_stats(struct activity *a, char *timestr, int curr)
892 struct stats_net_icmp
893 *snic = (struct stats_net_icmp *) a->buf[curr],
894 *snip = (struct stats_net_icmp *) a->buf[!curr];
896 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
897 pval((unsigned long long) snip->InMsgs, (unsigned long long) snic->InMsgs);
898 printf(" %s", pfield(NULL, 0));
899 pval((unsigned long long) snip->OutMsgs, (unsigned long long) snic->OutMsgs);
900 printf(" %s", pfield(NULL, 0));
901 pval((unsigned long long) snip->InEchos, (unsigned long long) snic->InEchos);
902 printf(" %s", pfield(NULL, 0));
903 pval((unsigned long long) snip->InEchoReps, (unsigned long long) snic->InEchoReps);
904 printf(" %s", pfield(NULL, 0));
905 pval((unsigned long long) snip->OutEchos, (unsigned long long) snic->OutEchos);
906 printf(" %s", pfield(NULL, 0));
907 pval((unsigned long long) snip->OutEchoReps, (unsigned long long) snic->OutEchoReps);
908 printf(" %s", pfield(NULL, 0));
909 pval((unsigned long long) snip->InTimestamps, (unsigned long long) snic->InTimestamps);
910 printf(" %s", pfield(NULL, 0));
911 pval((unsigned long long) snip->InTimestampReps, (unsigned long long) snic->InTimestampReps);
912 printf(" %s", pfield(NULL, 0));
913 pval((unsigned long long) snip->OutTimestamps, (unsigned long long) snic->OutTimestamps);
914 printf(" %s", pfield(NULL, 0));
915 pval((unsigned long long) snip->OutTimestampReps, (unsigned long long) snic->OutTimestampReps);
916 printf(" %s", pfield(NULL, 0));
917 pval((unsigned long long) snip->InAddrMasks, (unsigned long long) snic->InAddrMasks);
918 printf(" %s", pfield(NULL, 0));
919 pval((unsigned long long) snip->InAddrMaskReps, (unsigned long long) snic->InAddrMaskReps);
920 printf(" %s", pfield(NULL, 0));
921 pval((unsigned long long) snip->OutAddrMasks, (unsigned long long) snic->OutAddrMasks);
922 printf(" %s", pfield(NULL, 0));
923 pval((unsigned long long) snip->OutAddrMaskReps, (unsigned long long) snic->OutAddrMaskReps);
928 ***************************************************************************
929 * Display ICMP errors message statistics in raw format.
932 * @a Activity structure with statistics.
933 * @timestr Time for current statistics sample.
934 * @curr Index in array for current sample statistics.
935 ***************************************************************************
937 __print_funct_t raw_print_net_eicmp_stats(struct activity *a, char *timestr, int curr)
939 struct stats_net_eicmp
940 *sneic = (struct stats_net_eicmp *) a->buf[curr],
941 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
943 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
944 pval((unsigned long long) sneip->InErrors, (unsigned long long) sneic->InErrors);
945 printf(" %s", pfield(NULL, 0));
946 pval((unsigned long long) sneip->OutErrors, (unsigned long long) sneic->OutErrors);
947 printf(" %s", pfield(NULL, 0));
948 pval((unsigned long long) sneip->InDestUnreachs, (unsigned long long) sneic->InDestUnreachs);
949 printf(" %s", pfield(NULL, 0));
950 pval((unsigned long long) sneip->OutDestUnreachs, (unsigned long long) sneic->OutDestUnreachs);
951 printf(" %s", pfield(NULL, 0));
952 pval((unsigned long long) sneip->InTimeExcds, (unsigned long long) sneic->InTimeExcds);
953 printf(" %s", pfield(NULL, 0));
954 pval((unsigned long long) sneip->OutTimeExcds, (unsigned long long) sneic->OutTimeExcds);
955 printf(" %s", pfield(NULL, 0));
956 pval((unsigned long long) sneip->InParmProbs, (unsigned long long) sneic->InParmProbs);
957 printf(" %s", pfield(NULL, 0));
958 pval((unsigned long long) sneip->OutParmProbs, (unsigned long long) sneic->OutParmProbs);
959 printf(" %s", pfield(NULL, 0));
960 pval((unsigned long long) sneip->InSrcQuenchs, (unsigned long long) sneic->InSrcQuenchs);
961 printf(" %s", pfield(NULL, 0));
962 pval((unsigned long long) sneip->OutSrcQuenchs, (unsigned long long) sneic->OutSrcQuenchs);
963 printf(" %s", pfield(NULL, 0));
964 pval((unsigned long long) sneip->InRedirects, (unsigned long long) sneic->InRedirects);
965 printf(" %s", pfield(NULL, 0));
966 pval((unsigned long long) sneip->OutRedirects, (unsigned long long) sneic->OutRedirects);
971 ***************************************************************************
972 * Display TCP network statistics in raw format.
975 * @a Activity structure with statistics.
976 * @timestr Time for current statistics sample.
977 * @curr Index in array for current sample statistics.
978 ***************************************************************************
980 __print_funct_t raw_print_net_tcp_stats(struct activity *a, char *timestr, int curr)
983 *sntc = (struct stats_net_tcp *) a->buf[curr],
984 *sntp = (struct stats_net_tcp *) a->buf[!curr];
986 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
987 pval((unsigned long long) sntp->ActiveOpens, (unsigned long long) sntc->ActiveOpens);
988 printf(" %s", pfield(NULL, 0));
989 pval((unsigned long long) sntp->PassiveOpens, (unsigned long long) sntc->PassiveOpens);
990 printf(" %s", pfield(NULL, 0));
991 pval((unsigned long long) sntp->InSegs, (unsigned long long) sntc->InSegs);
992 printf(" %s", pfield(NULL, 0));
993 pval((unsigned long long) sntp->OutSegs, (unsigned long long) sntc->OutSegs);
998 ***************************************************************************
999 * Display TCP network errors statistics in raw format.
1002 * @a Activity structure with statistics.
1003 * @timestr Time for current statistics sample.
1004 * @curr Index in array for current sample statistics.
1005 ***************************************************************************
1007 __print_funct_t raw_print_net_etcp_stats(struct activity *a, char *timestr, int curr)
1009 struct stats_net_etcp
1010 *snetc = (struct stats_net_etcp *) a->buf[curr],
1011 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1013 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1014 pval((unsigned long long) snetp->AttemptFails, (unsigned long long) snetc->AttemptFails);
1015 printf(" %s", pfield(NULL, 0));
1016 pval((unsigned long long) snetp->EstabResets, (unsigned long long) snetc->EstabResets);
1017 printf(" %s", pfield(NULL, 0));
1018 pval((unsigned long long) snetp->RetransSegs, (unsigned long long) snetc->RetransSegs);
1019 printf(" %s", pfield(NULL, 0));
1020 pval((unsigned long long) snetp->InErrs, (unsigned long long) snetc->InErrs);
1021 printf(" %s", pfield(NULL, 0));
1022 pval((unsigned long long) snetp->OutRsts, (unsigned long long) snetc->OutRsts);
1027 ***************************************************************************
1028 * Display UDP network statistics in raw format.
1031 * @a Activity structure with statistics.
1032 * @timestr Time for current statistics sample.
1033 * @curr Index in array for current sample statistics.
1034 ***************************************************************************
1036 __print_funct_t raw_print_net_udp_stats(struct activity *a, char *timestr, int curr)
1038 struct stats_net_udp
1039 *snuc = (struct stats_net_udp *) a->buf[curr],
1040 *snup = (struct stats_net_udp *) a->buf[!curr];
1042 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1043 pval((unsigned long long) snup->InDatagrams, (unsigned long long) snuc->InDatagrams);
1044 printf(" %s", pfield(NULL, 0));
1045 pval((unsigned long long) snup->OutDatagrams, (unsigned long long) snuc->OutDatagrams);
1046 printf(" %s", pfield(NULL, 0));
1047 pval((unsigned long long) snup->NoPorts, (unsigned long long) snuc->NoPorts);
1048 printf(" %s", pfield(NULL, 0));
1049 pval((unsigned long long) snup->InErrors, (unsigned long long) snuc->InErrors);
1054 ***************************************************************************
1055 * Display IPv6 network socket statistics in raw format.
1058 * @a Activity structure with statistics.
1059 * @timestr Time for current statistics sample.
1060 * @curr Index in array for current sample statistics.
1061 ***************************************************************************
1063 __print_funct_t raw_print_net_sock6_stats(struct activity *a, char *timestr, int curr)
1065 struct stats_net_sock6
1066 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1068 printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->tcp6_inuse);
1069 printf(" %s; %u;", pfield(NULL, 0), snsc->udp6_inuse);
1070 printf(" %s; %u;", pfield(NULL, 0), snsc->raw6_inuse);
1071 printf(" %s; %u;", pfield(NULL, 0), snsc->frag6_inuse);
1076 ***************************************************************************
1077 * Display IPv6 network statistics in raw format.
1080 * @a Activity structure with statistics.
1081 * @timestr Time for current statistics sample.
1082 * @curr Index in array for current sample statistics.
1083 ***************************************************************************
1085 __print_funct_t raw_print_net_ip6_stats(struct activity *a, char *timestr, int curr)
1087 struct stats_net_ip6
1088 *snic = (struct stats_net_ip6 *) a->buf[curr],
1089 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1091 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1092 pval(snip->InReceives6, snic->InReceives6);
1093 printf(" %s", pfield(NULL, 0));
1094 pval(snip->OutForwDatagrams6, snic->OutForwDatagrams6);
1095 printf(" %s", pfield(NULL, 0));
1096 pval(snip->InDelivers6, snic->InDelivers6);
1097 printf(" %s", pfield(NULL, 0));
1098 pval(snip->OutRequests6, snic->OutRequests6);
1099 printf(" %s", pfield(NULL, 0));
1100 pval(snip->ReasmReqds6, snic->ReasmReqds6);
1101 printf(" %s", pfield(NULL, 0));
1102 pval(snip->ReasmOKs6, snic->ReasmOKs6);
1103 printf(" %s", pfield(NULL, 0));
1104 pval(snip->InMcastPkts6, snic->InMcastPkts6);
1105 printf(" %s", pfield(NULL, 0));
1106 pval(snip->OutMcastPkts6, snic->OutMcastPkts6);
1107 printf(" %s", pfield(NULL, 0));
1108 pval(snip->FragOKs6, snic->FragOKs6);
1109 printf(" %s", pfield(NULL, 0));
1110 pval(snip->FragCreates6, snic->FragCreates6);
1115 ***************************************************************************
1116 * Display IPv6 network errors statistics in raw format.
1119 * @a Activity structure with statistics.
1120 * @timestr Time for current statistics sample.
1121 * @curr Index in array for current sample statistics.
1122 ***************************************************************************
1124 __print_funct_t raw_print_net_eip6_stats(struct activity *a, char *timestr, int curr)
1126 struct stats_net_eip6
1127 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1128 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1130 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1131 pval(sneip->InHdrErrors6, sneic->InHdrErrors6);
1132 printf(" %s", pfield(NULL, 0));
1133 pval(sneip->InAddrErrors6, sneic->InAddrErrors6);
1134 printf(" %s", pfield(NULL, 0));
1135 pval(sneip->InUnknownProtos6, sneic->InUnknownProtos6);
1136 printf(" %s", pfield(NULL, 0));
1137 pval(sneip->InTooBigErrors6, sneic->InTooBigErrors6);
1138 printf(" %s", pfield(NULL, 0));
1139 pval(sneip->InDiscards6, sneic->InDiscards6);
1140 printf(" %s", pfield(NULL, 0));
1141 pval(sneip->OutDiscards6, sneic->OutDiscards6);
1142 printf(" %s", pfield(NULL, 0));
1143 pval(sneip->InNoRoutes6, sneic->InNoRoutes6);
1144 printf(" %s", pfield(NULL, 0));
1145 pval(sneip->OutNoRoutes6, sneic->OutNoRoutes6);
1146 printf(" %s", pfield(NULL, 0));
1147 pval(sneip->ReasmFails6, sneic->ReasmFails6);
1148 printf(" %s", pfield(NULL, 0));
1149 pval(sneip->FragFails6, sneic->FragFails6);
1150 printf(" %s", pfield(NULL, 0));
1151 pval(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6);
1156 ***************************************************************************
1157 * Display ICMPv6 network statistics in raw format.
1160 * @a Activity structure with statistics.
1161 * @timestr Time for current statistics sample.
1162 * @curr Index in array for current sample statistics.
1163 ***************************************************************************
1165 __print_funct_t raw_print_net_icmp6_stats(struct activity *a, char *timestr, int curr)
1167 struct stats_net_icmp6
1168 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1169 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1171 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1172 pval((unsigned long long) snip->InMsgs6,
1173 (unsigned long long) snic->InMsgs6);
1174 printf(" %s", pfield(NULL, 0));
1175 pval((unsigned long long) snip->OutMsgs6,
1176 (unsigned long long) snic->OutMsgs6);
1177 printf(" %s", pfield(NULL, 0));
1178 pval((unsigned long long) snip->InEchos6,
1179 (unsigned long long) snic->InEchos6);
1180 printf(" %s", pfield(NULL, 0));
1181 pval((unsigned long long) snip->InEchoReplies6,
1182 (unsigned long long) snic->InEchoReplies6);
1183 printf(" %s", pfield(NULL, 0));
1184 pval((unsigned long long) snip->OutEchoReplies6,
1185 (unsigned long long) snic->OutEchoReplies6);
1186 printf(" %s", pfield(NULL, 0));
1187 pval((unsigned long long) snip->InGroupMembQueries6,
1188 (unsigned long long) snic->InGroupMembQueries6);
1189 printf(" %s", pfield(NULL, 0));
1190 pval((unsigned long long) snip->InGroupMembResponses6,
1191 (unsigned long long) snic->InGroupMembResponses6);
1192 printf(" %s", pfield(NULL, 0));
1193 pval((unsigned long long) snip->OutGroupMembResponses6,
1194 (unsigned long long) snic->OutGroupMembResponses6);
1195 printf(" %s", pfield(NULL, 0));
1196 pval((unsigned long long) snip->InGroupMembReductions6,
1197 (unsigned long long) snic->InGroupMembReductions6);
1198 printf(" %s", pfield(NULL, 0));
1199 pval((unsigned long long) snip->OutGroupMembReductions6,
1200 (unsigned long long) snic->OutGroupMembReductions6);
1201 printf(" %s", pfield(NULL, 0));
1202 pval((unsigned long long) snip->InRouterSolicits6,
1203 (unsigned long long) snic->InRouterSolicits6);
1204 printf(" %s", pfield(NULL, 0));
1205 pval((unsigned long long) snip->OutRouterSolicits6,
1206 (unsigned long long) snic->OutRouterSolicits6);
1207 printf(" %s", pfield(NULL, 0));
1208 pval((unsigned long long) snip->InRouterAdvertisements6,
1209 (unsigned long long) snic->InRouterAdvertisements6);
1210 printf(" %s", pfield(NULL, 0));
1211 pval((unsigned long long) snip->InNeighborSolicits6,
1212 (unsigned long long) snic->InNeighborSolicits6);
1213 printf(" %s", pfield(NULL, 0));
1214 pval((unsigned long long) snip->OutNeighborSolicits6,
1215 (unsigned long long) snic->OutNeighborSolicits6);
1216 printf(" %s", pfield(NULL, 0));
1217 pval((unsigned long long) snip->InNeighborAdvertisements6,
1218 (unsigned long long) snic->InNeighborAdvertisements6);
1219 printf(" %s", pfield(NULL, 0));
1220 pval((unsigned long long) snip->OutNeighborAdvertisements6,
1221 (unsigned long long) snic->OutNeighborAdvertisements6);
1226 ***************************************************************************
1227 * Display ICMPv6 error messages statistics in rw format.
1230 * @a Activity structure with statistics.
1231 * @timestr Time for current statistics sample.
1232 * @curr Index in array for current sample statistics.
1233 ***************************************************************************
1235 __print_funct_t raw_print_net_eicmp6_stats(struct activity *a, char *timestr, int curr)
1237 struct stats_net_eicmp6
1238 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1239 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1241 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1242 pval((unsigned long long) sneip->InErrors6, (unsigned long long) sneic->InErrors6);
1243 printf(" %s", pfield(NULL, 0));
1244 pval((unsigned long long) sneip->InDestUnreachs6, (unsigned long long) sneic->InDestUnreachs6);
1245 printf(" %s", pfield(NULL, 0));
1246 pval((unsigned long long) sneip->OutDestUnreachs6, (unsigned long long) sneic->OutDestUnreachs6);
1247 printf(" %s", pfield(NULL, 0));
1248 pval((unsigned long long) sneip->InTimeExcds6, (unsigned long long) sneic->InTimeExcds6);
1249 printf(" %s", pfield(NULL, 0));
1250 pval((unsigned long long) sneip->OutTimeExcds6, (unsigned long long) sneic->OutTimeExcds6);
1251 printf(" %s", pfield(NULL, 0));
1252 pval((unsigned long long) sneip->InParmProblems6, (unsigned long long) sneic->InParmProblems6);
1253 printf(" %s", pfield(NULL, 0));
1254 pval((unsigned long long) sneip->OutParmProblems6, (unsigned long long) sneic->OutParmProblems6);
1255 printf(" %s", pfield(NULL, 0));
1256 pval((unsigned long long) sneip->InRedirects6, (unsigned long long) sneic->InRedirects6);
1257 printf(" %s", pfield(NULL, 0));
1258 pval((unsigned long long) sneip->OutRedirects6, (unsigned long long) sneic->OutRedirects6);
1259 printf(" %s", pfield(NULL, 0));
1260 pval((unsigned long long) sneip->InPktTooBigs6, (unsigned long long) sneic->InPktTooBigs6);
1261 printf(" %s", pfield(NULL, 0));
1262 pval((unsigned long long) sneip->OutPktTooBigs6, (unsigned long long) sneic->OutPktTooBigs6);
1267 ***************************************************************************
1268 * Display UDPv6 network statistics in raw format.
1271 * @a Activity structure with statistics.
1272 * @timestr Time for current statistics sample.
1273 * @curr Index in array for current sample statistics.
1274 ***************************************************************************
1276 __print_funct_t raw_print_net_udp6_stats(struct activity *a, char *timestr, int curr)
1278 struct stats_net_udp6
1279 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1280 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1282 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1283 pval((unsigned long long) snup->InDatagrams6, (unsigned long long) snuc->InDatagrams6);
1284 printf(" %s", pfield(NULL, 0));
1285 pval((unsigned long long) snup->OutDatagrams6, (unsigned long long) snuc->OutDatagrams6);
1286 printf(" %s", pfield(NULL, 0));
1287 pval((unsigned long long) snup->NoPorts6, (unsigned long long) snuc->NoPorts6);
1288 printf(" %s", pfield(NULL, 0));
1289 pval((unsigned long long) snup->InErrors6, (unsigned long long) snuc->InErrors6);
1294 ***************************************************************************
1295 * Display CPU frequency statistics in raw format.
1298 * @a Activity structure with statistics.
1299 * @timestr Time for current statistics sample.
1300 * @curr Index in array for current sample statistics.
1301 ***************************************************************************
1303 __print_funct_t raw_print_pwr_cpufreq_stats(struct activity *a, char *timestr, int curr)
1306 struct stats_pwr_cpufreq *spc;
1308 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1310 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1312 /* Should current CPU (including CPU "all") be displayed? */
1313 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1314 /* Yes: Display it */
1315 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1316 printf(" %s; %lu;\n", pfield(NULL, 0), spc->cpufreq);
1322 ***************************************************************************
1323 * Display fan statistics in raw format.
1326 * @a Activity structure with statistics.
1327 * @timestr Time for current statistics sample.
1328 * @curr Index in array for current sample statistics.
1329 ***************************************************************************
1331 __print_funct_t raw_print_pwr_fan_stats(struct activity *a, char *timestr, int curr)
1334 struct stats_pwr_fan *spc;
1336 for (i = 0; i < a->nr[curr]; i++) {
1337 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1339 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1340 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1341 printf(" %s; %f;", pfield(NULL, 0), spc->rpm);
1342 printf(" rpm_min; %f;\n", spc->rpm_min);
1347 ***************************************************************************
1348 * Display temperature statistics in raw format.
1351 * @a Activity structure with statistics.
1352 * @timestr Time for current statistics sample.
1353 * @curr Index in array for current sample statistics.
1354 ***************************************************************************
1356 __print_funct_t raw_print_pwr_temp_stats(struct activity *a, char *timestr, int curr)
1359 struct stats_pwr_temp *spc;
1361 for (i = 0; i < a->nr[curr]; i++) {
1362 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1364 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1365 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1366 printf(" %s; %f;", pfield(NULL, 0), spc->temp);
1367 printf(" temp_min; %f;", spc->temp_min);
1368 printf(" temp_max; %f;\n", spc->temp_max);
1373 ***************************************************************************
1374 * Display voltage inputs statistics in raw format.
1377 * @a Activity structure with statistics.
1378 * @timestr Time for current statistics sample.
1379 * @curr Index in array for current sample statistics.
1380 ***************************************************************************
1382 __print_funct_t raw_print_pwr_in_stats(struct activity *a, char *timestr, int curr)
1385 struct stats_pwr_in *spc;
1387 for (i = 0; i < a->nr[curr]; i++) {
1388 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1390 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i);
1391 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1392 printf(" %s; %f;", pfield(NULL, 0), spc->in);
1393 printf(" in_min; %f;", spc->in_min);
1394 printf(" in_max; %f;\n", spc->in_max);
1399 ***************************************************************************
1400 * Display huge pages statistics in raw format.
1403 * @a Activity structure with statistics.
1404 * @timestr Time for current statistics sample.
1405 * @curr Index in array for current sample statistics.
1406 ***************************************************************************
1408 __print_funct_t raw_print_huge_stats(struct activity *a, char *timestr, int curr)
1411 *smc = (struct stats_huge *) a->buf[curr];
1413 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frhkb);
1414 printf(" hugtotal; %llu;", smc->tlhkb);
1415 pfield(NULL, 0); /* Skip kbhugused */
1416 pfield(NULL, 0); /* Skip %hugused */
1417 printf(" %s; %llu;", pfield(NULL, 0), smc->rsvdhkb);
1418 printf(" %s; %llu;\n", pfield(NULL, 0), smc->surphkb);
1422 ***************************************************************************
1423 * Display weighted CPU frequency statistics in raw format.
1426 * @a Activity structure with statistics.
1427 * @timestr Time for current statistics sample.
1428 * @curr Index in array for current sample statistics.
1429 ***************************************************************************
1431 __print_funct_t raw_print_pwr_wghfreq_stats(struct activity *a, char *timestr, int curr)
1434 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1436 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1438 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
1439 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
1441 /* Should current CPU (including CPU "all") be displayed? */
1442 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1446 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1448 for (k = 0; k < a->nr2; k++) {
1450 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
1453 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
1455 printf(" freq; %lu;", spc_k->freq);
1457 pval(spp_k->time_in_state, spc_k->time_in_state);
1464 ***************************************************************************
1465 * Display USB devices statistics in raw format.
1468 * @a Activity structure with statistics.
1469 * @timestr Time for current statistics sample.
1470 * @curr Index in array for current sample statistics.
1471 ***************************************************************************
1473 __print_funct_t raw_print_pwr_usb_stats(struct activity *a, char *timestr, int curr)
1476 struct stats_pwr_usb *suc;
1478 for (i = 0; i < a->nr[curr]; i++) {
1479 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
1481 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST), suc->manufacturer);
1482 printf(" %s; \"%s\";", pfield(NULL, 0), suc->product);
1483 printf(" %s; %d;", pfield(NULL, 0), suc->bus_nr);
1484 printf(" %s; %x;", pfield(NULL, 0), suc->vendor_id);
1485 printf(" %s; %x;", pfield(NULL, 0), suc->product_id);
1486 printf(" %s; %u;\n", pfield(NULL, 0), suc->bmaxpower);
1491 ***************************************************************************
1492 * Display filesystems statistics in raw format.
1495 * @a Activity structure with statistics.
1496 * @timestr Time for current statistics sample.
1497 * @curr Index in array for current sample statistics.
1498 ***************************************************************************
1500 __print_funct_t raw_print_filesystem_stats(struct activity *a, char *timestr, int curr)
1503 struct stats_filesystem *sfc;
1506 for (i = 0; i < a->nr[curr]; i++) {
1507 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
1509 /* Get name to display (persistent or standard fs name, or mount point) */
1510 dev_name = get_fs_name_to_display(a, flags, sfc);
1512 if (a->item_list != NULL) {
1513 /* A list of devices has been entered on the command line */
1514 if (!search_list_item(a->item_list, dev_name))
1515 /* Device not found */
1519 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST + DISPLAY_MOUNT(a->opt_flags)),
1521 printf(" f_bfree; %llu;", sfc->f_bfree);
1522 printf(" f_blocks; %llu;", sfc->f_blocks);
1523 printf(" f_bavail; %llu;", sfc->f_bavail);
1524 pfield(NULL, 0); /* Skip MBfsfree */
1525 pfield(NULL, 0); /* Skip MBfsused */
1526 pfield(NULL, 0); /* Skip %fsused */
1527 pfield(NULL, 0); /* Skip %ufsused */
1528 printf(" %s; %llu;", pfield(NULL, 0), sfc->f_ffree);
1529 printf(" f_files; %llu;\n", sfc->f_files);
1535 ***************************************************************************
1536 * Display Fibre Channel HBA statistics in raw format.
1539 * @a Activity structure with statistics.
1540 * @timestr Time for current statistics sample.
1541 * @curr Index in array for current sample statistics.
1542 ***************************************************************************
1544 __print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int curr)
1546 int i, j, j0, found;
1547 struct stats_fchost *sfcc, *sfcp, sfczero;
1549 memset(&sfczero, 0, sizeof(struct stats_fchost));
1551 for (i = 0; i < a->nr[curr]; i++) {
1554 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
1556 if (a->nr[!curr] > 0) {
1557 /* Look for corresponding structure in previous iteration */
1560 if (j >= a->nr[!curr]) {
1561 j = a->nr[!curr] - 1;
1567 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
1568 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
1572 if (++j >= a->nr[!curr]) {
1579 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1582 /* This is a newly registered host. Previous stats are zero */
1584 if (DISPLAY_DEBUG_MODE(flags)) {
1589 printf("; %s;", sfcc->fchost_name);
1590 printf(" %s", pfield(NULL, 0));
1591 pval((unsigned long long) sfcp->f_rxframes, (unsigned long long) sfcc->f_rxframes);
1592 printf(" %s", pfield(NULL, 0));
1593 pval((unsigned long long) sfcp->f_txframes, (unsigned long long) sfcc->f_txframes);
1594 printf(" %s", pfield(NULL, 0));
1595 pval((unsigned long long) sfcp->f_rxwords, (unsigned long long) sfcc->f_rxwords);
1596 printf(" %s", pfield(NULL, 0));
1597 pval((unsigned long long) sfcp->f_txwords, (unsigned long long) sfcc->f_txwords);
1603 ***************************************************************************
1604 * Display softnet statistics in raw format.
1607 * @a Activity structure with statistics.
1608 * @timestr Time for current statistics sample.
1609 * @curr Index in array for current sample statistics.
1610 ***************************************************************************
1612 __print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int curr)
1615 struct stats_softnet *ssnc, *ssnp;
1617 /* @nr[curr] cannot normally be greater than @nr_ini */
1618 if (a->nr[curr] > a->nr_ini) {
1619 a->nr_ini = a->nr[curr];
1622 /* Don't display CPU "all" which doesn't exist in file */
1623 for (i = 1; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
1626 * The size of a->buf[...] CPU structure may be different from the default
1627 * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1628 * That's why we don't use a syntax like:
1629 * ssnc = (struct stats_softnet *) a->buf[...] + i;
1631 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
1632 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
1635 * Note: a->nr is in [1, NR_CPUS + 1].
1636 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1637 * Anyway, NR_CPUS may vary between the version of sysstat
1638 * used by sadc to create a file, and the version of sysstat
1639 * used by sar to read it...
1642 /* Should current CPU (including CPU "all") be displayed? */
1643 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1647 /* Yes: Display current CPU stats */
1648 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1649 if (DISPLAY_DEBUG_MODE(flags) && i) {
1650 if (ssnc->processed + ssnc->dropped + ssnc->time_squeeze +
1651 ssnc->received_rps + ssnc->flow_limit == 0) {
1652 /* CPU is considered offline */
1656 printf("; %d;", i - 1);
1658 printf(" %s", pfield(NULL, 0));
1659 pval((unsigned long long) ssnp->processed, (unsigned long long) ssnc->processed);
1660 printf(" %s", pfield(NULL, 0));
1661 pval((unsigned long long) ssnp->dropped, (unsigned long long) ssnc->dropped);
1662 printf(" %s", pfield(NULL, 0));
1663 pval((unsigned long long) ssnp->time_squeeze, (unsigned long long) ssnc->time_squeeze);
1664 printf(" %s", pfield(NULL, 0));
1665 pval((unsigned long long) ssnp->received_rps, (unsigned long long) ssnc->received_rps);
1666 printf(" %s", pfield(NULL, 0));
1667 pval((unsigned long long) ssnp->flow_limit, (unsigned long long) ssnc->flow_limit);
1673 ***************************************************************************
1674 * Display pressure-stall CPU statistics in raw format.
1677 * @a Activity structure with statistics.
1678 * @timestr Time for current statistics sample.
1679 * @curr Index in array for current sample statistics.
1680 ***************************************************************************
1682 __print_funct_t raw_print_psicpu_stats(struct activity *a, char *timestr, int curr)
1684 struct stats_psi_cpu
1685 *psic = (struct stats_psi_cpu *) a->buf[curr],
1686 *psip = (struct stats_psi_cpu *) a->buf[!curr];
1688 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_acpu_10);
1689 printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_60);
1690 printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_300);
1691 printf(" %s", pfield(NULL, 0));
1692 pval((unsigned long long) psip->some_cpu_total, (unsigned long long) psic->some_cpu_total);
1697 ***************************************************************************
1698 * Display pressure-stall I/O statistics in raw format.
1701 * @a Activity structure with statistics.
1702 * @timestr Time for current statistics sample.
1703 * @curr Index in array for current sample statistics.
1704 ***************************************************************************
1706 __print_funct_t raw_print_psiio_stats(struct activity *a, char *timestr, int curr)
1709 *psic = (struct stats_psi_io *) a->buf[curr],
1710 *psip = (struct stats_psi_io *) a->buf[!curr];
1712 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_aio_10);
1713 printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_60);
1714 printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_300);
1715 printf(" %s", pfield(NULL, 0));
1716 pval((unsigned long long) psip->some_io_total, (unsigned long long) psic->some_io_total);
1718 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_10);
1719 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_60);
1720 printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_300);
1721 printf(" %s", pfield(NULL, 0));
1722 pval((unsigned long long) psip->full_io_total, (unsigned long long) psic->full_io_total);
1727 ***************************************************************************
1728 * Display pressure-stall mem statistics in raw format.
1731 * @a Activity structure with statistics.
1732 * @timestr Time for current statistics sample.
1733 * @curr Index in array for current sample statistics.
1734 ***************************************************************************
1736 __print_funct_t raw_print_psimem_stats(struct activity *a, char *timestr, int curr)
1738 struct stats_psi_mem
1739 *psic = (struct stats_psi_mem *) a->buf[curr],
1740 *psip = (struct stats_psi_mem *) a->buf[!curr];
1742 printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_amem_10);
1743 printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_60);
1744 printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_300);
1745 printf(" %s", pfield(NULL, 0));
1746 pval((unsigned long long) psip->some_mem_total, (unsigned long long) psic->some_mem_total);
1748 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_10);
1749 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_60);
1750 printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_300);
1751 printf(" %s", pfield(NULL, 0));
1752 pval((unsigned long long) psip->full_mem_total, (unsigned long long) psic->full_mem_total);