2 * pr_stats.c: Functions used by sar to display statistics
3 * (C) 1999-2017 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
34 #define _(string) gettext(string)
36 #define _(string) (string)
39 extern unsigned int flags;
40 extern unsigned int dm_major;
42 extern char timestamp[][TIMESTAMP_LEN];
43 extern unsigned long avg_count;
47 ***************************************************************************
48 * Display current activity header line.
51 * @timestamp Timestamp for previous stat sample.
52 * @a Activity structure.
53 * @pos Index in @.hdr_line string, 0 being the first one (header
54 * are delimited by the '|' character).
55 * @iwidth First column width (generally this is the item name). A
56 * negative value means that the corresponding field shall be
57 * displayed at the end of the line, with no indication of width.
58 * @vwidth Column width for stats values.
59 ***************************************************************************
61 void print_hdr_line(char *timestamp, struct activity *a, int pos, int iwidth, int vwidth)
63 char hline[HEADER_LINE_LEN] = "";
64 char *hl, *tk, *it = NULL;
68 strncpy(hline, a->hdr_line, HEADER_LINE_LEN - 1);
69 hline[HEADER_LINE_LEN - 1] = '\0';
70 for (hl = strtok(hline, "|"); hl && (pos > 0); hl = strtok(NULL, "|"), pos--);
72 /* Bad @pos arg given to function */
75 printf("\n%-11s", timestamp);
77 if (strchr(hl, '&')) {
79 if ((a->opt_flags & 0xff00) & (1 << (8 + p))) {
80 /* Display whole header line */
84 /* Display only the first part of the header line */
88 /* Display each field */
89 for (tk = strtok(hl, ";"); tk; tk = strtok(NULL, ";"), i--) {
91 printf(" %*s", iwidth, tk);
95 if ((iwidth < 0) && (iwidth == i)) {
100 printf(" %*s", vwidth, tk);
110 ***************************************************************************
111 * Display CPU statistics.
112 * NB: The stats are only calculated over the part of the time interval when
113 * the CPU was online. As a consequence, the sum (%user + %nice + ... + %idle)
114 * will always be 100% on the time interval even if the CPU has been offline
118 * @a Activity structure with statistics.
119 * @prev Index in array where stats used as reference are.
120 * @curr Index in array for current sample statistics.
121 * @itv Interval of time in 1/100th of a second (independent of the
122 * number of processors). Unused here.
123 ***************************************************************************
125 __print_funct_t print_cpu_stats(struct activity *a, int prev, int curr,
126 unsigned long long itv)
129 unsigned long long tot_jiffies_c, tot_jiffies_p;
130 unsigned long long deltot_jiffies;
131 struct stats_cpu *scc, *scp;
134 print_hdr_line(timestamp[!curr], a, FIRST + DISPLAY_CPU_ALL(a->opt_flags), 7, 9);
138 * @nr[curr] cannot normally be greater than @nr_ini
139 * (since @nr_ini counts up all CPU, even those offline).
140 * If this happens, it may be because the machine has been
141 * restarted with more CPU and no LINUX_RESTART has been
143 * No problem here with @nr_allocated. Having been able to
144 * read @nr[curr] structures shows that buffers are large enough.
146 if (a->nr[curr] > a->nr_ini) {
147 a->nr_ini = a->nr[curr];
150 for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
153 * The size of a->buf[...] CPU structure may be different from the default
154 * sizeof(struct stats_cpu) value if data have been read from a file!
155 * That's why we don't use a syntax like:
156 * scc = (struct stats_cpu *) a->buf[...] + i;
158 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
159 scp = (struct stats_cpu *) ((char *) a->buf[prev] + i * a->msize);
162 * Note: @nr[curr] is in [1, NR_CPUS + 1].
163 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
164 * Anyway, NR_CPUS may vary between the version of sysstat
165 * used by sadc to create a file, and the version of sysstat
166 * used by sar to read it...
169 /* Should current CPU (including CPU "all") be displayed? */
170 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
175 * Yes: Compute the total number of jiffies spent by current processor.
176 * NB: Don't add cpu_guest/cpu_guest_nice because cpu_user/cpu_nice
177 * already include them.
179 tot_jiffies_c = scc->cpu_user + scc->cpu_nice +
180 scc->cpu_sys + scc->cpu_idle +
181 scc->cpu_iowait + scc->cpu_hardirq +
182 scc->cpu_steal + scc->cpu_softirq;
183 tot_jiffies_p = scp->cpu_user + scp->cpu_nice +
184 scp->cpu_sys + scp->cpu_idle +
185 scp->cpu_iowait + scp->cpu_hardirq +
186 scp->cpu_steal + scp->cpu_softirq;
188 /* Total number of jiffies spent on the interval */
189 deltot_jiffies = get_interval(tot_jiffies_p, tot_jiffies_c);
192 * If the CPU is offline then it is omited from /proc/stat:
193 * All the fields couldn't have been read and the sum of them is zero.
195 if (tot_jiffies_c == 0) {
197 * CPU is currently offline.
198 * Set current struct fields (which have been set to zero)
199 * to values from previous iteration. Hence their values won't
200 * jump from zero when the CPU comes back online.
201 * Note that this workaround is no longer enough with recent kernels,
202 * as I have noticed that when a CPU comes back online, some fields
203 * restart from their previous value (e.g. user, nice, system)
204 * whereas others restart from zero (idle, iowait)!
208 /* An offline CPU is not displayed */
211 if (tot_jiffies_p == 0)
213 * CPU has just come back online.
214 * Unfortunately, no reference values are available
215 * from a previous iteration, probably because it was
216 * already offline when the first sample has been taken.
217 * So don't display that CPU to prevent "jump-from-zero"
222 printf("%-11s", timestamp[curr]);
225 /* This is CPU "all" */
226 cprintf_in(IS_STR, " %s", " all", 0);
229 cprintf_in(IS_INT, " %7d", "", i - 1);
231 /* Recalculate interval for current proc */
232 deltot_jiffies = get_per_cpu_interval(scc, scp);
234 if (!deltot_jiffies) {
236 * If the CPU is tickless then there is no change in CPU values
237 * but the sum of values is not zero.
238 * %user, %nice, %system, %iowait, %steal, ..., %idle
240 cprintf_pc(DISPLAY_UNIT(flags), 5, 9, 2,
241 0.0, 0.0, 0.0, 0.0, 0.0);
243 if (DISPLAY_CPU_DEF(a->opt_flags)) {
244 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2, 100.0);
248 * Four additional fields to display:
249 * %irq, %soft, %guest, %gnice.
251 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
252 cprintf_pc(DISPLAY_UNIT(flags), 4, 9, 2,
253 0.0, 0.0, 0.0, 100.0);
260 if (DISPLAY_CPU_DEF(a->opt_flags)) {
261 cprintf_pc(DISPLAY_UNIT(flags), 6, 9, 2,
262 ll_sp_value(scp->cpu_user, scc->cpu_user, deltot_jiffies),
263 ll_sp_value(scp->cpu_nice, scc->cpu_nice, deltot_jiffies),
264 ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
265 scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
267 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, deltot_jiffies),
268 ll_sp_value(scp->cpu_steal, scc->cpu_steal, deltot_jiffies),
269 scc->cpu_idle < scp->cpu_idle ?
271 ll_sp_value(scp->cpu_idle, scc->cpu_idle, deltot_jiffies));
274 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
275 cprintf_pc(DISPLAY_UNIT(flags), 10, 9, 2,
276 (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
278 ll_sp_value(scp->cpu_user - scp->cpu_guest,
279 scc->cpu_user - scc->cpu_guest, deltot_jiffies),
280 (scc->cpu_nice - scc->cpu_guest_nice) < (scp->cpu_nice - scp->cpu_guest_nice) ?
282 ll_sp_value(scp->cpu_nice - scp->cpu_guest_nice,
283 scc->cpu_nice - scc->cpu_guest_nice, deltot_jiffies),
284 ll_sp_value(scp->cpu_sys, scc->cpu_sys, deltot_jiffies),
285 ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, deltot_jiffies),
286 ll_sp_value(scp->cpu_steal, scc->cpu_steal, deltot_jiffies),
287 ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, deltot_jiffies),
288 ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, deltot_jiffies),
289 ll_sp_value(scp->cpu_guest, scc->cpu_guest, deltot_jiffies),
290 ll_sp_value(scp->cpu_guest_nice, scc->cpu_guest_nice, deltot_jiffies),
291 scc->cpu_idle < scp->cpu_idle ?
293 ll_sp_value(scp->cpu_idle, scc->cpu_idle, deltot_jiffies));
300 ***************************************************************************
301 * Display tasks creation and context switches statistics.
304 * @a Activity structure with statistics.
305 * @prev Index in array where stats used as reference are.
306 * @curr Index in array for current sample statistics.
307 * @itv Interval of time in 1/100th of a second.
308 ***************************************************************************
310 __print_funct_t print_pcsw_stats(struct activity *a, int prev, int curr,
311 unsigned long long itv)
314 *spc = (struct stats_pcsw *) a->buf[curr],
315 *spp = (struct stats_pcsw *) a->buf[prev];
318 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
321 printf("%-11s", timestamp[curr]);
322 cprintf_f(NO_UNIT, 2, 9, 2,
323 S_VALUE(spp->processes, spc->processes, itv),
324 S_VALUE(spp->context_switch, spc->context_switch, itv));
329 ***************************************************************************
330 * Display interrupts statistics.
333 * @a Activity structure with statistics.
334 * @prev Index in array where stats used as reference are.
335 * @curr Index in array for current sample statistics.
336 * @itv Interval of time in 1/100th of a second.
337 ***************************************************************************
339 __print_funct_t print_irq_stats(struct activity *a, int prev, int curr,
340 unsigned long long itv)
343 struct stats_irq *sic, *sip;
346 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
349 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
352 * If @nr[curr] > @nr[prev] then we consider that previous
353 * interrupt value was 0.
355 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
356 sip = (struct stats_irq *) ((char *) a->buf[prev] + i * a->msize);
359 * Note: @nr[curr] gives the number of interrupts read (1 .. NR_IRQS + 1).
360 * Bitmap size is provided for (NR_IRQS + 1) interrupts.
361 * Anyway, NR_IRQS may vary between the version of sysstat
362 * used by sadc to create a file, and the version of sysstat
363 * used by sar to read it...
366 /* Should current interrupt (including int "sum") be displayed? */
367 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
369 /* Yes: Display it */
370 printf("%-11s", timestamp[curr]);
372 /* This is interrupt "sum" */
373 cprintf_in(IS_STR, " %s", " sum", 0);
376 cprintf_in(IS_INT, " %9d", "", i -1);
379 cprintf_f(NO_UNIT, 1, 9, 2, S_VALUE(sip->irq_nr, sic->irq_nr, itv));
386 ***************************************************************************
387 * Display swapping statistics.
390 * @a Activity structure with statistics.
391 * @prev Index in array where stats used as reference are.
392 * @curr Index in array for current sample statistics.
393 * @itv Interval of time in 1/100th of a second.
394 ***************************************************************************
396 __print_funct_t print_swap_stats(struct activity *a, int prev, int curr,
397 unsigned long long itv)
400 *ssc = (struct stats_swap *) a->buf[curr],
401 *ssp = (struct stats_swap *) a->buf[prev];
404 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
407 printf("%-11s", timestamp[curr]);
408 cprintf_f(NO_UNIT, 2, 9, 2,
409 S_VALUE(ssp->pswpin, ssc->pswpin, itv),
410 S_VALUE(ssp->pswpout, ssc->pswpout, itv));
415 ***************************************************************************
416 * Display paging statistics.
419 * @a Activity structure with statistics.
420 * @prev Index in array where stats used as reference are.
421 * @curr Index in array for current sample statistics.
422 * @itv Interval of time in 1/100th of a second.
423 ***************************************************************************
425 __print_funct_t print_paging_stats(struct activity *a, int prev, int curr,
426 unsigned long long itv)
429 *spc = (struct stats_paging *) a->buf[curr],
430 *spp = (struct stats_paging *) a->buf[prev];
433 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
436 printf("%-11s", timestamp[curr]);
437 cprintf_f(NO_UNIT, 8, 9, 2,
438 S_VALUE(spp->pgpgin, spc->pgpgin, itv),
439 S_VALUE(spp->pgpgout, spc->pgpgout, itv),
440 S_VALUE(spp->pgfault, spc->pgfault, itv),
441 S_VALUE(spp->pgmajfault, spc->pgmajfault, itv),
442 S_VALUE(spp->pgfree, spc->pgfree, itv),
443 S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
444 S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
445 S_VALUE(spp->pgsteal, spc->pgsteal, itv));
446 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
447 (spc->pgscan_kswapd + spc->pgscan_direct -
448 spp->pgscan_kswapd - spp->pgscan_direct) ?
449 SP_VALUE(spp->pgsteal, spc->pgsteal,
450 spc->pgscan_kswapd + spc->pgscan_direct -
451 spp->pgscan_kswapd - spp->pgscan_direct)
457 ***************************************************************************
458 * Display I/O and transfer rate statistics.
461 * @a Activity structure with statistics.
462 * @prev Index in array where stats used as reference are.
463 * @curr Index in array for current sample statistics.
464 * @itv Interval of time in 1/100th of a second.
465 ***************************************************************************
467 __print_funct_t print_io_stats(struct activity *a, int prev, int curr,
468 unsigned long long itv)
471 *sic = (struct stats_io *) a->buf[curr],
472 *sip = (struct stats_io *) a->buf[prev];
475 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
478 printf("%-11s", timestamp[curr]);
480 * If we get negative values, this is probably because
481 * one or more devices/filesystems have been unmounted.
482 * We display 0.0 in this case though we should rather tell
483 * the user that the value cannot be calculated here.
485 cprintf_f(NO_UNIT, 5, 9, 2,
486 sic->dk_drive < sip->dk_drive ? 0.0 :
487 S_VALUE(sip->dk_drive, sic->dk_drive, itv),
488 sic->dk_drive_rio < sip->dk_drive_rio ? 0.0 :
489 S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
490 sic->dk_drive_wio < sip->dk_drive_wio ? 0.0 :
491 S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
492 sic->dk_drive_rblk < sip->dk_drive_rblk ? 0.0 :
493 S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv),
494 sic->dk_drive_wblk < sip->dk_drive_wblk ? 0.0 :
495 S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
500 ***************************************************************************
501 * Display memory and swap statistics. This function is used to
502 * display instantaneous and average statistics.
505 * @a Activity structure with statistics.
506 * @prev Index in array where stats used as reference are.
507 * @curr Index in array for current sample statistics.
508 * @dispavg TRUE if displaying average statistics.
509 ***************************************************************************
511 void stub_print_memory_stats(struct activity *a, int prev, int curr, int dispavg)
514 *smc = (struct stats_memory *) a->buf[curr];
515 static unsigned long long
529 static unsigned long long
535 if (DISPLAY_UNIT(flags)) {
536 /* Default values unit is kB */
537 unit = UNIT_KILOBYTE;
540 if (DISPLAY_MEMORY(a->opt_flags)) {
542 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
546 /* Display instantaneous values */
547 printf("%-11s", timestamp[curr]);
548 cprintf_u64(unit, 3, 9,
549 (unsigned long long) smc->frmkb,
550 (unsigned long long) smc->availablekb,
551 (unsigned long long) (smc->tlmkb - smc->frmkb));
552 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
554 SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb)
556 cprintf_u64(unit, 3, 9,
557 (unsigned long long) smc->bufkb,
558 (unsigned long long) smc->camkb,
559 (unsigned long long) smc->comkb);
560 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
561 (smc->tlmkb + smc->tlskb) ?
562 SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb)
564 cprintf_u64(unit, 3, 9,
565 (unsigned long long) smc->activekb,
566 (unsigned long long) smc->inactkb,
567 (unsigned long long) smc->dirtykb);
569 if (DISPLAY_MEM_ALL(a->opt_flags)) {
570 /* Display extended memory statistics */
571 cprintf_u64(unit, 5, 9,
572 (unsigned long long) smc->anonpgkb,
573 (unsigned long long) smc->slabkb,
574 (unsigned long long) smc->kstackkb,
575 (unsigned long long) smc->pgtblkb,
576 (unsigned long long) smc->vmusedkb);
582 * Will be used to compute the average.
583 * We assume that the total amount of memory installed can not vary
584 * during the interval given on the command line.
586 avg_frmkb += smc->frmkb;
587 avg_bufkb += smc->bufkb;
588 avg_camkb += smc->camkb;
589 avg_comkb += smc->comkb;
590 avg_activekb += smc->activekb;
591 avg_inactkb += smc->inactkb;
592 avg_dirtykb += smc->dirtykb;
593 avg_anonpgkb += smc->anonpgkb;
594 avg_slabkb += smc->slabkb;
595 avg_kstackkb += smc->kstackkb;
596 avg_pgtblkb += smc->pgtblkb;
597 avg_vmusedkb += smc->vmusedkb;
598 avg_availablekb += smc->availablekb;
601 /* Display average values */
602 printf("%-11s", timestamp[curr]);
603 cprintf_f(unit, 3, 9, 0,
604 (double) avg_frmkb / avg_count,
605 (double) avg_availablekb / avg_count,
606 (double) smc->tlmkb - ((double) avg_frmkb / avg_count));
607 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
609 SP_VALUE((double) (avg_frmkb / avg_count), smc->tlmkb, smc->tlmkb)
611 cprintf_f(unit, 3, 9, 0,
612 (double) avg_bufkb / avg_count,
613 (double) avg_camkb / avg_count,
614 (double) avg_comkb / avg_count);
615 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
616 (smc->tlmkb + smc->tlskb) ?
617 SP_VALUE(0.0, (double) (avg_comkb / avg_count), smc->tlmkb + smc->tlskb)
619 cprintf_f(unit, 3, 9, 0,
620 (double) avg_activekb / avg_count,
621 (double) avg_inactkb / avg_count,
622 (double) avg_dirtykb / avg_count);
624 if (DISPLAY_MEM_ALL(a->opt_flags)) {
625 cprintf_f(unit, 5, 9, 0,
626 (double) avg_anonpgkb / avg_count,
627 (double) avg_slabkb / avg_count,
628 (double) avg_kstackkb / avg_count,
629 (double) avg_pgtblkb / avg_count,
630 (double) avg_vmusedkb / avg_count);
635 /* Reset average counters */
636 avg_frmkb = avg_bufkb = avg_camkb = avg_comkb = 0;
637 avg_activekb = avg_inactkb = avg_dirtykb = 0;
638 avg_anonpgkb = avg_slabkb = avg_kstackkb = 0;
639 avg_pgtblkb = avg_vmusedkb = avg_availablekb = 0;
643 if (DISPLAY_SWAP(a->opt_flags)) {
645 print_hdr_line(timestamp[!curr], a, SECOND, 0, 9);
649 /* Display instantaneous values */
650 printf("%-11s", timestamp[curr]);
651 cprintf_u64(unit, 2, 9,
652 (unsigned long long) smc->frskb,
653 (unsigned long long) (smc->tlskb - smc->frskb));
654 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
656 SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb)
658 cprintf_u64(unit, 1, 9,
659 (unsigned long long) smc->caskb);
660 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
661 (smc->tlskb - smc->frskb) ?
662 SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb)
668 * Will be used to compute the average.
669 * We assume that the total amount of swap space may vary.
671 avg_frskb += smc->frskb;
672 avg_tlskb += smc->tlskb;
673 avg_caskb += smc->caskb;
676 /* Display average values */
677 printf("%-11s", timestamp[curr]);
678 cprintf_f(unit, 2, 9, 0,
679 (double) avg_frskb / avg_count,
680 ((double) avg_tlskb / avg_count) -
681 ((double) avg_frskb / avg_count));
682 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
684 SP_VALUE((double) avg_frskb / avg_count,
685 (double) avg_tlskb / avg_count,
686 (double) avg_tlskb / avg_count)
688 cprintf_f(unit, 1, 9, 0,
689 (double) avg_caskb / avg_count);
690 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
691 (avg_tlskb != avg_frskb) ?
692 SP_VALUE(0.0, (double) avg_caskb / avg_count,
693 ((double) avg_tlskb / avg_count) -
694 ((double) avg_frskb / avg_count))
698 /* Reset average counters */
699 avg_frskb = avg_tlskb = avg_caskb = 0;
705 ***************************************************************************
706 * Display memory and swap statistics.
709 * @a Activity structure with statistics.
710 * @prev Index in array where stats used as reference are.
711 * @curr Index in array for current sample statistics.
712 * @itv Interval of time in 1/100th of a second.
713 ***************************************************************************
715 __print_funct_t print_memory_stats(struct activity *a, int prev, int curr,
716 unsigned long long itv)
718 stub_print_memory_stats(a, prev, curr, FALSE);
722 ***************************************************************************
723 * Display average memory statistics.
726 * @a Activity structure with statistics.
727 * @prev Index in array where stats used as reference are.
728 * @curr Index in array for current sample statistics.
729 * @itv Interval of time in 1/100th of a second.
730 ***************************************************************************
732 __print_funct_t print_avg_memory_stats(struct activity *a, int prev, int curr,
733 unsigned long long itv)
735 stub_print_memory_stats(a, prev, curr, TRUE);
739 ***************************************************************************
740 * Display kernel tables statistics. This function is used to display
741 * instantaneous and average statistics.
744 * @a Activity structure with statistics.
745 * @curr Index in array for current sample statistics.
746 * @dispavg True if displaying average statistics.
747 ***************************************************************************
749 void stub_print_ktables_stats(struct activity *a, int curr, int dispavg)
752 *skc = (struct stats_ktables *) a->buf[curr];
753 static unsigned long long
761 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
765 /* Display instantaneous values */
766 printf("%-11s", timestamp[curr]);
767 cprintf_u64(NO_UNIT, 4, 9,
768 (unsigned long long) skc->dentry_stat,
769 (unsigned long long) skc->file_used,
770 (unsigned long long) skc->inode_used,
771 (unsigned long long) skc->pty_nr);
775 * Will be used to compute the average.
776 * Note: Overflow unlikely to happen but not impossible...
778 avg_dentry_stat += skc->dentry_stat;
779 avg_file_used += skc->file_used;
780 avg_inode_used += skc->inode_used;
781 avg_pty_nr += skc->pty_nr;
784 /* Display average values */
785 printf("%-11s", timestamp[curr]);
786 cprintf_f(NO_UNIT, 4, 9, 0,
787 (double) avg_dentry_stat / avg_count,
788 (double) avg_file_used / avg_count,
789 (double) avg_inode_used / avg_count,
790 (double) avg_pty_nr / avg_count);
793 /* Reset average counters */
794 avg_dentry_stat = avg_file_used = avg_inode_used = avg_pty_nr = 0;
799 ***************************************************************************
800 * Display kernel tables statistics.
803 * @a Activity structure with statistics.
804 * @prev Index in array where stats used as reference are.
805 * @curr Index in array for current sample statistics.
806 * @itv Interval of time in 1/100th of a second.
807 ***************************************************************************
809 __print_funct_t print_ktables_stats(struct activity *a, int prev, int curr,
810 unsigned long long itv)
812 stub_print_ktables_stats(a, curr, FALSE);
816 ***************************************************************************
817 * Display average kernel tables statistics.
820 * @a Activity structure with statistics.
821 * @prev Index in array where stats used as reference are.
822 * @curr Index in array for current sample statistics.
823 * @itv Interval of time in 1/100th of a second.
824 ***************************************************************************
826 __print_funct_t print_avg_ktables_stats(struct activity *a, int prev, int curr,
827 unsigned long long itv)
829 stub_print_ktables_stats(a, curr, TRUE);
833 ***************************************************************************
834 * Display queue and load statistics. This function is used to display
835 * instantaneous and average statistics.
838 * @a Activity structure with statistics.
839 * @curr Index in array for current sample statistics.
840 * @dispavg TRUE if displaying average statistics.
841 ***************************************************************************
843 void stub_print_queue_stats(struct activity *a, int curr, int dispavg)
846 *sqc = (struct stats_queue *) a->buf[curr];
847 static unsigned long long
853 avg_procs_blocked = 0;
856 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
860 /* Display instantaneous values */
861 printf("%-11s", timestamp[curr]);
862 cprintf_u64(NO_UNIT, 2, 9,
863 (unsigned long long) sqc->nr_running,
864 (unsigned long long) sqc->nr_threads);
865 cprintf_f(NO_UNIT, 3, 9, 2,
866 (double) sqc->load_avg_1 / 100,
867 (double) sqc->load_avg_5 / 100,
868 (double) sqc->load_avg_15 / 100);
869 cprintf_u64(NO_UNIT, 1, 9,
870 (unsigned long long) sqc->procs_blocked);
873 /* Will be used to compute the average */
874 avg_nr_running += sqc->nr_running;
875 avg_nr_threads += sqc->nr_threads;
876 avg_load_avg_1 += sqc->load_avg_1;
877 avg_load_avg_5 += sqc->load_avg_5;
878 avg_load_avg_15 += sqc->load_avg_15;
879 avg_procs_blocked += sqc->procs_blocked;
882 /* Display average values */
883 printf("%-11s", timestamp[curr]);
884 cprintf_f(NO_UNIT, 2, 9, 0,
885 (double) avg_nr_running / avg_count,
886 (double) avg_nr_threads / avg_count);
887 cprintf_f(NO_UNIT, 3, 9, 2,
888 (double) avg_load_avg_1 / (avg_count * 100),
889 (double) avg_load_avg_5 / (avg_count * 100),
890 (double) avg_load_avg_15 / (avg_count * 100));
891 cprintf_f(NO_UNIT, 1, 9, 0,
892 (double) avg_procs_blocked / avg_count);
895 /* Reset average counters */
896 avg_nr_running = avg_nr_threads = 0;
897 avg_load_avg_1 = avg_load_avg_5 = avg_load_avg_15 = 0;
898 avg_procs_blocked = 0;
903 ***************************************************************************
904 * Display queue and load statistics.
907 * @a Activity structure with statistics.
908 * @prev Index in array where stats used as reference are.
909 * @curr Index in array for current sample statistics.
910 * @itv Interval of time in 1/100th of a second.
911 ***************************************************************************
913 __print_funct_t print_queue_stats(struct activity *a, int prev, int curr,
914 unsigned long long itv)
916 stub_print_queue_stats(a, curr, FALSE);
920 ***************************************************************************
921 * Display average queue and load statistics.
924 * @a Activity structure with statistics.
925 * @prev Index in array where stats used as reference are.
926 * @curr Index in array for current sample statistics.
927 * @itv Interval of time in 1/100th of a second.
928 ***************************************************************************
930 __print_funct_t print_avg_queue_stats(struct activity *a, int prev, int curr,
931 unsigned long long itv)
933 stub_print_queue_stats(a, curr, TRUE);
937 ***************************************************************************
938 * Display serial lines statistics.
941 * @a Activity structure with statistics.
942 * @prev Index in array where stats used as reference are.
943 * @curr Index in array for current sample statistics.
944 * @itv Interval of time in 1/100th of a second.
945 ***************************************************************************
947 __print_funct_t print_serial_stats(struct activity *a, int prev, int curr,
948 unsigned long long itv)
951 struct stats_serial *ssc, *ssp;
954 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
957 for (i = 0; i < a->nr[curr]; i++) {
959 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
961 /* Look for corresponding serial line in previous iteration */
963 if (j > a->nr[prev]) {
971 if (j > a->nr[prev]) {
974 ssp = (struct stats_serial *) ((char *) a->buf[prev] + j * a->msize);
975 if ((ssc->line == ssp->line) || WANT_SINCE_BOOT(flags)) {
986 printf("%-11s", timestamp[curr]);
987 cprintf_in(IS_INT, " %3d", "", ssc->line);
989 cprintf_f(NO_UNIT, 6, 9, 2,
990 S_VALUE(ssp->rx, ssc->rx, itv),
991 S_VALUE(ssp->tx, ssc->tx, itv),
992 S_VALUE(ssp->frame, ssc->frame, itv),
993 S_VALUE(ssp->parity, ssc->parity, itv),
994 S_VALUE(ssp->brk, ssc->brk, itv),
995 S_VALUE(ssp->overrun, ssc->overrun, itv));
1001 ***************************************************************************
1002 * Display disks statistics.
1005 * @a Activity structure with statistics.
1006 * @prev Index in array where stats used as reference are.
1007 * @curr Index in array for current sample statistics.
1008 * @itv Interval of time in 1/100th of a second.
1009 ***************************************************************************
1011 __print_funct_t print_disk_stats(struct activity *a, int prev, int curr,
1012 unsigned long long itv)
1015 struct stats_disk *sdc, *sdp, sdpzero;
1016 struct ext_disk_stats xds;
1017 char *dev_name, *persist_dev_name;
1020 memset(&sdpzero, 0, STATS_DISK_SIZE);
1022 if (DISPLAY_UNIT(flags)) {
1023 /* Default values unit is kB */
1024 unit = UNIT_KILOBYTE;
1028 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1031 for (i = 0; i < a->nr[curr]; i++) {
1033 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
1035 j = check_disk_reg(a, curr, prev, i);
1037 /* This is a newly registered interface. Previous stats are zero */
1041 sdp = (struct stats_disk *) ((char *) a->buf[prev] + j * a->msize);
1044 /* Compute service time, etc. */
1045 compute_ext_disk_stats(sdc, sdp, itv, &xds);
1048 persist_dev_name = NULL;
1050 if (DISPLAY_PERSIST_NAME_S(flags)) {
1051 persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
1054 if (persist_dev_name) {
1055 dev_name = persist_dev_name;
1058 if ((USE_PRETTY_OPTION(flags)) && (sdc->major == dm_major)) {
1059 dev_name = transform_devmapname(sdc->major, sdc->minor);
1063 dev_name = get_devname(sdc->major, sdc->minor,
1064 USE_PRETTY_OPTION(flags));
1068 printf("%-11s", timestamp[curr]);
1070 cprintf_in(IS_STR, " %9s", dev_name, 0);
1071 cprintf_f(NO_UNIT, 1, 9, 2,
1072 S_VALUE(sdp->nr_ios, sdc->nr_ios, itv));
1073 cprintf_f(unit, 2, 9, 2,
1074 S_VALUE(sdp->rd_sect, sdc->rd_sect, itv) / 2,
1075 S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2);
1076 /* See iostat for explanations */
1077 cprintf_f(unit, 1, 9, 2,
1079 cprintf_f(NO_UNIT, 3, 9, 2,
1080 S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
1083 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
1090 ***************************************************************************
1091 * Display network interfaces statistics.
1094 * @a Activity structure with statistics.
1095 * @prev Index in array where stats used as reference are.
1096 * @curr Index in array for current sample statistics.
1097 * @itv Interval of time in 1/100th of a second.
1098 ***************************************************************************
1100 __print_funct_t print_net_dev_stats(struct activity *a, int prev, int curr,
1101 unsigned long long itv)
1104 struct stats_net_dev *sndc, *sndp, sndzero;
1105 double rxkb, txkb, ifutil;
1108 memset(&sndzero, 0, STATS_NET_DEV_SIZE);
1110 if (DISPLAY_UNIT(flags)) {
1111 /* Default values unit is bytes */
1116 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1119 for (i = 0; i < a->nr[curr]; i++) {
1121 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
1123 j = check_net_dev_reg(a, curr, prev, i);
1125 /* This is a newly registered interface. Previous stats are zero */
1129 sndp = (struct stats_net_dev *) ((char *) a->buf[prev] + j * a->msize);
1132 printf("%-11s", timestamp[curr]);
1133 cprintf_in(IS_STR, " %9s", sndc->interface, 0);
1135 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
1136 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
1138 cprintf_f(NO_UNIT, 2, 9, 2,
1139 S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
1140 S_VALUE(sndp->tx_packets, sndc->tx_packets, itv));
1141 cprintf_f(unit, 2, 9, 2,
1142 unit < 0 ? rxkb / 1024 : rxkb,
1143 unit < 0 ? txkb / 1024 : txkb);
1144 cprintf_f(NO_UNIT, 3, 9, 2,
1145 S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
1146 S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
1147 S_VALUE(sndp->multicast, sndc->multicast, itv));
1148 ifutil = compute_ifutil(sndc, rxkb, txkb);
1149 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2, ifutil);
1155 ***************************************************************************
1156 * Display network interface errors statistics.
1159 * @a Activity structure with statistics.
1160 * @prev Index in array where stats used as reference are.
1161 * @curr Index in array for current sample statistics.
1162 * @itv Interval of time in 1/100th of a second.
1163 ***************************************************************************
1165 __print_funct_t print_net_edev_stats(struct activity *a, int prev, int curr,
1166 unsigned long long itv)
1169 struct stats_net_edev *snedc, *snedp, snedzero;
1171 memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
1174 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1177 for (i = 0; i < a->nr[curr]; i++) {
1179 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
1181 j = check_net_edev_reg(a, curr, prev, i);
1183 /* This is a newly registered interface. Previous stats are zero */
1187 snedp = (struct stats_net_edev *) ((char *) a->buf[prev] + j * a->msize);
1190 printf("%-11s", timestamp[curr]);
1191 cprintf_in(IS_STR, " %9s", snedc->interface, 0);
1193 cprintf_f(NO_UNIT, 9, 9, 2,
1194 S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
1195 S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
1196 S_VALUE(snedp->collisions, snedc->collisions, itv),
1197 S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
1198 S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
1199 S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
1200 S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
1201 S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
1202 S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
1208 ***************************************************************************
1209 * Display NFS client statistics.
1212 * @a Activity structure with statistics.
1213 * @prev Index in array where stats used as reference are.
1214 * @curr Index in array for current sample statistics.
1215 * @itv Interval of time in 1/100th of a second.
1216 ***************************************************************************
1218 __print_funct_t print_net_nfs_stats(struct activity *a, int prev, int curr,
1219 unsigned long long itv)
1221 struct stats_net_nfs
1222 *snnc = (struct stats_net_nfs *) a->buf[curr],
1223 *snnp = (struct stats_net_nfs *) a->buf[prev];
1226 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1229 printf("%-11s", timestamp[curr]);
1230 cprintf_f(NO_UNIT, 6, 9, 2,
1231 S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
1232 S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
1233 S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
1234 S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
1235 S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
1236 S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
1241 ***************************************************************************
1242 * Display NFS server statistics.
1245 * @a Activity structure with statistics.
1246 * @prev Index in array where stats used as reference are.
1247 * @curr Index in array for current sample statistics.
1248 * @itv Interval of time in 1/100th of a second.
1249 ***************************************************************************
1251 __print_funct_t print_net_nfsd_stats(struct activity *a, int prev, int curr,
1252 unsigned long long itv)
1254 struct stats_net_nfsd
1255 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1256 *snndp = (struct stats_net_nfsd *) a->buf[prev];
1259 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1262 printf("%-11s", timestamp[curr]);
1263 cprintf_f(NO_UNIT, 11, 9, 2,
1264 S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1265 S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1266 S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1267 S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1268 S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1269 S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1270 S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1271 S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1272 S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1273 S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1274 S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1279 ***************************************************************************
1280 * Display network sockets statistics. This function is used to display
1281 * instantaneous and average statistics.
1284 * @a Activity structure with statistics.
1285 * @curr Index in array for current sample statistics.
1286 * @dispavg TRUE if displaying average statistics.
1287 ***************************************************************************
1289 void stub_print_net_sock_stats(struct activity *a, int curr, int dispavg)
1291 struct stats_net_sock
1292 *snsc = (struct stats_net_sock *) a->buf[curr];
1293 static unsigned long long
1302 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1306 /* Display instantaneous values */
1307 printf("%-11s", timestamp[curr]);
1308 cprintf_u64(NO_UNIT, 6, 9,
1309 (unsigned long long) snsc->sock_inuse,
1310 (unsigned long long) snsc->tcp_inuse,
1311 (unsigned long long) snsc->udp_inuse,
1312 (unsigned long long) snsc->raw_inuse,
1313 (unsigned long long) snsc->frag_inuse,
1314 (unsigned long long) snsc->tcp_tw);
1317 /* Will be used to compute the average */
1318 avg_sock_inuse += snsc->sock_inuse;
1319 avg_tcp_inuse += snsc->tcp_inuse;
1320 avg_udp_inuse += snsc->udp_inuse;
1321 avg_raw_inuse += snsc->raw_inuse;
1322 avg_frag_inuse += snsc->frag_inuse;
1323 avg_tcp_tw += snsc->tcp_tw;
1326 /* Display average values */
1327 printf("%-11s", timestamp[curr]);
1328 cprintf_f(NO_UNIT, 6, 9, 0,
1329 (double) avg_sock_inuse / avg_count,
1330 (double) avg_tcp_inuse / avg_count,
1331 (double) avg_udp_inuse / avg_count,
1332 (double) avg_raw_inuse / avg_count,
1333 (double) avg_frag_inuse / avg_count,
1334 (double) avg_tcp_tw / avg_count);
1337 /* Reset average counters */
1338 avg_sock_inuse = avg_tcp_inuse = avg_udp_inuse = 0;
1339 avg_raw_inuse = avg_frag_inuse = avg_tcp_tw = 0;
1344 ***************************************************************************
1345 * Display network sockets statistics.
1348 * @a Activity structure with statistics.
1349 * @prev Index in array where stats used as reference are.
1350 * @curr Index in array for current sample statistics.
1351 * @itv Interval of time in 1/100th of a second.
1352 ***************************************************************************
1354 __print_funct_t print_net_sock_stats(struct activity *a, int prev, int curr,
1355 unsigned long long itv)
1357 stub_print_net_sock_stats(a, curr, FALSE);
1361 ***************************************************************************
1362 * Display average network sockets statistics.
1365 * @a Activity structure with statistics.
1366 * @prev Index in array where stats used as reference are.
1367 * @curr Index in array for current sample statistics.
1368 * @itv Interval of time in 1/100th of a second.
1369 ***************************************************************************
1371 __print_funct_t print_avg_net_sock_stats(struct activity *a, int prev, int curr,
1372 unsigned long long itv)
1374 stub_print_net_sock_stats(a, curr, TRUE);
1378 ***************************************************************************
1379 * Display IP network traffic statistics.
1382 * @a Activity structure with statistics.
1383 * @prev Index in array where stats used as reference are.
1384 * @curr Index in array for current sample statistics.
1385 * @itv Interval of time in 1/100th of a second.
1386 ***************************************************************************
1388 __print_funct_t print_net_ip_stats(struct activity *a, int prev, int curr,
1389 unsigned long long itv)
1392 *snic = (struct stats_net_ip *) a->buf[curr],
1393 *snip = (struct stats_net_ip *) a->buf[prev];
1396 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1399 printf("%-11s", timestamp[curr]);
1400 cprintf_f(NO_UNIT, 8, 9, 2,
1401 S_VALUE(snip->InReceives, snic->InReceives, itv),
1402 S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1403 S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1404 S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1405 S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1406 S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1407 S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1408 S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1413 ***************************************************************************
1414 * Display IP network errors statistics.
1417 * @a Activity structure with statistics.
1418 * @prev Index in array where stats used as reference are.
1419 * @curr Index in array for current sample statistics.
1420 * @itv Interval of time in 1/100th of a second.
1421 ***************************************************************************
1423 __print_funct_t print_net_eip_stats(struct activity *a, int prev, int curr,
1424 unsigned long long itv)
1426 struct stats_net_eip
1427 *sneic = (struct stats_net_eip *) a->buf[curr],
1428 *sneip = (struct stats_net_eip *) a->buf[prev];
1431 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1434 printf("%-11s", timestamp[curr]);
1435 cprintf_f(NO_UNIT, 8, 9, 2,
1436 S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1437 S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1438 S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1439 S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1440 S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1441 S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1442 S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1443 S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1448 ***************************************************************************
1449 * Display ICMP network traffic statistics.
1452 * @a Activity structure with statistics.
1453 * @prev Index in array where stats used as reference are.
1454 * @curr Index in array for current sample statistics.
1455 * @itv Interval of time in 1/100th of a second.
1456 ***************************************************************************
1458 __print_funct_t print_net_icmp_stats(struct activity *a, int prev, int curr,
1459 unsigned long long itv)
1461 struct stats_net_icmp
1462 *snic = (struct stats_net_icmp *) a->buf[curr],
1463 *snip = (struct stats_net_icmp *) a->buf[prev];
1466 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1469 printf("%-11s", timestamp[curr]);
1470 cprintf_f(NO_UNIT, 14, 9, 2,
1471 S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1472 S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1473 S_VALUE(snip->InEchos, snic->InEchos, itv),
1474 S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1475 S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1476 S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1477 S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1478 S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1479 S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1480 S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1481 S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1482 S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1483 S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1484 S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1489 ***************************************************************************
1490 * Display ICMP network errors statistics.
1493 * @a Activity structure with statistics.
1494 * @prev Index in array where stats used as reference are.
1495 * @curr Index in array for current sample statistics.
1496 * @itv Interval of time in 1/100th of a second.
1497 ***************************************************************************
1499 __print_funct_t print_net_eicmp_stats(struct activity *a, int prev, int curr,
1500 unsigned long long itv)
1502 struct stats_net_eicmp
1503 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1504 *sneip = (struct stats_net_eicmp *) a->buf[prev];
1507 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1510 printf("%-11s", timestamp[curr]);
1511 cprintf_f(NO_UNIT, 12, 9, 2,
1512 S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1513 S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1514 S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1515 S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1516 S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1517 S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1518 S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1519 S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1520 S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1521 S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1522 S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1523 S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1528 ***************************************************************************
1529 * Display TCP network traffic statistics.
1532 * @a Activity structure with statistics.
1533 * @prev Index in array where stats used as reference are.
1534 * @curr Index in array for current sample statistics.
1535 * @itv Interval of time in 1/100th of a second.
1536 ***************************************************************************
1538 __print_funct_t print_net_tcp_stats(struct activity *a, int prev, int curr,
1539 unsigned long long itv)
1541 struct stats_net_tcp
1542 *sntc = (struct stats_net_tcp *) a->buf[curr],
1543 *sntp = (struct stats_net_tcp *) a->buf[prev];
1546 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1549 printf("%-11s", timestamp[curr]);
1550 cprintf_f(NO_UNIT, 4, 9, 2,
1551 S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1552 S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1553 S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1554 S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1559 ***************************************************************************
1560 * Display TCP network errors statistics.
1563 * @a Activity structure with statistics.
1564 * @prev Index in array where stats used as reference are.
1565 * @curr Index in array for current sample statistics.
1566 * @itv Interval of time in 1/100th of a second.
1567 ***************************************************************************
1569 __print_funct_t print_net_etcp_stats(struct activity *a, int prev, int curr,
1570 unsigned long long itv)
1572 struct stats_net_etcp
1573 *snetc = (struct stats_net_etcp *) a->buf[curr],
1574 *snetp = (struct stats_net_etcp *) a->buf[prev];
1577 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1580 printf("%-11s", timestamp[curr]);
1581 cprintf_f(NO_UNIT, 5, 9, 2,
1582 S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1583 S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1584 S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1585 S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1586 S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1591 ***************************************************************************
1592 * Display UDP network traffic statistics.
1595 * @a Activity structure with statistics.
1596 * @prev Index in array where stats used as reference are.
1597 * @curr Index in array for current sample statistics.
1598 * @itv Interval of time in 1/100th of a second.
1599 ***************************************************************************
1601 __print_funct_t print_net_udp_stats(struct activity *a, int prev, int curr,
1602 unsigned long long itv)
1604 struct stats_net_udp
1605 *snuc = (struct stats_net_udp *) a->buf[curr],
1606 *snup = (struct stats_net_udp *) a->buf[prev];
1609 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1612 printf("%-11s", timestamp[curr]);
1613 cprintf_f(NO_UNIT, 4, 9, 2,
1614 S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1615 S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1616 S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1617 S_VALUE(snup->InErrors, snuc->InErrors, itv));
1622 ***************************************************************************
1623 * Display IPv6 sockets statistics. This function is used to display
1624 * instantaneous and average statistics.
1627 * @a Activity structure with statistics.
1628 * @curr Index in array for current sample statistics.
1629 * @dispavg TRUE if displaying average statistics.
1630 ***************************************************************************
1632 void stub_print_net_sock6_stats(struct activity *a, int curr, int dispavg)
1634 struct stats_net_sock6
1635 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1636 static unsigned long long
1640 avg_frag6_inuse = 0;
1643 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1647 /* Display instantaneous values */
1648 printf("%-11s", timestamp[curr]);
1649 cprintf_u64(NO_UNIT, 4, 9,
1650 (unsigned long long) snsc->tcp6_inuse,
1651 (unsigned long long) snsc->udp6_inuse,
1652 (unsigned long long) snsc->raw6_inuse,
1653 (unsigned long long) snsc->frag6_inuse);
1656 /* Will be used to compute the average */
1657 avg_tcp6_inuse += snsc->tcp6_inuse;
1658 avg_udp6_inuse += snsc->udp6_inuse;
1659 avg_raw6_inuse += snsc->raw6_inuse;
1660 avg_frag6_inuse += snsc->frag6_inuse;
1663 /* Display average values */
1664 printf("%-11s", timestamp[curr]);
1665 cprintf_f(NO_UNIT, 4, 9, 0,
1666 (double) avg_tcp6_inuse / avg_count,
1667 (double) avg_udp6_inuse / avg_count,
1668 (double) avg_raw6_inuse / avg_count,
1669 (double) avg_frag6_inuse / avg_count);
1672 /* Reset average counters */
1673 avg_tcp6_inuse = avg_udp6_inuse = avg_raw6_inuse = avg_frag6_inuse = 0;
1678 ***************************************************************************
1679 * Display IPv6 sockets statistics.
1682 * @a Activity structure with statistics.
1683 * @prev Index in array where stats used as reference are.
1684 * @curr Index in array for current sample statistics.
1685 * @itv Interval of time in 1/100th of a second.
1686 ***************************************************************************
1688 __print_funct_t print_net_sock6_stats(struct activity *a, int prev, int curr,
1689 unsigned long long itv)
1691 stub_print_net_sock6_stats(a, curr, FALSE);
1695 ***************************************************************************
1696 * Display average IPv6 sockets statistics.
1699 * @a Activity structure with statistics.
1700 * @prev Index in array where stats used as reference are.
1701 * @curr Index in array for current sample statistics.
1702 * @itv Interval of time in 1/100th of a second.
1703 ***************************************************************************
1705 __print_funct_t print_avg_net_sock6_stats(struct activity *a, int prev, int curr,
1706 unsigned long long itv)
1708 stub_print_net_sock6_stats(a, curr, TRUE);
1712 ***************************************************************************
1713 * Display IPv6 network traffic statistics.
1716 * @a Activity structure with statistics.
1717 * @prev Index in array where stats used as reference are.
1718 * @curr Index in array for current sample statistics.
1719 * @itv Interval of time in 1/100th of a second.
1720 ***************************************************************************
1722 __print_funct_t print_net_ip6_stats(struct activity *a, int prev, int curr,
1723 unsigned long long itv)
1725 struct stats_net_ip6
1726 *snic = (struct stats_net_ip6 *) a->buf[curr],
1727 *snip = (struct stats_net_ip6 *) a->buf[prev];
1730 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1733 printf("%-11s", timestamp[curr]);
1734 cprintf_f(NO_UNIT, 10, 9, 2,
1735 S_VALUE(snip->InReceives6, snic->InReceives6, itv),
1736 S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1737 S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
1738 S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
1739 S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
1740 S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
1741 S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
1742 S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
1743 S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
1744 S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1749 ***************************************************************************
1750 * Display IPv6 network errors statistics.
1753 * @a Activity structure with statistics.
1754 * @prev Index in array where stats used as reference are.
1755 * @curr Index in array for current sample statistics.
1756 * @itv Interval of time in 1/100th of a second.
1757 ***************************************************************************
1759 __print_funct_t print_net_eip6_stats(struct activity *a, int prev, int curr,
1760 unsigned long long itv)
1762 struct stats_net_eip6
1763 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1764 *sneip = (struct stats_net_eip6 *) a->buf[prev];
1767 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1770 printf("%-11s", timestamp[curr]);
1771 cprintf_f(NO_UNIT, 11, 9, 2,
1772 S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
1773 S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
1774 S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1775 S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
1776 S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
1777 S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
1778 S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
1779 S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
1780 S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
1781 S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
1782 S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1787 ***************************************************************************
1788 * Display ICMPv6 network traffic statistics.
1791 * @a Activity structure with statistics.
1792 * @prev Index in array where stats used as reference are.
1793 * @curr Index in array for current sample statistics.
1794 * @itv Interval of time in 1/100th of a second.
1795 ***************************************************************************
1797 __print_funct_t print_net_icmp6_stats(struct activity *a, int prev, int curr,
1798 unsigned long long itv)
1800 struct stats_net_icmp6
1801 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1802 *snip = (struct stats_net_icmp6 *) a->buf[prev];
1805 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1808 printf("%-11s", timestamp[curr]);
1809 cprintf_f(NO_UNIT, 17, 9, 2,
1810 S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
1811 S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
1812 S_VALUE(snip->InEchos6, snic->InEchos6, itv),
1813 S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
1814 S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
1815 S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
1816 S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
1817 S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
1818 S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
1819 S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
1820 S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
1821 S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
1822 S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
1823 S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
1824 S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
1825 S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
1826 S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1831 ***************************************************************************
1832 * Display ICMPv6 network errors statistics.
1835 * @a Activity structure with statistics.
1836 * @prev Index in array where stats used as reference are.
1837 * @curr Index in array for current sample statistics.
1838 * @itv Interval of time in 1/100th of a second.
1839 ***************************************************************************
1841 __print_funct_t print_net_eicmp6_stats(struct activity *a, int prev, int curr,
1842 unsigned long long itv)
1844 struct stats_net_eicmp6
1845 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1846 *sneip = (struct stats_net_eicmp6 *) a->buf[prev];
1849 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1852 printf("%-11s", timestamp[curr]);
1853 cprintf_f(NO_UNIT, 11, 9, 2,
1854 S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
1855 S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
1856 S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1857 S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
1858 S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
1859 S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
1860 S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1861 S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
1862 S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
1863 S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
1864 S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
1869 ***************************************************************************
1870 * Display UDPv6 network traffic statistics.
1873 * @a Activity structure with statistics.
1874 * @prev Index in array where stats used as reference are.
1875 * @curr Index in array for current sample statistics.
1876 * @itv Interval of time in 1/100th of a second.
1877 ***************************************************************************
1879 __print_funct_t print_net_udp6_stats(struct activity *a, int prev, int curr,
1880 unsigned long long itv)
1882 struct stats_net_udp6
1883 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1884 *snup = (struct stats_net_udp6 *) a->buf[prev];
1887 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
1890 printf("%-11s", timestamp[curr]);
1891 cprintf_f(NO_UNIT, 4, 9, 2,
1892 S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
1893 S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1894 S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
1895 S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
1900 ***************************************************************************
1901 * Display CPU frequency statistics. This function is used to display
1902 * instantaneous and average statistics.
1905 * @a Activity structure with statistics.
1906 * @curr Index in array for current sample statistics.
1907 * @dispavg True if displaying average statistics.
1908 ***************************************************************************
1910 void stub_print_pwr_cpufreq_stats(struct activity *a, int curr, int dispavg)
1913 struct stats_pwr_cpufreq *spc;
1914 static __nr_t nr_alloc = 0;
1915 static unsigned long long
1916 *avg_cpufreq = NULL;
1918 if (!avg_cpufreq || (a->nr[curr] > nr_alloc)) {
1919 /* Allocate array of CPU frequency */
1920 SREALLOC(avg_cpufreq, unsigned long long, sizeof(unsigned long long) * a->nr[curr]);
1921 if (a->nr[curr] > nr_alloc) {
1922 /* Init additional space allocated */
1923 memset(avg_cpufreq + nr_alloc, 0,
1924 sizeof(unsigned long long) * (a->nr[curr] - nr_alloc));
1926 nr_alloc = a->nr[curr];
1930 print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
1933 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1936 * The size of a->buf[...] CPU structure may be different from the default
1937 * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1938 * That's why we don't use a syntax like:
1939 * spc = (struct stats_pwr_cpufreq *) a->buf[...] + i;
1941 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1944 /* This CPU is offline: Don't display it */
1948 * Note: @nr[curr] is in [1, NR_CPUS + 1].
1949 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1950 * Anyway, NR_CPUS may vary between the version of sysstat
1951 * used by sadc to create a file, and the version of sysstat
1952 * used by sar to read it...
1955 /* Should current CPU (including CPU "all") be displayed? */
1956 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1960 printf("%-11s", timestamp[curr]);
1963 /* This is CPU "all" */
1964 cprintf_in(IS_STR, "%s", " all", 0);
1967 cprintf_in(IS_INT, " %3d", "", i - 1);
1971 /* Display instantaneous values */
1972 cprintf_f(NO_UNIT, 1, 9, 2,
1973 ((double) spc->cpufreq) / 100);
1976 * Will be used to compute the average.
1977 * Note: Overflow unlikely to happen but not impossible...
1979 avg_cpufreq[i] += spc->cpufreq;
1982 /* Display average values */
1983 cprintf_f(NO_UNIT, 1, 9, 2,
1984 (double) avg_cpufreq[i] / (100 * avg_count));
1989 if (dispavg && avg_cpufreq) {
1990 /* Array of CPU frequency no longer needed: Free it! */
1998 ***************************************************************************
1999 * Display CPU frequency statistics.
2002 * @a Activity structure with statistics.
2003 * @prev Index in array where stats used as reference are.
2004 * @curr Index in array for current sample statistics.
2005 * @itv Interval of time in 1/100th of a second.
2006 ***************************************************************************
2008 __print_funct_t print_pwr_cpufreq_stats(struct activity *a, int prev, int curr,
2009 unsigned long long itv)
2011 stub_print_pwr_cpufreq_stats(a, curr, FALSE);
2015 ***************************************************************************
2016 * Display average CPU frequency statistics.
2019 * @a Activity structure with statistics.
2020 * @prev Index in array where stats used as reference are.
2021 * @curr Index in array for current sample statistics.
2022 * @itv Interval of time in 1/100th of a second.
2023 ***************************************************************************
2025 __print_funct_t print_avg_pwr_cpufreq_stats(struct activity *a, int prev, int curr,
2026 unsigned long long itv)
2028 stub_print_pwr_cpufreq_stats(a, curr, TRUE);
2032 ***************************************************************************
2033 * Display fan statistics. This function is used to display
2034 * instantaneous and average statistics.
2037 * @a Activity structure with statistics.
2038 * @curr Index in array for current sample statistics.
2039 * @dispavg True if displaying average statistics.
2040 ***************************************************************************
2042 void stub_print_pwr_fan_stats(struct activity *a, int curr, int dispavg)
2045 struct stats_pwr_fan *spc;
2046 static __nr_t nr_alloc = 0;
2047 static double *avg_fan = NULL;
2048 static double *avg_fan_min = NULL;
2050 /* Allocate arrays of fan RPMs */
2051 if (!avg_fan || (a->nr[curr] > nr_alloc)) {
2052 SREALLOC(avg_fan, double, sizeof(double) * a->nr[curr]);
2053 SREALLOC(avg_fan_min, double, sizeof(double) * a->nr[curr]);
2055 if (a->nr[curr] > nr_alloc) {
2056 /* Init additional space allocated */
2057 memset(avg_fan + nr_alloc, 0,
2058 sizeof(double) * (a->nr[curr] - nr_alloc));
2059 memset(avg_fan_min + nr_alloc, 0,
2060 sizeof(double) * (a->nr[curr] - nr_alloc));
2062 nr_alloc = a->nr[curr];
2066 print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
2069 for (i = 0; i < a->nr[curr]; i++) {
2070 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
2072 printf("%-11s", timestamp[curr]);
2073 cprintf_in(IS_INT, " %5d", "", i + 1);
2076 /* Display average values */
2077 cprintf_f(NO_UNIT, 2, 9, 2,
2078 (double) avg_fan[i] / avg_count,
2079 (double) (avg_fan[i] - avg_fan_min[i]) / avg_count);
2082 /* Display instantaneous values */
2083 cprintf_f(NO_UNIT, 2, 9, 2,
2085 spc->rpm - spc->rpm_min);
2086 avg_fan[i] += spc->rpm;
2087 avg_fan_min[i] += spc->rpm_min;
2090 cprintf_in(IS_STR, " %s\n", spc->device, 0);
2093 if (dispavg && avg_fan) {
2103 ***************************************************************************
2104 * Display fan statistics.
2107 * @a Activity structure with statistics.
2108 * @prev Index in array where stats used as reference are.
2109 * @curr Index in array for current sample statistics.
2110 * @itv Interval of time in 1/100th of a second.
2111 ***************************************************************************
2113 __print_funct_t print_pwr_fan_stats(struct activity *a, int prev, int curr,
2114 unsigned long long itv)
2116 stub_print_pwr_fan_stats(a, curr, FALSE);
2120 ***************************************************************************
2121 * Display average fan statistics.
2124 * @a Activity structure with statistics.
2125 * @prev Index in array where stats used as reference are.
2126 * @curr Index in array for current sample statistics.
2127 * @itv Interval of time in 1/100th of a second.
2128 ***************************************************************************
2130 __print_funct_t print_avg_pwr_fan_stats(struct activity *a, int prev, int curr,
2131 unsigned long long itv)
2133 stub_print_pwr_fan_stats(a, curr, TRUE);
2137 ***************************************************************************
2138 * Display device temperature statistics. This function is used to display
2139 * instantaneous and average statistics.
2142 * @a Activity structure with statistics.
2143 * @curr Index in array for current sample statistics.
2144 * @dispavg True if displaying average statistics.
2145 ***************************************************************************
2147 void stub_print_pwr_temp_stats(struct activity *a, int curr, int dispavg)
2150 struct stats_pwr_temp *spc;
2151 static __nr_t nr_alloc = 0;
2152 static double *avg_temp = NULL;
2153 static double *avg_temp_min = NULL, *avg_temp_max = NULL;
2155 /* Allocate arrays of temperatures */
2156 if (!avg_temp || (a->nr[curr] > nr_alloc)) {
2157 SREALLOC(avg_temp, double, sizeof(double) * a->nr[curr]);
2158 SREALLOC(avg_temp_min, double, sizeof(double) * a->nr[curr]);
2159 SREALLOC(avg_temp_max, double, sizeof(double) * a->nr[curr]);
2161 if (a->nr[curr] > nr_alloc) {
2162 /* Init additional space allocated */
2163 memset(avg_temp + nr_alloc, 0,
2164 sizeof(double) * (a->nr[curr] - nr_alloc));
2165 memset(avg_temp_min + nr_alloc, 0,
2166 sizeof(double) * (a->nr[curr] - nr_alloc));
2167 memset(avg_temp_max + nr_alloc, 0,
2168 sizeof(double) * (a->nr[curr] - nr_alloc));
2170 nr_alloc = a->nr[curr];
2174 print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
2177 for (i = 0; i < a->nr[curr]; i++) {
2178 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
2180 printf("%-11s", timestamp[curr]);
2181 cprintf_in(IS_INT, " %5d", "", i + 1);
2184 /* Display average values */
2185 cprintf_f(NO_UNIT, 1, 9, 2, (double) avg_temp[i] / avg_count);
2186 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2187 (avg_temp_max[i] - avg_temp_min[i]) ?
2188 ((double) (avg_temp[i] / avg_count) - avg_temp_min[i]) / (avg_temp_max[i] - avg_temp_min[i]) * 100
2192 /* Display instantaneous values */
2193 cprintf_f(NO_UNIT, 1, 9, 2, spc->temp);
2194 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2195 (spc->temp_max - spc->temp_min) ?
2196 (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100
2198 avg_temp[i] += spc->temp;
2199 /* Assume that min and max temperatures cannot vary */
2200 avg_temp_min[i] = spc->temp_min;
2201 avg_temp_max[i] = spc->temp_max;
2204 cprintf_in(IS_STR, " %s\n", spc->device, 0);
2207 if (dispavg && avg_temp) {
2212 avg_temp_min = NULL;
2213 avg_temp_max = NULL;
2219 ***************************************************************************
2220 * Display temperature statistics.
2223 * @a Activity structure with statistics.
2224 * @prev Index in array where stats used as reference are.
2225 * @curr Index in array for current sample statistics.
2226 * @itv Interval of time in 1/100th of a second.
2227 ***************************************************************************
2229 __print_funct_t print_pwr_temp_stats(struct activity *a, int prev, int curr,
2230 unsigned long long itv)
2232 stub_print_pwr_temp_stats(a, curr, FALSE);
2236 ***************************************************************************
2237 * Display average temperature statistics.
2240 * @a Activity structure with statistics.
2241 * @prev Index in array where stats used as reference are.
2242 * @curr Index in array for current sample statistics.
2243 * @itv Interval of time in 1/100th of a second.
2244 ***************************************************************************
2246 __print_funct_t print_avg_pwr_temp_stats(struct activity *a, int prev, int curr,
2247 unsigned long long itv)
2249 stub_print_pwr_temp_stats(a, curr, TRUE);
2253 ***************************************************************************
2254 * Display voltage inputs statistics. This function is used to display
2255 * instantaneous and average statistics.
2258 * @a Activity structure with statistics.
2259 * @curr Index in array for current sample statistics.
2260 * @dispavg True if displaying average statistics.
2261 ***************************************************************************
2263 void stub_print_pwr_in_stats(struct activity *a, int curr, int dispavg)
2266 struct stats_pwr_in *spc;
2267 static __nr_t nr_alloc = 0;
2268 static double *avg_in = NULL;
2269 static double *avg_in_min = NULL, *avg_in_max = NULL;
2271 /* Allocate arrays of voltage inputs */
2272 if (!avg_in || (a->nr[curr] > nr_alloc)) {
2273 SREALLOC(avg_in, double, sizeof(double) * a->nr[curr]);
2274 SREALLOC(avg_in_min, double, sizeof(double) * a->nr[curr]);
2275 SREALLOC(avg_in_max, double, sizeof(double) * a->nr[curr]);
2277 if (a->nr[curr] > nr_alloc) {
2278 /* Init additional space allocated */
2279 memset(avg_in + nr_alloc, 0,
2280 sizeof(double) * (a->nr[curr] - nr_alloc));
2281 memset(avg_in_min + nr_alloc, 0,
2282 sizeof(double) * (a->nr[curr] - nr_alloc));
2283 memset(avg_in_max + nr_alloc, 0,
2284 sizeof(double) * (a->nr[curr] - nr_alloc));
2286 nr_alloc = a->nr[curr];
2290 print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
2293 for (i = 0; i < a->nr[curr]; i++) {
2294 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
2296 printf("%-11s", timestamp[curr]);
2297 cprintf_in(IS_INT, " %5d", "", i);
2300 /* Display average values */
2301 cprintf_f(NO_UNIT, 1, 9, 2, (double) avg_in[i] / avg_count);
2302 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2303 (avg_in_max[i] - avg_in_min[i]) ?
2304 ((double) (avg_in[i] / avg_count) - avg_in_min[i]) / (avg_in_max[i] - avg_in_min[i]) * 100
2308 /* Display instantaneous values */
2309 cprintf_f(NO_UNIT, 1, 9, 2, spc->in);
2310 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2311 (spc->in_max - spc->in_min) ?
2312 (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100
2314 avg_in[i] += spc->in;
2315 /* Assume that min and max voltage inputs cannot vary */
2316 avg_in_min[i] = spc->in_min;
2317 avg_in_max[i] = spc->in_max;
2320 cprintf_in(IS_STR, " %s\n", spc->device, 0);
2323 if (dispavg && avg_in) {
2335 ***************************************************************************
2336 * Display voltage inputs statistics.
2339 * @a Activity structure with statistics.
2340 * @prev Index in array where stats used as reference are.
2341 * @curr Index in array for current sample statistics.
2342 * @itv Interval of time in 1/100th of a second.
2343 ***************************************************************************
2345 __print_funct_t print_pwr_in_stats(struct activity *a, int prev, int curr,
2346 unsigned long long itv)
2348 stub_print_pwr_in_stats(a, curr, FALSE);
2352 ***************************************************************************
2353 * Display average voltage inputs statistics.
2356 * @a Activity structure with statistics.
2357 * @prev Index in array where stats used as reference are.
2358 * @curr Index in array for current sample statistics.
2359 * @itv Interval of time in 1/100th of a second.
2360 ***************************************************************************
2362 __print_funct_t print_avg_pwr_in_stats(struct activity *a, int prev, int curr,
2363 unsigned long long itv)
2365 stub_print_pwr_in_stats(a, curr, TRUE);
2369 ***************************************************************************
2370 * Display huge pages statistics. This function is used to
2371 * display instantaneous and average statistics.
2374 * @a Activity structure with statistics.
2375 * @curr Index in array for current sample statistics.
2376 * @dispavg TRUE if displaying average statistics.
2377 ***************************************************************************
2379 void stub_print_huge_stats(struct activity *a, int curr, int dispavg)
2382 *smc = (struct stats_huge *) a->buf[curr];
2383 static unsigned long long
2388 if (DISPLAY_UNIT(flags)) {
2389 /* Default values unit is kB */
2390 unit = UNIT_KILOBYTE;
2394 print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
2398 /* Display instantaneous values */
2399 printf("%-11s", timestamp[curr]);
2400 cprintf_u64(unit, 2, 9,
2401 (unsigned long long) smc->frhkb,
2402 (unsigned long long) (smc->tlhkb - smc->frhkb));
2403 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2405 SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) : 0.0);
2408 /* Will be used to compute the average */
2409 avg_frhkb += smc->frhkb;
2410 avg_tlhkb += smc->tlhkb;
2413 /* Display average values */
2414 printf("%-11s", timestamp[curr]);
2415 cprintf_f(unit, 2, 9, 0,
2416 (double) avg_frhkb / avg_count,
2417 ((double) avg_tlhkb / avg_count) -
2418 ((double) avg_frhkb / avg_count));
2419 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2421 SP_VALUE((double) avg_frhkb / avg_count,
2422 (double) avg_tlhkb / avg_count,
2423 (double) avg_tlhkb / avg_count) : 0.0);
2426 /* Reset average counters */
2427 avg_frhkb = avg_tlhkb = 0;
2432 ***************************************************************************
2433 * Display huge pages statistics.
2436 * @a Activity structure with statistics.
2437 * @prev Index in array where stats used as reference are.
2438 * @curr Index in array for current sample statistics.
2439 * @itv Interval of time in 1/100th of a second.
2440 ***************************************************************************
2442 __print_funct_t print_huge_stats(struct activity *a, int prev, int curr,
2443 unsigned long long itv)
2445 stub_print_huge_stats(a, curr, FALSE);
2449 ***************************************************************************
2450 * Display huge pages statistics.
2453 * @a Activity structure with statistics.
2454 * @prev Index in array where stats used as reference are.
2455 * @curr Index in array for current sample statistics.
2456 * @itv Interval of time in 1/100th of a second.
2457 ***************************************************************************
2459 __print_funct_t print_avg_huge_stats(struct activity *a, int prev, int curr,
2460 unsigned long long itv)
2462 stub_print_huge_stats(a, curr, TRUE);
2466 ***************************************************************************
2467 * Display CPU weighted frequency statistics. This function is used to
2468 * display instantaneous and average statistics.
2471 * @a Activity structure with statistics.
2472 * @prev Index in array where stats used as reference are.
2473 * @curr Index in array for current sample statistics.
2474 * @itv Interval of time in 1/100th of a second.
2475 ***************************************************************************
2477 void print_pwr_wghfreq_stats(struct activity *a, int prev, int curr,
2478 unsigned long long itv)
2481 struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
2482 unsigned long long tis, tisfreq;
2485 print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
2488 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
2491 * The size of a->buf[...] CPU structure may be different from the default
2492 * sizeof(struct stats_pwr_wghfreq) value if data have been read from a file!
2493 * That's why we don't use a syntax like:
2494 * spc = (struct stats_pwr_wghfreq *) a->buf[...] + i;
2496 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
2497 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[prev] + i * a->msize * a->nr2);
2500 * Note: a->nr is in [1, NR_CPUS + 1].
2501 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
2502 * Anyway, NR_CPUS may vary between the version of sysstat
2503 * used by sadc to create a file, and the version of sysstat
2504 * used by sar to read it...
2507 /* Should current CPU (including CPU "all") be displayed? */
2508 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
2512 /* Yes: Display it */
2513 printf("%-11s", timestamp[curr]);
2516 /* This is CPU "all" */
2517 cprintf_in(IS_STR, "%s", " all", 0);
2520 cprintf_in(IS_INT, " %3d", "", i - 1);
2526 for (k = 0; k < a->nr2; k++) {
2528 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2531 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2533 tisfreq += (spc_k->freq / 1000) *
2534 (spc_k->time_in_state - spp_k->time_in_state);
2535 tis += (spc_k->time_in_state - spp_k->time_in_state);
2538 /* Display weighted frequency for current CPU */
2539 cprintf_f(NO_UNIT, 1, 9, 2,
2540 tis ? ((double) tisfreq) / tis : 0.0);
2546 ***************************************************************************
2547 * Display USB devices statistics. This function is used to
2548 * display instantaneous and summary statistics.
2551 * @a Activity structure with statistics.
2552 * @curr Index in array for current sample statistics.
2553 * @dispavg TRUE if displaying average statistics.
2554 ***************************************************************************
2556 void stub_print_pwr_usb_stats(struct activity *a, int curr, int dispavg)
2560 struct stats_pwr_usb *suc, *sum;
2563 printf("\n%-11s BUS idvendor idprod maxpower",
2564 (dispavg ? _("Summary:") : timestamp[!curr]));
2565 printf(" %-*s product\n", MAX_MANUF_LEN - 1, "manufact");
2568 for (i = 0; i < a->nr[curr]; i++) {
2569 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2571 printf("%-11s", (dispavg ? _("Summary:") : timestamp[curr]));
2572 cprintf_in(IS_INT, " %6d", "", suc->bus_nr);
2576 cprintf_u64(NO_UNIT, 1, 9,
2577 /* bMaxPower is expressed in 2 mA units */
2578 (unsigned long long) (suc->bmaxpower << 1));
2580 snprintf(fmt, 16, " %%-%ds", MAX_MANUF_LEN - 1);
2581 cprintf_s(IS_STR, fmt, suc->manufacturer);
2582 cprintf_s(IS_STR, " %s\n", suc->product);
2585 /* Save current USB device in summary list */
2586 for (j = 0; j < a->nr_allocated; j++) {
2587 sum = (struct stats_pwr_usb *) ((char *) a->buf[2] + j * a->msize);
2589 if ((sum->bus_nr == suc->bus_nr) &&
2590 (sum->vendor_id == suc->vendor_id) &&
2591 (sum->product_id == suc->product_id))
2592 /* USB device found in summary list */
2596 * Current slot is free:
2597 * Save USB device in summary list.
2603 if (j == a->nr_allocated) {
2605 * No free slot has been found for current device.
2606 * So enlarge buffers then save device in list.
2608 reallocate_all_buffers(a);
2609 sum = (struct stats_pwr_usb *) ((char *) a->buf[2] + j * a->msize);
2617 ***************************************************************************
2618 * Display USB devices statistics.
2621 * @a Activity structure with statistics.
2622 * @prev Index in array where stats used as reference are.
2623 * @curr Index in array for current sample statistics.
2624 * @itv Interval of time in 1/100th of a second.
2625 ***************************************************************************
2627 __print_funct_t print_pwr_usb_stats(struct activity *a, int prev, int curr,
2628 unsigned long long itv)
2630 stub_print_pwr_usb_stats(a, curr, FALSE);
2634 ***************************************************************************
2635 * Display average USB devices statistics.
2638 * @a Activity structure with statistics.
2639 * @prev Index in array where stats used as reference are.
2640 * @curr Index in array for current sample statistics.
2641 * @itv Interval of time in 1/100th of a second.
2642 ***************************************************************************
2644 __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr,
2645 unsigned long long itv)
2647 stub_print_pwr_usb_stats(a, 2, TRUE);
2651 ***************************************************************************
2652 * Display filesystems statistics. This function is used to
2653 * display instantaneous and average statistics.
2656 * @a Activity structure with statistics.
2657 * @curr Index in array for current sample statistics.
2658 * @dispavg TRUE if displaying average statistics.
2659 ***************************************************************************
2661 __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int dispavg)
2664 struct stats_filesystem *sfc, *sfm;
2667 if (DISPLAY_UNIT(flags)) {
2668 /* Default values unit is B */
2673 print_hdr_line((dispavg ? _("Summary:") : timestamp[!curr]),
2674 a, FIRST + DISPLAY_MOUNT(a->opt_flags), -1, 9);
2677 for (i = 0; i < a->nr[curr]; i++) {
2678 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2680 printf("%-11s", (dispavg ? _("Summary:") : timestamp[curr]));
2681 cprintf_f(unit, 2, 9, 0,
2682 unit < 0 ? (double) sfc->f_bfree / 1024 / 1024 : (double) sfc->f_bfree,
2683 unit < 0 ? (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024 :
2684 (double) (sfc->f_blocks - sfc->f_bfree));
2685 cprintf_pc(DISPLAY_UNIT(flags), 2, 9, 2,
2686 /* f_blocks is not zero. But test it anyway ;-) */
2687 sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2689 sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2691 cprintf_u64(NO_UNIT, 2, 9,
2692 (unsigned long long) sfc->f_ffree,
2693 (unsigned long long) (sfc->f_files - sfc->f_ffree));
2694 cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
2695 sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2697 cprintf_in(IS_STR, " %s\n",
2698 DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, 0);
2701 /* Save current filesystem in summary list */
2702 for (j = 0; j < a->nr_allocated; j++) {
2703 sfm = (struct stats_filesystem *) ((char *) a->buf[2] + j * a->msize);
2705 if (!strcmp(sfm->fs_name, sfc->fs_name) ||
2708 * Filesystem found in list (then save again its stats)
2709 * or free slot (end of list).
2715 if (j == a->nr_allocated) {
2717 * No free slot has been found for current filesystem.
2718 * So enlarge buffers then save filesystem in list.
2720 reallocate_all_buffers(a);
2721 sfm = (struct stats_filesystem *) ((char *) a->buf[2] + j * a->msize);
2729 ***************************************************************************
2730 * Display filesystems statistics.
2733 * @a Activity structure with statistics.
2734 * @prev Index in array where stats used as reference are.
2735 * @curr Index in array for current sample statistics.
2736 * @itv Interval of time in 1/100th of a second.
2737 ***************************************************************************
2739 __print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr,
2740 unsigned long long itv)
2742 stub_print_filesystem_stats(a, curr, FALSE);
2746 ***************************************************************************
2747 * Display average filesystems statistics.
2750 * @a Activity structure with statistics.
2751 * @prev Index in array where stats used as reference are.
2752 * @curr Index in array for current sample statistics.
2753 * @itv Interval of time in 1/100th of a second.
2754 ***************************************************************************
2756 __print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int curr,
2757 unsigned long long itv)
2759 stub_print_filesystem_stats(a, 2, TRUE);
2763 ***************************************************************************
2764 * Display Fibre Channel HBA statistics.
2767 * @a Activity structure with statistics.
2768 * @prev Index in array where stats used as reference are.
2769 * @curr Index in array for current sample statistics.
2770 * @itv Interval of time in 1/100th of a second.
2771 ***************************************************************************
2773 __print_funct_t print_fchost_stats(struct activity *a, int prev, int curr,
2774 unsigned long long itv)
2776 int i, j, j0, found;
2777 struct stats_fchost *sfcc,*sfcp;
2780 print_hdr_line(timestamp[!curr], a, FIRST, -1, 9);
2783 for (i = 0; i < a->nr[curr]; i++) {
2785 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2787 /* Look for corresponding structure in previous iteration */
2789 if (j > a->nr[prev]) {
2797 if (j > a->nr[prev]) {
2800 sfcp = (struct stats_fchost *) ((char *) a->buf[prev] + j * a->msize);
2801 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
2812 printf("%-11s", timestamp[curr]);
2813 cprintf_f(NO_UNIT, 4, 9, 2,
2814 S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2815 S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2816 S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2817 S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
2818 cprintf_in(IS_STR, " %s\n", sfcc->fchost_name, 0);
2823 ***************************************************************************
2824 * Display softnet statistics.
2827 * @a Activity structure with statistics.
2828 * @prev Index in array where stats used as reference are.
2829 * @curr Index in array for current sample statistics.
2830 * @itv Interval of time in 1/100th of a second.
2831 ***************************************************************************
2833 __print_funct_t print_softnet_stats(struct activity *a, int prev, int curr,
2834 unsigned long long itv)
2836 struct stats_softnet
2837 *ssnc = (struct stats_softnet *) a->buf[curr],
2838 *ssnp = (struct stats_softnet *) a->buf[prev];
2842 print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
2845 for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
2848 * The size of a->buf[...] CPU structure may be different from the default
2849 * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
2850 * That's why we don't use a syntax like:
2851 * ssnc = (struct stats_softnet *) a->buf[...] + i;
2853 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
2854 ssnp = (struct stats_softnet *) ((char *) a->buf[prev] + i * a->msize);
2857 * Note: a->nr is in [1, NR_CPUS + 1].
2858 * Bitmap size is provided for (NR_CPUS + 1) CPUs.
2859 * Anyway, NR_CPUS may vary between the version of sysstat
2860 * used by sadc to create a file, and the version of sysstat
2861 * used by sar to read it...
2864 /* Should current CPU (including CPU "all") be displayed? */
2865 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
2869 printf("%-11s", timestamp[curr]);
2872 /* This is CPU "all" */
2873 cprintf_in(IS_STR, " %s", " all", 0);
2876 cprintf_in(IS_INT, " %7d", "", i - 1);
2879 cprintf_f(NO_UNIT, 5, 9, 2,
2880 S_VALUE(ssnp->processed, ssnc->processed, itv),
2881 S_VALUE(ssnp->dropped, ssnc->dropped, itv),
2882 S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
2883 S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
2884 S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv));