]> granicus.if.org Git - sysstat/blob - raw_stats.c
sar/sadf: Devices list management code refactoring
[sysstat] / raw_stats.c
1 /*
2  * raw_stats.c: Functions used by sar to display statistics in raw format.
3  * (C) 1999-2018 by Sebastien GODARD (sysstat <at> orange.fr)
4  *
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.                                              *
10  *                                                                         *
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 *
14  * for more details.                                                       *
15  *                                                                         *
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  ***************************************************************************
20  */
21
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdarg.h>
25 #include <stdlib.h>
26
27 #include "sa.h"
28 #include "ioconf.h"
29 #include "raw_stats.h"
30
31 extern unsigned int flags;
32
33 /*
34  ***************************************************************************
35  * Display current field name.
36  *
37  * IN:
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).
42  *
43  * RETURNS:
44  * Pointer on string containing field name.
45  ***************************************************************************
46  */
47 char *pfield(char *hdr_line, int pos)
48 {
49         char hline[HEADER_LINE_LEN] = "";
50         static char field[HEADER_LINE_LEN] = "";
51         static int idx = 0;
52         char *hl;
53         int i, j = 0;
54
55         if (hdr_line) {
56                 strncpy(hline, hdr_line, HEADER_LINE_LEN - 1);
57                 hline[HEADER_LINE_LEN - 1] = '\0';
58                 idx = 0;
59
60                 for (hl = strtok(hline, "|"); hl && (pos > 0); hl = strtok(NULL, "|"), pos--);
61                 if (!hl) {
62                         /* Bad @pos arg given to function */
63                         strcpy(field, "");
64                         return field;
65                 }
66                 if (strchr(hl, '&')) {
67                         j = strcspn(hl, "&");
68                         *(hl + j) = ';';
69                 }
70                 strncpy(field, hl, HEADER_LINE_LEN);
71                 field[HEADER_LINE_LEN - 1] = '\0';
72         }
73
74         /* Display current field */
75         if (strchr(field + idx, ';')) {
76                 j = strcspn(field + idx, ";");
77                 *(field + idx + j) = '\0';
78         }
79         i = idx;
80         idx += j + 1;
81
82         return field + i;
83 }
84
85 /*
86  ***************************************************************************
87  * Display field values.
88  *
89  * IN:
90  * @valp        Field's value from previous statistics sample.
91  * @valc        Field's value from current statistics sample.
92  ***************************************************************************
93  */
94 void pval(unsigned long long valp, unsigned long long valc)
95 {
96         if (DISPLAY_DEBUG_MODE(flags)) {
97                 if (valc < valp) {
98                         /* Field's value has decreased */
99                         printf(" [DEC]");
100                 }
101         }
102         printf("; %llu; %llu;", valp, valc);
103 }
104
105 /*
106  ***************************************************************************
107  * Display CPU statistics in raw format.
108  *
109  * IN:
110  * @a           Activity structure with statistics.
111  * @timestr     Time for current statistics sample.
112  * @curr        Index in array for current statistics sample.
113  ***************************************************************************
114  */
115 __print_funct_t raw_print_cpu_stats(struct activity *a, char *timestr, int curr)
116 {
117         int i;
118         struct stats_cpu *scc, *scp;
119
120         /* @nr[curr] cannot normally be greater than @nr_ini */
121         if (a->nr[curr] > a->nr_ini) {
122                 a->nr_ini = a->nr[curr];
123         }
124
125         for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
126
127                 /*
128                  * The size of a->buf[...] CPU structure may be different from the default
129                  * sizeof(struct stats_cpu) value if data have been read from a file!
130                  * That's why we don't use a syntax like:
131                  * scc = (struct stats_cpu *) a->buf[...] + i;
132                  */
133                 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
134                 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
135
136                 /* Should current CPU (including CPU "all") be displayed? */
137                 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
138                         /* No */
139                         continue;
140
141                 /* Yes: Display it */
142                 printf("%s; %s", timestr, pfield(a->hdr_line, DISPLAY_CPU_ALL(a->opt_flags)));
143                 if (DISPLAY_DEBUG_MODE(flags) && i) {
144                         if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys +
145                              scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal +
146                              scc->cpu_hardirq + scc->cpu_softirq) == 0) {
147                                 /* CPU is offline */
148                                 printf(" [OFF]");
149                         }
150                         else {
151                                 if (!get_per_cpu_interval(scc, scp)) {
152                                         /* CPU is tickless */
153                                         printf(" [TLS]");
154                                 }
155                         }
156                 }
157                 printf("; %d;", i - 1);
158
159                 if (DISPLAY_CPU_DEF(a->opt_flags)) {
160                         printf(" %s", pfield(NULL, 0));
161                         pval(scp->cpu_user, scc->cpu_user);
162                         printf(" %s", pfield(NULL, 0));
163                         pval(scp->cpu_nice, scc->cpu_nice);
164                         printf(" %s", pfield(NULL, 0));
165                         pval(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
166                              scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq);
167                         printf(" %s", pfield(NULL, 0));
168                         pval(scp->cpu_iowait, scc->cpu_iowait);
169                         printf(" %s", pfield(NULL, 0));
170                         pval(scp->cpu_steal, scc->cpu_steal);
171                         printf(" %s", pfield(NULL, 0));
172                         pval(scp->cpu_idle, scc->cpu_idle);
173                 }
174                 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
175                         printf(" %s", pfield(NULL, 0));
176                         pval(scp->cpu_user - scp->cpu_guest, scc->cpu_user - scc->cpu_guest);
177                         printf(" %s", pfield(NULL, 0));
178                         pval(scp->cpu_nice - scp->cpu_guest_nice, scc->cpu_nice - scc->cpu_guest_nice);
179                         printf(" %s", pfield(NULL, 0));
180                         pval(scp->cpu_sys, scc->cpu_sys);
181                         printf(" %s", pfield(NULL, 0));
182                         pval(scp->cpu_iowait, scc->cpu_iowait);
183                         printf(" %s", pfield(NULL, 0));
184                         pval(scp->cpu_steal, scc->cpu_steal);
185                         printf(" %s", pfield(NULL, 0));
186                         pval(scp->cpu_hardirq, scc->cpu_hardirq);
187                         printf(" %s", pfield(NULL, 0));
188                         pval(scp->cpu_softirq, scc->cpu_softirq);
189                         printf(" %s", pfield(NULL, 0));
190                         pval(scp->cpu_guest, scc->cpu_guest);
191                         printf(" %s", pfield(NULL, 0));
192                         pval(scp->cpu_guest_nice, scc->cpu_guest_nice);
193                         printf(" %s", pfield(NULL, 0));
194                         pval(scp->cpu_idle, scc->cpu_idle);
195                 }
196                 printf("\n");
197         }
198 }
199
200 /*
201  ***************************************************************************
202  * Display tasks creation and context switches statistics in raw format.
203  *
204  * IN:
205  * @a           Activity structure with statistics.
206  * @timestr     Time for current statistics sample.
207  * @curr        Index in array for current sample statistics.
208  ***************************************************************************
209  */
210 __print_funct_t raw_print_pcsw_stats(struct activity *a, char *timestr, int curr)
211 {
212         struct stats_pcsw
213                 *spc = (struct stats_pcsw *) a->buf[curr],
214                 *spp = (struct stats_pcsw *) a->buf[!curr];
215
216         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
217         pval((unsigned long long) spp->processes, (unsigned long long) spc->processes);
218         printf(" %s", pfield(NULL, 0));
219         pval(spp->context_switch, spc->context_switch);
220         printf("\n");
221 }
222
223 /*
224  ***************************************************************************
225  * Display interrupts statistics in raw format.
226  *
227  * IN:
228  * @a           Activity structure with statistics.
229  * @timestr     Time for current statistics sample.
230  * @curr        Index in array for current sample statistics.
231  ***************************************************************************
232  */
233 __print_funct_t raw_print_irq_stats(struct activity *a, char *timestr, int curr)
234 {
235         int i;
236         struct stats_irq *sic, *sip;
237
238         for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
239
240                 sic = (struct stats_irq *) ((char *) a->buf[curr]  + i * a->msize);
241                 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
242
243                 /* Should current interrupt (including int "sum") be displayed? */
244                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
245
246                         /* Yes: Display it */
247                         printf("%s; %s; %d;", timestr,
248                                pfield(a->hdr_line, FIRST), i - 1);
249                         printf(" %s", pfield(NULL, 0));
250                         pval(sip->irq_nr, sic->irq_nr);
251                         printf("\n");
252                 }
253         }
254 }
255
256 /*
257  ***************************************************************************
258  * Display swapping statistics in raw format.
259  *
260  * IN:
261  * @a           Activity structure with statistics.
262  * @timestr     Time for current statistics sample.
263  * @curr        Index in array for current sample statistics.
264  ***************************************************************************
265  */
266 __print_funct_t raw_print_swap_stats(struct activity *a, char *timestr, int curr)
267 {
268         struct stats_swap
269                 *ssc = (struct stats_swap *) a->buf[curr],
270                 *ssp = (struct stats_swap *) a->buf[!curr];
271
272         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
273         pval((unsigned long long) ssp->pswpin, (unsigned long long) ssc->pswpin);
274         printf(" %s", pfield(NULL, 0));
275         pval((unsigned long long) ssp->pswpout, (unsigned long long) ssc->pswpout);
276         printf("\n");
277 }
278
279 /*
280  ***************************************************************************
281  * Display paging statistics in raw format.
282  *
283  * IN:
284  * @a           Activity structure with statistics.
285  * @timestr     Time for current statistics sample.
286  * @curr        Index in array for current sample statistics.
287  ***************************************************************************
288  */
289 __print_funct_t raw_print_paging_stats(struct activity *a, char *timestr, int curr)
290 {
291         struct stats_paging
292                 *spc = (struct stats_paging *) a->buf[curr],
293                 *spp = (struct stats_paging *) a->buf[!curr];
294
295         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
296         pval((unsigned long long) spp->pgpgin, (unsigned long long) spc->pgpgin);
297         printf(" %s", pfield(NULL, 0));
298         pval((unsigned long long) spp->pgpgout, (unsigned long long) spc->pgpgout);
299         printf(" %s", pfield(NULL, 0));
300         pval((unsigned long long) spp->pgfault, (unsigned long long) spc->pgfault);
301         printf(" %s", pfield(NULL, 0));
302         pval((unsigned long long) spp->pgmajfault, (unsigned long long) spc->pgmajfault);
303         printf(" %s", pfield(NULL, 0));
304         pval((unsigned long long) spp->pgfree, (unsigned long long) spc->pgfree);
305         printf(" %s", pfield(NULL, 0));
306         pval((unsigned long long) spp->pgscan_kswapd, (unsigned long long) spc->pgscan_kswapd);
307         printf(" %s", pfield(NULL, 0));
308         pval((unsigned long long) spp->pgscan_direct, (unsigned long long) spc->pgscan_direct);
309         printf(" %s", pfield(NULL, 0));
310         pval((unsigned long long) spp->pgsteal, (unsigned long long) spc->pgsteal);
311         printf("\n");
312 }
313
314 /*
315  ***************************************************************************
316  * Display I/O and transfer rate statistics in raw format.
317  *
318  * IN:
319  * @a           Activity structure with statistics.
320  * @timestr     Time for current statistics sample.
321  * @curr        Index in array for current sample statistics.
322  ***************************************************************************
323  */
324 __print_funct_t raw_print_io_stats(struct activity *a, char *timestr, int curr)
325 {
326         struct stats_io
327                 *sic = (struct stats_io *) a->buf[curr],
328                 *sip = (struct stats_io *) a->buf[!curr];
329
330         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
331         pval(sip->dk_drive, sic->dk_drive);
332         printf(" %s", pfield(NULL, 0));
333         pval(sip->dk_drive_rio, sic->dk_drive_rio);
334         printf(" %s", pfield(NULL, 0));
335         pval(sip->dk_drive_wio, sic->dk_drive_wio);
336         printf(" %s", pfield(NULL, 0));
337         pval(sip->dk_drive_rblk, sic->dk_drive_rblk);
338         printf(" %s", pfield(NULL, 0));
339         pval(sip->dk_drive_wblk, sic->dk_drive_wblk);
340         printf("\n");
341 }
342
343 /*
344  ***************************************************************************
345  * Display memory statistics in raw format.
346  *
347  * IN:
348  * @a           Activity structure with statistics.
349  * @timestr     Time for current statistics sample.
350  * @curr        Index in array for current sample statistics.
351  ***************************************************************************
352  */
353 __print_funct_t raw_print_memory_stats(struct activity *a, char *timestr, int curr)
354 {
355         struct stats_memory
356                 *smc = (struct stats_memory *) a->buf[curr];
357
358         if (DISPLAY_MEMORY(a->opt_flags)) {
359                 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frmkb);
360                 printf(" %s; %llu;", pfield(NULL, 0), smc->availablekb);
361                 printf(" kbttlmem; %llu;", smc->tlmkb);
362                 pfield(NULL, 0); /* Skip kbmemused */
363                 pfield(NULL, 0); /* Skip %memused */
364                 printf(" %s; %llu;", pfield(NULL, 0), smc->bufkb);
365                 printf(" %s; %llu;", pfield(NULL, 0), smc->camkb);
366                 printf(" %s; %llu;", pfield(NULL, 0), smc->comkb);
367                 pfield(NULL, 0); /* Skip %commit */
368                 printf(" %s; %llu;", pfield(NULL, 0), smc->activekb);
369                 printf(" %s; %llu;", pfield(NULL, 0), smc->inactkb);
370                 printf(" %s; %llu;", pfield(NULL, 0), smc->dirtykb);
371
372                 if (DISPLAY_MEM_ALL(a->opt_flags)) {
373                         printf(" %s; %llu;", pfield(NULL, 0), smc->anonpgkb);
374                         printf(" %s; %llu;", pfield(NULL, 0), smc->slabkb);
375                         printf(" %s; %llu;", pfield(NULL, 0), smc->kstackkb);
376                         printf(" %s; %llu;", pfield(NULL, 0), smc->pgtblkb);
377                         printf(" %s; %llu;", pfield(NULL, 0), smc->vmusedkb);
378                 }
379                 printf("\n");
380         }
381
382         if (DISPLAY_SWAP(a->opt_flags)) {
383                 printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, SECOND), smc->frskb);
384                 printf(" kbttlswp; %llu;", smc->tlskb);
385                 pfield(NULL, 0); /* Skip kbswpused */
386                 pfield(NULL, 0); /* Skip %swpused */
387                 printf(" %s; %llu;", pfield(NULL, 0), smc->caskb);
388                 printf("\n");
389         }
390 }
391
392 /*
393  ***************************************************************************
394  * Display kernel tables statistics in raw format.
395  *
396  * IN:
397  * @a           Activity structure with statistics.
398  * @timestr     Time for current statistics sample.
399  * @curr        Index in array for current sample statistics.
400  ***************************************************************************
401  */
402 __print_funct_t raw_print_ktables_stats(struct activity *a, char *timestr, int curr)
403 {
404         struct stats_ktables
405                 *skc = (struct stats_ktables *) a->buf[curr];
406
407         printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), skc->dentry_stat);
408         printf(" %s; %llu;", pfield(NULL, 0), skc->file_used);
409         printf(" %s; %llu;", pfield(NULL, 0), skc->inode_used);
410         printf(" %s; %llu;", pfield(NULL, 0), skc->pty_nr);
411         printf("\n");
412 }
413
414 /*
415  ***************************************************************************
416  * Display queue and load statistics in raw format.
417  *
418  * IN:
419  * @a           Activity structure with statistics.
420  * @timestr     Time for current statistics sample.
421  * @curr        Index in array for current sample statistics.
422  ***************************************************************************
423  */
424 __print_funct_t raw_print_queue_stats(struct activity *a, char *timestr, int curr)
425 {
426         struct stats_queue
427                 *sqc = (struct stats_queue *) a->buf[curr];
428
429         printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), sqc->nr_running);
430         printf(" %s; %llu;", pfield(NULL, 0), sqc->nr_threads);
431         printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_1);
432         printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_5);
433         printf(" %s; %u;", pfield(NULL, 0), sqc->load_avg_15);
434         printf(" %s; %llu;", pfield(NULL, 0), sqc->procs_blocked);
435         printf("\n");
436 }
437
438 /*
439  ***************************************************************************
440  * Display serial lines statistics in raw format.
441  *
442  * IN:
443  * @a           Activity structure with statistics.
444  * @timestr     Time for current statistics sample.
445  * @curr        Index in array for current sample statistics.
446  ***************************************************************************
447  */
448 __print_funct_t raw_print_serial_stats(struct activity *a, char *timestr, int curr)
449 {
450         int i, j, j0, found;
451         struct stats_serial *ssc, *ssp;
452
453         for (i = 0; i < a->nr[curr]; i++) {
454
455                 found = FALSE;
456                 ssc = (struct stats_serial *) ((char *) a->buf[curr]  + i * a->msize);
457
458                 if (a->nr[!curr] > 0) {
459
460                         /* Look for corresponding serial line in previous iteration */
461                         j = i;
462
463                         if (j >= a->nr[!curr]) {
464                                 j = a->nr[!curr] - 1;
465                         }
466
467                         j0 = j;
468
469                         do {
470                                 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + j * a->msize);
471                                 if (ssc->line == ssp->line) {
472                                         found = TRUE;
473                                         break;
474                                 }
475                                 if (++j >= a->nr[!curr]) {
476                                         j = 0;
477                                 }
478                         }
479                         while (j != j0);
480                 }
481
482                 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
483                 if (!found && DISPLAY_DEBUG_MODE(flags)) {
484                         printf(" [NEW]");
485                 }
486                 printf("; %u;", ssc->line);
487                 if (!found) {
488                         printf("\n");
489                         continue;
490                 }
491
492                 printf(" %s", pfield(NULL, 0));
493                 pval((unsigned long long) ssp->rx, (unsigned long long)ssc->rx);
494                 printf(" %s", pfield(NULL, 0));
495                 pval((unsigned long long) ssp->tx, (unsigned long long) ssc->tx);
496                 printf(" %s", pfield(NULL, 0));
497                 pval((unsigned long long) ssp->frame, (unsigned long long) ssc->frame);
498                 printf(" %s", pfield(NULL, 0));
499                 pval((unsigned long long) ssp->parity, (unsigned long long) ssc->parity);
500                 printf(" %s", pfield(NULL, 0));
501                 pval((unsigned long long) ssp->brk, (unsigned long long) ssc->brk);
502                 printf(" %s", pfield(NULL, 0));
503                 pval((unsigned long long) ssp->overrun, (unsigned long long) ssc->overrun);
504                 printf("\n");
505         }
506 }
507
508 /*
509  ***************************************************************************
510  * Display disks statistics in raw format.
511  *
512  * IN:
513  * @a           Activity structure with statistics.
514  * @timestr     Time for current statistics sample.
515  * @curr        Index in array for current sample statistics.
516  ***************************************************************************
517  */
518 __print_funct_t raw_print_disk_stats(struct activity *a, char *timestr, int curr)
519 {
520         int i, j;
521         struct stats_disk *sdc, *sdp, sdpzero;
522         char *dev_name;
523
524         memset(&sdpzero, 0, STATS_DISK_SIZE);
525
526         for (i = 0; i < a->nr[curr]; i++) {
527
528                 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
529
530                 /* Get device name */
531                 dev_name = get_sa_devname(sdc->major, sdc->minor, flags);
532
533                 if (a->item_list != NULL) {
534                         /* A list of devices has been entered on the command line */
535                         if (!search_list_item(a->item_list, dev_name))
536                                 /* Device not found */
537                                 continue;
538                 }
539
540                 printf("%s; major; %u; minor; %u; %s",
541                        timestr, sdc->major, sdc->minor, pfield(a->hdr_line, FIRST));
542
543                 j = check_disk_reg(a, curr, !curr, i);
544                 if (j < 0) {
545                         /* This is a newly registered interface. Previous stats are zero */
546                         sdp = &sdpzero;
547                         if (DISPLAY_DEBUG_MODE(flags)) {
548                                 printf(" [%s]", j == -1 ? "NEW" : "BCK");
549                         }
550                 }
551                 else {
552                         sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
553                 }
554
555                 printf("; %s;", dev_name);
556                 printf(" %s", pfield(NULL, 0));
557                 pval(sdp->nr_ios, sdc->nr_ios);
558                 printf(" %s", pfield(NULL, 0));
559                 pval((unsigned long long) sdp->rd_sect, (unsigned long long) sdc->rd_sect);
560                 printf(" %s", pfield(NULL, 0));
561                 pval((unsigned long long) sdp->wr_sect, (unsigned long long) sdc->wr_sect);
562                 printf(" tot_ticks");
563                 pval((unsigned long long) sdp->tot_ticks, (unsigned long long) sdc->tot_ticks);
564                 pfield(NULL, 0); /* Skip areq-sz */
565                 printf(" %s", pfield(NULL, 0));
566                 pval((unsigned long long) sdp->rq_ticks, (unsigned long long) sdc->rq_ticks);
567                 printf("\n");
568         }
569 }
570
571 /*
572  ***************************************************************************
573  * Display network interfaces statistics in raw format.
574  *
575  * IN:
576  * @a           Activity structure with statistics.
577  * @timestr     Time for current statistics sample.
578  * @curr        Index in array for current sample statistics.
579  ***************************************************************************
580  */
581 __print_funct_t raw_print_net_dev_stats(struct activity *a, char *timestr, int curr)
582 {
583         int i, j;
584         struct stats_net_dev *sndc, *sndp, sndzero;
585
586         memset(&sndzero, 0, STATS_NET_DEV_SIZE);
587
588         for (i = 0; i < a->nr[curr]; i++) {
589
590                 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
591
592                 if (a->item_list != NULL) {
593                         /* A list of devices has been entered on the command line */
594                         if (!search_list_item(a->item_list, sndc->interface))
595                                 /* Device not found */
596                                 continue;
597                 }
598
599                 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
600                 j = check_net_dev_reg(a, curr, !curr, i);
601                 if (j < 0) {
602                         /* This is a newly registered interface. Previous stats are zero */
603                         sndp = &sndzero;
604                         if (DISPLAY_DEBUG_MODE(flags)) {
605                                 printf(" [%s]", j == -1 ? "NEW" : "BCK");
606                         }
607                 }
608                 else {
609                         sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
610                 }
611                 printf("; %s;", sndc->interface);
612
613                 printf(" %s", pfield(NULL, 0));
614                 pval(sndp->rx_packets, sndc->rx_packets);
615                 printf(" %s", pfield(NULL, 0));
616                 pval(sndp->tx_packets, sndc->tx_packets);
617                 printf(" %s", pfield(NULL, 0));
618                 pval(sndp->rx_bytes, sndc->rx_bytes);
619                 printf(" %s", pfield(NULL, 0));
620                 pval(sndp->tx_bytes, sndc->tx_bytes);
621                 printf(" %s", pfield(NULL, 0));
622                 pval(sndp->rx_compressed, sndc->rx_compressed);
623                 printf(" %s", pfield(NULL, 0));
624                 pval(sndp->tx_compressed, sndc->tx_compressed);
625                 printf(" %s", pfield(NULL, 0));
626                 pval(sndp->multicast, sndc->multicast);
627                 printf(" speed; %u; duplex; %u;\n", sndc->speed, sndc->duplex);
628         }
629 }
630
631 /*
632  ***************************************************************************
633  * Display network interfaces errors statistics in raw format.
634  *
635  * IN:
636  * @a           Activity structure with statistics.
637  * @timestr     Time for current statistics sample.
638  * @curr        Index in array for current sample statistics.
639  ***************************************************************************
640  */
641 __print_funct_t raw_print_net_edev_stats(struct activity *a, char *timestr, int curr)
642 {
643         int i, j;
644         struct stats_net_edev *snedc, *snedp, snedzero;
645
646         memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
647
648         for (i = 0; i < a->nr[curr]; i++) {
649
650                 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
651
652                 if (a->item_list != NULL) {
653                         /* A list of devices has been entered on the command line */
654                         if (!search_list_item(a->item_list, snedc->interface))
655                                 /* Device not found */
656                                 continue;
657                 }
658
659                 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
660                 j = check_net_edev_reg(a, curr, !curr, i);
661                 if (j < 0) {
662                         /* This is a newly registered interface. Previous stats are zero */
663                         snedp = &snedzero;
664                         if (DISPLAY_DEBUG_MODE(flags)) {
665                                 printf(" [%s]", j == -1 ? "NEW" : "BCK");
666                         }
667                 }
668                 else {
669                         snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
670                 }
671                 printf("; %s;", snedc->interface);
672
673                 printf(" %s", pfield(NULL, 0));
674                 pval(snedp->rx_errors, snedc->rx_errors);
675                 printf(" %s", pfield(NULL, 0));
676                 pval(snedp->tx_errors, snedc->tx_errors);
677                 printf(" %s", pfield(NULL, 0));
678                 pval(snedp->collisions, snedc->collisions);
679                 printf(" %s", pfield(NULL, 0));
680                 pval(snedp->rx_dropped, snedc->rx_dropped);
681                 printf(" %s", pfield(NULL, 0));
682                 pval(snedp->tx_dropped, snedc->tx_dropped);
683                 printf(" %s", pfield(NULL, 0));
684                 pval(snedp->tx_carrier_errors, snedc->tx_carrier_errors);
685                 printf(" %s", pfield(NULL, 0));
686                 pval(snedp->rx_frame_errors, snedc->rx_frame_errors);
687                 printf(" %s", pfield(NULL, 0));
688                 pval(snedp->rx_fifo_errors, snedc->rx_fifo_errors);
689                 printf(" %s", pfield(NULL, 0));
690                 pval(snedp->tx_fifo_errors, snedc->tx_fifo_errors);
691                 printf("\n");
692         }
693 }
694
695 /*
696  ***************************************************************************
697  * Display NFS client statistics in raw format.
698  *
699  * IN:
700  * @a           Activity structure with statistics.
701  * @timestr     Time for current statistics sample.
702  * @curr        Index in array for current sample statistics.
703  ***************************************************************************
704  */
705 __print_funct_t raw_print_net_nfs_stats(struct activity *a, char *timestr, int curr)
706 {
707         struct stats_net_nfs
708                 *snnc = (struct stats_net_nfs *) a->buf[curr],
709                 *snnp = (struct stats_net_nfs *) a->buf[!curr];
710
711         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
712         pval((unsigned long long) snnp->nfs_rpccnt, (unsigned long long) snnc->nfs_rpccnt);
713         printf(" %s", pfield(NULL, 0));
714         pval((unsigned long long) snnp->nfs_rpcretrans, (unsigned long long) snnc->nfs_rpcretrans);
715         printf(" %s", pfield(NULL, 0));
716         pval((unsigned long long) snnp->nfs_readcnt, (unsigned long long) snnc->nfs_readcnt);
717         printf(" %s", pfield(NULL, 0));
718         pval((unsigned long long) snnp->nfs_writecnt, (unsigned long long) snnc->nfs_writecnt);
719         printf(" %s", pfield(NULL, 0));
720         pval((unsigned long long) snnp->nfs_accesscnt, (unsigned long long) snnc->nfs_accesscnt);
721         printf(" %s", pfield(NULL, 0));
722         pval((unsigned long long) snnp->nfs_getattcnt, (unsigned long long) snnc->nfs_getattcnt);
723         printf("\n");
724 }
725
726 /*
727  ***************************************************************************
728  * Display NFS server statistics in raw format.
729  *
730  * IN:
731  * @a           Activity structure with statistics.
732  * @timestr     Time for current statistics sample.
733  * @curr        Index in array for current sample statistics.
734  ***************************************************************************
735  */
736 __print_funct_t raw_print_net_nfsd_stats(struct activity *a, char *timestr, int curr)
737 {
738         struct stats_net_nfsd
739                 *snndc = (struct stats_net_nfsd *) a->buf[curr],
740                 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
741
742         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
743         pval((unsigned long long) snndp->nfsd_rpccnt, (unsigned long long) snndc->nfsd_rpccnt);
744         printf(" %s", pfield(NULL, 0));
745         pval((unsigned long long) snndp->nfsd_rpcbad, (unsigned long long) snndc->nfsd_rpcbad);
746         printf(" %s", pfield(NULL, 0));
747         pval((unsigned long long) snndp->nfsd_netcnt, (unsigned long long) snndc->nfsd_netcnt);
748         printf(" %s", pfield(NULL, 0));
749         pval((unsigned long long) snndp->nfsd_netudpcnt, (unsigned long long) snndc->nfsd_netudpcnt);
750         printf(" %s", pfield(NULL, 0));
751         pval((unsigned long long) snndp->nfsd_nettcpcnt, (unsigned long long) snndc->nfsd_nettcpcnt);
752         printf(" %s", pfield(NULL, 0));
753         pval((unsigned long long) snndp->nfsd_rchits, (unsigned long long) snndc->nfsd_rchits);
754         printf(" %s", pfield(NULL, 0));
755         pval((unsigned long long) snndp->nfsd_rcmisses, (unsigned long long) snndc->nfsd_rcmisses);
756         printf(" %s", pfield(NULL, 0));
757         pval((unsigned long long) snndp->nfsd_readcnt, (unsigned long long) snndc->nfsd_readcnt);
758         printf(" %s", pfield(NULL, 0));
759         pval((unsigned long long) snndp->nfsd_writecnt, (unsigned long long) snndc->nfsd_writecnt);
760         printf(" %s", pfield(NULL, 0));
761         pval((unsigned long long) snndp->nfsd_accesscnt, (unsigned long long) snndc->nfsd_accesscnt);
762         printf(" %s", pfield(NULL, 0));
763         pval((unsigned long long) snndp->nfsd_getattcnt, (unsigned long long) snndc->nfsd_getattcnt);
764         printf("\n");
765 }
766
767 /*
768  ***************************************************************************
769  * Display network socket statistics in raw format.
770  *
771  * IN:
772  * @a           Activity structure with statistics.
773  * @timestr     Time for current statistics sample.
774  * @curr        Index in array for current sample statistics.
775  ***************************************************************************
776  */
777 __print_funct_t raw_print_net_sock_stats(struct activity *a, char *timestr, int curr)
778 {
779         struct stats_net_sock
780                 *snsc = (struct stats_net_sock *) a->buf[curr];
781
782         printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->sock_inuse);
783         printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_inuse);
784         printf(" %s; %u;", pfield(NULL, 0), snsc->udp_inuse);
785         printf(" %s; %u;", pfield(NULL, 0), snsc->raw_inuse);
786         printf(" %s; %u;", pfield(NULL, 0), snsc->frag_inuse);
787         printf(" %s; %u;", pfield(NULL, 0), snsc->tcp_tw);
788         printf("\n");
789 }
790
791 /*
792  ***************************************************************************
793  * Display IP network statistics in raw format.
794  *
795  * IN:
796  * @a           Activity structure with statistics.
797  * @timestr     Time for current statistics sample.
798  * @curr        Index in array for current sample statistics.
799  ***************************************************************************
800  */
801 __print_funct_t raw_print_net_ip_stats(struct activity *a, char *timestr, int curr)
802 {
803         struct stats_net_ip
804                 *snic = (struct stats_net_ip *) a->buf[curr],
805                 *snip = (struct stats_net_ip *) a->buf[!curr];
806
807         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
808         pval(snip->InReceives, snic->InReceives);
809         printf(" %s", pfield(NULL, 0));
810         pval(snip->ForwDatagrams, snic->ForwDatagrams);
811         printf(" %s", pfield(NULL, 0));
812         pval(snip->InDelivers, snic->InDelivers);
813         printf(" %s", pfield(NULL, 0));
814         pval(snip->OutRequests, snic->OutRequests);
815         printf(" %s", pfield(NULL, 0));
816         pval(snip->ReasmReqds, snic->ReasmReqds);
817         printf(" %s", pfield(NULL, 0));
818         pval(snip->ReasmOKs, snic->ReasmOKs);
819         printf(" %s", pfield(NULL, 0));
820         pval(snip->FragOKs, snic->FragOKs);
821         printf(" %s", pfield(NULL, 0));
822         pval(snip->FragCreates, snic->FragCreates);
823         printf("\n");
824 }
825
826 /*
827  ***************************************************************************
828  * Display IP network errors statistics in raw format.
829  *
830  * IN:
831  * @a           Activity structure with statistics.
832  * @timestr     Time for current statistics sample.
833  * @curr        Index in array for current sample statistics.
834  ***************************************************************************
835  */
836 __print_funct_t raw_print_net_eip_stats(struct activity *a, char *timestr, int curr)
837 {
838         struct stats_net_eip
839                 *sneic = (struct stats_net_eip *) a->buf[curr],
840                 *sneip = (struct stats_net_eip *) a->buf[!curr];
841
842         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
843         pval(sneip->InHdrErrors, sneic->InHdrErrors);
844         printf(" %s", pfield(NULL, 0));
845         pval(sneip->InAddrErrors, sneic->InAddrErrors);
846         printf(" %s", pfield(NULL, 0));
847         pval(sneip->InUnknownProtos, sneic->InUnknownProtos);
848         printf(" %s", pfield(NULL, 0));
849         pval(sneip->InDiscards, sneic->InDiscards);
850         printf(" %s", pfield(NULL, 0));
851         pval(sneip->OutDiscards, sneic->OutDiscards);
852         printf(" %s", pfield(NULL, 0));
853         pval(sneip->OutNoRoutes, sneic->OutNoRoutes);
854         printf(" %s", pfield(NULL, 0));
855         pval(sneip->ReasmFails, sneic->ReasmFails);
856         printf(" %s", pfield(NULL, 0));
857         pval(sneip->FragFails, sneic->FragFails);
858         printf("\n");
859 }
860
861 /*
862  ***************************************************************************
863  * Display ICMP network statistics in raw format.
864  *
865  * IN:
866  * @a           Activity structure with statistics.
867  * @timestr     Time for current statistics sample.
868  * @curr        Index in array for current sample statistics.
869  ***************************************************************************
870  */
871 __print_funct_t raw_print_net_icmp_stats(struct activity *a, char *timestr, int curr)
872 {
873         struct stats_net_icmp
874                 *snic = (struct stats_net_icmp *) a->buf[curr],
875                 *snip = (struct stats_net_icmp *) a->buf[!curr];
876
877         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
878         pval((unsigned long long) snip->InMsgs, (unsigned long long) snic->InMsgs);
879         printf(" %s", pfield(NULL, 0));
880         pval((unsigned long long) snip->OutMsgs, (unsigned long long) snic->OutMsgs);
881         printf(" %s", pfield(NULL, 0));
882         pval((unsigned long long) snip->InEchos, (unsigned long long) snic->InEchos);
883         printf(" %s", pfield(NULL, 0));
884         pval((unsigned long long) snip->InEchoReps, (unsigned long long) snic->InEchoReps);
885         printf(" %s", pfield(NULL, 0));
886         pval((unsigned long long) snip->OutEchos, (unsigned long long) snic->OutEchos);
887         printf(" %s", pfield(NULL, 0));
888         pval((unsigned long long) snip->OutEchoReps, (unsigned long long) snic->OutEchoReps);
889         printf(" %s", pfield(NULL, 0));
890         pval((unsigned long long) snip->InTimestamps, (unsigned long long) snic->InTimestamps);
891         printf(" %s", pfield(NULL, 0));
892         pval((unsigned long long) snip->InTimestampReps, (unsigned long long) snic->InTimestampReps);
893         printf(" %s", pfield(NULL, 0));
894         pval((unsigned long long) snip->OutTimestamps, (unsigned long long) snic->OutTimestamps);
895         printf(" %s", pfield(NULL, 0));
896         pval((unsigned long long) snip->OutTimestampReps, (unsigned long long) snic->OutTimestampReps);
897         printf(" %s", pfield(NULL, 0));
898         pval((unsigned long long) snip->InAddrMasks, (unsigned long long) snic->InAddrMasks);
899         printf(" %s", pfield(NULL, 0));
900         pval((unsigned long long) snip->InAddrMaskReps, (unsigned long long) snic->InAddrMaskReps);
901         printf(" %s", pfield(NULL, 0));
902         pval((unsigned long long) snip->OutAddrMasks, (unsigned long long) snic->OutAddrMasks);
903         printf(" %s", pfield(NULL, 0));
904         pval((unsigned long long) snip->OutAddrMaskReps, (unsigned long long) snic->OutAddrMaskReps);
905         printf("\n");
906 }
907
908 /*
909  ***************************************************************************
910  * Display ICMP errors message statistics in raw format.
911  *
912  * IN:
913  * @a           Activity structure with statistics.
914  * @timestr     Time for current statistics sample.
915  * @curr        Index in array for current sample statistics.
916  ***************************************************************************
917  */
918 __print_funct_t raw_print_net_eicmp_stats(struct activity *a, char *timestr, int curr)
919 {
920         struct stats_net_eicmp
921                 *sneic = (struct stats_net_eicmp *) a->buf[curr],
922                 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
923
924         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
925         pval((unsigned long long) sneip->InErrors, (unsigned long long) sneic->InErrors);
926         printf(" %s", pfield(NULL, 0));
927         pval((unsigned long long) sneip->OutErrors, (unsigned long long) sneic->OutErrors);
928         printf(" %s", pfield(NULL, 0));
929         pval((unsigned long long) sneip->InDestUnreachs, (unsigned long long) sneic->InDestUnreachs);
930         printf(" %s", pfield(NULL, 0));
931         pval((unsigned long long) sneip->OutDestUnreachs, (unsigned long long) sneic->OutDestUnreachs);
932         printf(" %s", pfield(NULL, 0));
933         pval((unsigned long long) sneip->InTimeExcds, (unsigned long long) sneic->InTimeExcds);
934         printf(" %s", pfield(NULL, 0));
935         pval((unsigned long long) sneip->OutTimeExcds, (unsigned long long) sneic->OutTimeExcds);
936         printf(" %s", pfield(NULL, 0));
937         pval((unsigned long long) sneip->InParmProbs, (unsigned long long) sneic->InParmProbs);
938         printf(" %s", pfield(NULL, 0));
939         pval((unsigned long long) sneip->OutParmProbs, (unsigned long long) sneic->OutParmProbs);
940         printf(" %s", pfield(NULL, 0));
941         pval((unsigned long long) sneip->InSrcQuenchs, (unsigned long long) sneic->InSrcQuenchs);
942         printf(" %s", pfield(NULL, 0));
943         pval((unsigned long long) sneip->OutSrcQuenchs, (unsigned long long) sneic->OutSrcQuenchs);
944         printf(" %s", pfield(NULL, 0));
945         pval((unsigned long long) sneip->InRedirects, (unsigned long long) sneic->InRedirects);
946         printf(" %s", pfield(NULL, 0));
947         pval((unsigned long long) sneip->OutRedirects, (unsigned long long) sneic->OutRedirects);
948         printf("\n");
949 }
950
951 /*
952  ***************************************************************************
953  * Display TCP network statistics in raw format.
954  *
955  * IN:
956  * @a           Activity structure with statistics.
957  * @timestr     Time for current statistics sample.
958  * @curr        Index in array for current sample statistics.
959  ***************************************************************************
960  */
961 __print_funct_t raw_print_net_tcp_stats(struct activity *a, char *timestr, int curr)
962 {
963         struct stats_net_tcp
964                 *sntc = (struct stats_net_tcp *) a->buf[curr],
965                 *sntp = (struct stats_net_tcp *) a->buf[!curr];
966
967         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
968         pval((unsigned long long) sntp->ActiveOpens, (unsigned long long) sntc->ActiveOpens);
969         printf(" %s", pfield(NULL, 0));
970         pval((unsigned long long) sntp->PassiveOpens, (unsigned long long) sntc->PassiveOpens);
971         printf(" %s", pfield(NULL, 0));
972         pval((unsigned long long) sntp->InSegs, (unsigned long long) sntc->InSegs);
973         printf(" %s", pfield(NULL, 0));
974         pval((unsigned long long) sntp->OutSegs, (unsigned long long) sntc->OutSegs);
975         printf("\n");
976 }
977
978 /*
979  ***************************************************************************
980  * Display TCP network errors statistics in raw format.
981  *
982  * IN:
983  * @a           Activity structure with statistics.
984  * @timestr     Time for current statistics sample.
985  * @curr        Index in array for current sample statistics.
986  ***************************************************************************
987  */
988 __print_funct_t raw_print_net_etcp_stats(struct activity *a, char *timestr, int curr)
989 {
990         struct stats_net_etcp
991                 *snetc = (struct stats_net_etcp *) a->buf[curr],
992                 *snetp = (struct stats_net_etcp *) a->buf[!curr];
993
994         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
995         pval((unsigned long long) snetp->AttemptFails, (unsigned long long) snetc->AttemptFails);
996         printf(" %s", pfield(NULL, 0));
997         pval((unsigned long long) snetp->EstabResets, (unsigned long long) snetc->EstabResets);
998         printf(" %s", pfield(NULL, 0));
999         pval((unsigned long long) snetp->RetransSegs, (unsigned long long) snetc->RetransSegs);
1000         printf(" %s", pfield(NULL, 0));
1001         pval((unsigned long long) snetp->InErrs, (unsigned long long) snetc->InErrs);
1002         printf(" %s", pfield(NULL, 0));
1003         pval((unsigned long long) snetp->OutRsts, (unsigned long long) snetc->OutRsts);
1004         printf("\n");
1005 }
1006
1007 /*
1008  ***************************************************************************
1009  * Display UDP network statistics in raw format.
1010  *
1011  * IN:
1012  * @a           Activity structure with statistics.
1013  * @timestr     Time for current statistics sample.
1014  * @curr        Index in array for current sample statistics.
1015  ***************************************************************************
1016  */
1017 __print_funct_t raw_print_net_udp_stats(struct activity *a, char *timestr, int curr)
1018 {
1019         struct stats_net_udp
1020                 *snuc = (struct stats_net_udp *) a->buf[curr],
1021                 *snup = (struct stats_net_udp *) a->buf[!curr];
1022
1023         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1024         pval((unsigned long long) snup->InDatagrams, (unsigned long long) snuc->InDatagrams);
1025         printf(" %s", pfield(NULL, 0));
1026         pval((unsigned long long) snup->OutDatagrams, (unsigned long long) snuc->OutDatagrams);
1027         printf(" %s", pfield(NULL, 0));
1028         pval((unsigned long long) snup->NoPorts, (unsigned long long) snuc->NoPorts);
1029         printf(" %s", pfield(NULL, 0));
1030         pval((unsigned long long) snup->InErrors, (unsigned long long) snuc->InErrors);
1031         printf("\n");
1032 }
1033
1034 /*
1035  ***************************************************************************
1036  * Display IPv6 network socket statistics in raw format.
1037  *
1038  * IN:
1039  * @a           Activity structure with statistics.
1040  * @timestr     Time for current statistics sample.
1041  * @curr        Index in array for current sample statistics.
1042  ***************************************************************************
1043  */
1044 __print_funct_t raw_print_net_sock6_stats(struct activity *a, char *timestr, int curr)
1045 {
1046         struct stats_net_sock6
1047                 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1048
1049         printf("%s; %s; %u;", timestr, pfield(a->hdr_line, FIRST), snsc->tcp6_inuse);
1050         printf(" %s; %u;", pfield(NULL, 0), snsc->udp6_inuse);
1051         printf(" %s; %u;", pfield(NULL, 0), snsc->raw6_inuse);
1052         printf(" %s; %u;", pfield(NULL, 0), snsc->frag6_inuse);
1053         printf("\n");
1054 }
1055
1056 /*
1057  ***************************************************************************
1058  * Display IPv6 network statistics in raw format.
1059  *
1060  * IN:
1061  * @a           Activity structure with statistics.
1062  * @timestr     Time for current statistics sample.
1063  * @curr        Index in array for current sample statistics.
1064  ***************************************************************************
1065  */
1066 __print_funct_t raw_print_net_ip6_stats(struct activity *a, char *timestr, int curr)
1067 {
1068         struct stats_net_ip6
1069                 *snic = (struct stats_net_ip6 *) a->buf[curr],
1070                 *snip = (struct stats_net_ip6 *) a->buf[!curr];
1071
1072         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1073         pval(snip->InReceives6, snic->InReceives6);
1074         printf(" %s", pfield(NULL, 0));
1075         pval(snip->OutForwDatagrams6, snic->OutForwDatagrams6);
1076         printf(" %s", pfield(NULL, 0));
1077         pval(snip->InDelivers6, snic->InDelivers6);
1078         printf(" %s", pfield(NULL, 0));
1079         pval(snip->OutRequests6, snic->OutRequests6);
1080         printf(" %s", pfield(NULL, 0));
1081         pval(snip->ReasmReqds6, snic->ReasmReqds6);
1082         printf(" %s", pfield(NULL, 0));
1083         pval(snip->ReasmOKs6, snic->ReasmOKs6);
1084         printf(" %s", pfield(NULL, 0));
1085         pval(snip->InMcastPkts6, snic->InMcastPkts6);
1086         printf(" %s", pfield(NULL, 0));
1087         pval(snip->OutMcastPkts6, snic->OutMcastPkts6);
1088         printf(" %s", pfield(NULL, 0));
1089         pval(snip->FragOKs6, snic->FragOKs6);
1090         printf(" %s", pfield(NULL, 0));
1091         pval(snip->FragCreates6, snic->FragCreates6);
1092         printf("\n");
1093 }
1094
1095 /*
1096  ***************************************************************************
1097  * Display IPv6 network errors statistics in raw format.
1098  *
1099  * IN:
1100  * @a           Activity structure with statistics.
1101  * @timestr     Time for current statistics sample.
1102  * @curr        Index in array for current sample statistics.
1103  ***************************************************************************
1104  */
1105 __print_funct_t raw_print_net_eip6_stats(struct activity *a, char *timestr, int curr)
1106 {
1107         struct stats_net_eip6
1108                 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1109                 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1110
1111         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1112         pval(sneip->InHdrErrors6, sneic->InHdrErrors6);
1113         printf(" %s", pfield(NULL, 0));
1114         pval(sneip->InAddrErrors6, sneic->InAddrErrors6);
1115         printf(" %s", pfield(NULL, 0));
1116         pval(sneip->InUnknownProtos6, sneic->InUnknownProtos6);
1117         printf(" %s", pfield(NULL, 0));
1118         pval(sneip->InTooBigErrors6, sneic->InTooBigErrors6);
1119         printf(" %s", pfield(NULL, 0));
1120         pval(sneip->InDiscards6, sneic->InDiscards6);
1121         printf(" %s", pfield(NULL, 0));
1122         pval(sneip->OutDiscards6, sneic->OutDiscards6);
1123         printf(" %s", pfield(NULL, 0));
1124         pval(sneip->InNoRoutes6, sneic->InNoRoutes6);
1125         printf(" %s", pfield(NULL, 0));
1126         pval(sneip->OutNoRoutes6, sneic->OutNoRoutes6);
1127         printf(" %s", pfield(NULL, 0));
1128         pval(sneip->ReasmFails6, sneic->ReasmFails6);
1129         printf(" %s", pfield(NULL, 0));
1130         pval(sneip->FragFails6, sneic->FragFails6);
1131         printf(" %s", pfield(NULL, 0));
1132         pval(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6);
1133         printf("\n");
1134 }
1135
1136 /*
1137  ***************************************************************************
1138  * Display ICMPv6 network statistics in raw format.
1139  *
1140  * IN:
1141  * @a           Activity structure with statistics.
1142  * @timestr     Time for current statistics sample.
1143  * @curr        Index in array for current sample statistics.
1144  ***************************************************************************
1145  */
1146 __print_funct_t raw_print_net_icmp6_stats(struct activity *a, char *timestr, int curr)
1147 {
1148         struct stats_net_icmp6
1149                 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1150                 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1151
1152         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1153         pval((unsigned long long) snip->InMsgs6,
1154              (unsigned long long) snic->InMsgs6);
1155         printf(" %s", pfield(NULL, 0));
1156         pval((unsigned long long) snip->OutMsgs6,
1157              (unsigned long long) snic->OutMsgs6);
1158         printf(" %s", pfield(NULL, 0));
1159         pval((unsigned long long) snip->InEchos6,
1160              (unsigned long long) snic->InEchos6);
1161         printf(" %s", pfield(NULL, 0));
1162         pval((unsigned long long) snip->InEchoReplies6,
1163              (unsigned long long) snic->InEchoReplies6);
1164         printf(" %s", pfield(NULL, 0));
1165         pval((unsigned long long) snip->OutEchoReplies6,
1166              (unsigned long long) snic->OutEchoReplies6);
1167         printf(" %s", pfield(NULL, 0));
1168         pval((unsigned long long) snip->InGroupMembQueries6,
1169              (unsigned long long) snic->InGroupMembQueries6);
1170         printf(" %s", pfield(NULL, 0));
1171         pval((unsigned long long) snip->InGroupMembResponses6,
1172              (unsigned long long) snic->InGroupMembResponses6);
1173         printf(" %s", pfield(NULL, 0));
1174         pval((unsigned long long) snip->OutGroupMembResponses6,
1175              (unsigned long long) snic->OutGroupMembResponses6);
1176         printf(" %s", pfield(NULL, 0));
1177         pval((unsigned long long) snip->InGroupMembReductions6,
1178              (unsigned long long) snic->InGroupMembReductions6);
1179         printf(" %s", pfield(NULL, 0));
1180         pval((unsigned long long) snip->OutGroupMembReductions6,
1181              (unsigned long long) snic->OutGroupMembReductions6);
1182         printf(" %s", pfield(NULL, 0));
1183         pval((unsigned long long) snip->InRouterSolicits6,
1184              (unsigned long long) snic->InRouterSolicits6);
1185         printf(" %s", pfield(NULL, 0));
1186         pval((unsigned long long) snip->OutRouterSolicits6,
1187              (unsigned long long) snic->OutRouterSolicits6);
1188         printf(" %s", pfield(NULL, 0));
1189         pval((unsigned long long) snip->InRouterAdvertisements6,
1190              (unsigned long long) snic->InRouterAdvertisements6);
1191         printf(" %s", pfield(NULL, 0));
1192         pval((unsigned long long) snip->InNeighborSolicits6,
1193              (unsigned long long) snic->InNeighborSolicits6);
1194         printf(" %s", pfield(NULL, 0));
1195         pval((unsigned long long) snip->OutNeighborSolicits6,
1196              (unsigned long long) snic->OutNeighborSolicits6);
1197         printf(" %s", pfield(NULL, 0));
1198         pval((unsigned long long) snip->InNeighborAdvertisements6,
1199              (unsigned long long) snic->InNeighborAdvertisements6);
1200         printf(" %s", pfield(NULL, 0));
1201         pval((unsigned long long) snip->OutNeighborAdvertisements6,
1202              (unsigned long long) snic->OutNeighborAdvertisements6);
1203         printf("\n");
1204 }
1205
1206 /*
1207  ***************************************************************************
1208  * Display ICMPv6 error messages statistics in rw format.
1209  *
1210  * IN:
1211  * @a           Activity structure with statistics.
1212  * @timestr     Time for current statistics sample.
1213  * @curr        Index in array for current sample statistics.
1214  ***************************************************************************
1215  */
1216 __print_funct_t raw_print_net_eicmp6_stats(struct activity *a, char *timestr, int curr)
1217 {
1218         struct stats_net_eicmp6
1219                 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1220                 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
1221
1222         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1223         pval((unsigned long long) sneip->InErrors6, (unsigned long long) sneic->InErrors6);
1224         printf(" %s", pfield(NULL, 0));
1225         pval((unsigned long long) sneip->InDestUnreachs6, (unsigned long long) sneic->InDestUnreachs6);
1226         printf(" %s", pfield(NULL, 0));
1227         pval((unsigned long long) sneip->OutDestUnreachs6, (unsigned long long) sneic->OutDestUnreachs6);
1228         printf(" %s", pfield(NULL, 0));
1229         pval((unsigned long long) sneip->InTimeExcds6, (unsigned long long) sneic->InTimeExcds6);
1230         printf(" %s", pfield(NULL, 0));
1231         pval((unsigned long long) sneip->OutTimeExcds6, (unsigned long long) sneic->OutTimeExcds6);
1232         printf(" %s", pfield(NULL, 0));
1233         pval((unsigned long long) sneip->InParmProblems6, (unsigned long long) sneic->InParmProblems6);
1234         printf(" %s", pfield(NULL, 0));
1235         pval((unsigned long long) sneip->OutParmProblems6, (unsigned long long) sneic->OutParmProblems6);
1236         printf(" %s", pfield(NULL, 0));
1237         pval((unsigned long long) sneip->InRedirects6, (unsigned long long) sneic->InRedirects6);
1238         printf(" %s", pfield(NULL, 0));
1239         pval((unsigned long long) sneip->OutRedirects6, (unsigned long long) sneic->OutRedirects6);
1240         printf(" %s", pfield(NULL, 0));
1241         pval((unsigned long long) sneip->InPktTooBigs6, (unsigned long long) sneic->InPktTooBigs6);
1242         printf(" %s", pfield(NULL, 0));
1243         pval((unsigned long long) sneip->OutPktTooBigs6, (unsigned long long) sneic->OutPktTooBigs6);
1244         printf("\n");
1245 }
1246
1247 /*
1248  ***************************************************************************
1249  * Display UDPv6 network statistics in raw format.
1250  *
1251  * IN:
1252  * @a           Activity structure with statistics.
1253  * @timestr     Time for current statistics sample.
1254  * @curr        Index in array for current sample statistics.
1255  ***************************************************************************
1256  */
1257 __print_funct_t raw_print_net_udp6_stats(struct activity *a, char *timestr, int curr)
1258 {
1259         struct stats_net_udp6
1260                 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1261                 *snup = (struct stats_net_udp6 *) a->buf[!curr];
1262
1263         printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1264         pval((unsigned long long) snup->InDatagrams6, (unsigned long long) snuc->InDatagrams6);
1265         printf(" %s", pfield(NULL, 0));
1266         pval((unsigned long long) snup->OutDatagrams6, (unsigned long long) snuc->OutDatagrams6);
1267         printf(" %s", pfield(NULL, 0));
1268         pval((unsigned long long) snup->NoPorts6, (unsigned long long) snuc->NoPorts6);
1269         printf(" %s", pfield(NULL, 0));
1270         pval((unsigned long long) snup->InErrors6, (unsigned long long) snuc->InErrors6);
1271         printf("\n");
1272 }
1273
1274 /*
1275  ***************************************************************************
1276  * Display CPU frequency statistics in raw format.
1277  *
1278  * IN:
1279  * @a           Activity structure with statistics.
1280  * @timestr     Time for current statistics sample.
1281  * @curr        Index in array for current sample statistics.
1282  ***************************************************************************
1283  */
1284 __print_funct_t raw_print_pwr_cpufreq_stats(struct activity *a, char *timestr, int curr)
1285 {
1286         int i;
1287         struct stats_pwr_cpufreq *spc;
1288
1289         for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1290
1291                 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1292
1293                 /* Should current CPU (including CPU "all") be displayed? */
1294                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1295                         /* Yes: Display it */
1296                         printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1297                         printf(" %s; %lu;\n", pfield(NULL, 0), spc->cpufreq);
1298                 }
1299         }
1300 }
1301
1302 /*
1303  ***************************************************************************
1304  * Display fan statistics in raw format.
1305  *
1306  * IN:
1307  * @a           Activity structure with statistics.
1308  * @timestr     Time for current statistics sample.
1309  * @curr        Index in array for current sample statistics.
1310  ***************************************************************************
1311  */
1312 __print_funct_t raw_print_pwr_fan_stats(struct activity *a, char *timestr, int curr)
1313 {
1314         int i;
1315         struct stats_pwr_fan *spc;
1316
1317         for (i = 0; i < a->nr[curr]; i++) {
1318                 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1319
1320                 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1321                 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1322                 printf(" %s; %f;", pfield(NULL, 0), spc->rpm);
1323                 printf(" rpm_min; %f;\n", spc->rpm_min);
1324         }
1325 }
1326
1327 /*
1328  ***************************************************************************
1329  * Display temperature statistics in raw format.
1330  *
1331  * IN:
1332  * @a           Activity structure with statistics.
1333  * @timestr     Time for current statistics sample.
1334  * @curr        Index in array for current sample statistics.
1335  ***************************************************************************
1336  */
1337 __print_funct_t raw_print_pwr_temp_stats(struct activity *a, char *timestr, int curr)
1338 {
1339         int i;
1340         struct stats_pwr_temp *spc;
1341
1342         for (i = 0; i < a->nr[curr]; i++) {
1343                 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1344
1345                 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i + 1);
1346                 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1347                 printf(" %s; %f;", pfield(NULL, 0), spc->temp);
1348                 printf(" temp_min; %f;", spc->temp_min);
1349                 printf(" temp_max; %f;\n", spc->temp_max);
1350         }
1351 }
1352
1353 /*
1354  ***************************************************************************
1355  * Display voltage inputs statistics in raw format.
1356  *
1357  * IN:
1358  * @a           Activity structure with statistics.
1359  * @timestr     Time for current statistics sample.
1360  * @curr        Index in array for current sample statistics.
1361  ***************************************************************************
1362  */
1363 __print_funct_t raw_print_pwr_in_stats(struct activity *a, char *timestr, int curr)
1364 {
1365         int i;
1366         struct stats_pwr_in *spc;
1367
1368         for (i = 0; i < a->nr[curr]; i++) {
1369                 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
1370
1371                 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i);
1372                 printf(" %s; %s;", pfield(NULL, 0), spc->device);
1373                 printf(" %s; %f;", pfield(NULL, 0), spc->in);
1374                 printf(" in_min; %f;", spc->in_min);
1375                 printf(" in_max; %f;\n", spc->in_max);
1376         }
1377 }
1378
1379 /*
1380  ***************************************************************************
1381  * Display huge pages statistics in raw format.
1382  *
1383  * IN:
1384  * @a           Activity structure with statistics.
1385  * @timestr     Time for current statistics sample.
1386  * @curr        Index in array for current sample statistics.
1387  ***************************************************************************
1388  */
1389 __print_funct_t raw_print_huge_stats(struct activity *a, char *timestr, int curr)
1390 {
1391         struct stats_huge
1392                 *smc = (struct stats_huge *) a->buf[curr];
1393
1394         printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frhkb);
1395         printf(" hugtotal; %llu;\n", smc->tlhkb);
1396 }
1397
1398 /*
1399  ***************************************************************************
1400  * Display weighted CPU frequency statistics in raw format.
1401  *
1402  * IN:
1403  * @a           Activity structure with statistics.
1404  * @timestr     Time for current statistics sample.
1405  * @curr        Index in array for current sample statistics.
1406  ***************************************************************************
1407  */
1408 __print_funct_t raw_print_pwr_wghfreq_stats(struct activity *a, char *timestr, int curr)
1409 {
1410         int i, k;
1411         struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
1412
1413         for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
1414
1415                 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr]  + i * a->msize * a->nr2);
1416                 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
1417
1418                 /* Should current CPU (including CPU "all") be displayed? */
1419                 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1420                         /* No */
1421                         continue;
1422
1423                 printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
1424
1425                 for (k = 0; k < a->nr2; k++) {
1426
1427                         spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
1428                         if (!spc_k->freq)
1429                                 break;
1430                         spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
1431
1432                         printf(" freq; %lu;", spc_k->freq);
1433                         printf(" tminst");
1434                         pval(spp_k->time_in_state, spc_k->time_in_state);
1435                 }
1436                 printf("\n");
1437         }
1438 }
1439
1440 /*
1441  ***************************************************************************
1442  * Display USB devices statistics in raw format.
1443  *
1444  * IN:
1445  * @a           Activity structure with statistics.
1446  * @timestr     Time for current statistics sample.
1447  * @curr        Index in array for current sample statistics.
1448  ***************************************************************************
1449  */
1450 __print_funct_t raw_print_pwr_usb_stats(struct activity *a, char *timestr, int curr)
1451 {
1452         int i;
1453         struct stats_pwr_usb *suc;
1454
1455         for (i = 0; i < a->nr[curr]; i++) {
1456                 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
1457
1458                 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST), suc->manufacturer);
1459                 printf(" %s; \"%s\";", pfield(NULL, 0), suc->product);
1460                 printf(" %s; %d;", pfield(NULL, 0), suc->bus_nr);
1461                 printf(" %s; %x;", pfield(NULL, 0), suc->vendor_id);
1462                 printf(" %s; %x;", pfield(NULL, 0), suc->product_id);
1463                 printf(" %s; %u;\n", pfield(NULL, 0), suc->bmaxpower);
1464         }
1465 }
1466
1467 /*
1468  ***************************************************************************
1469  * Display filesystems statistics in raw format.
1470  *
1471  * IN:
1472  * @a           Activity structure with statistics.
1473  * @timestr     Time for current statistics sample.
1474  * @curr        Index in array for current sample statistics.
1475  ***************************************************************************
1476  */
1477 __print_funct_t raw_print_filesystem_stats(struct activity *a, char *timestr, int curr)
1478 {
1479         int i;
1480         struct stats_filesystem *sfc;
1481
1482         for (i = 0; i < a->nr[curr]; i++) {
1483                 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
1484
1485                 if (a->item_list != NULL) {
1486                         /* A list of devices has been entered on the command line */
1487                         if (!search_list_item(a->item_list,
1488                                               DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name))
1489                                 /* Device not found */
1490                                 continue;
1491                 }
1492
1493                 printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST + DISPLAY_MOUNT(a->opt_flags)),
1494                        DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name);
1495                 printf(" f_bfree; %llu;", sfc->f_bfree);
1496                 printf(" f_blocks; %llu;", sfc->f_blocks);
1497                 printf(" f_bavail; %llu;", sfc->f_bavail);
1498                 pfield(NULL, 0); /* Skip MBfsfree */
1499                 pfield(NULL, 0); /* Skip MBfsused */
1500                 pfield(NULL, 0); /* Skip %fsused */
1501                 pfield(NULL, 0); /* Skip %ufsused */
1502                 printf(" %s; %llu;", pfield(NULL, 0), sfc->f_ffree);
1503                 printf(" f_files; %llu;\n", sfc->f_files);
1504
1505         }
1506 }
1507
1508 /*
1509  ***************************************************************************
1510  * Display Fibre Channel HBA statistics in raw format.
1511  *
1512  * IN:
1513  * @a           Activity structure with statistics.
1514  * @timestr     Time for current statistics sample.
1515  * @curr        Index in array for current sample statistics.
1516  ***************************************************************************
1517  */
1518 __print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int curr)
1519 {
1520         int i, j, j0, found;
1521         struct stats_fchost *sfcc, *sfcp;
1522
1523         for (i = 0; i < a->nr[curr]; i++) {
1524
1525                 found = FALSE;
1526
1527                 if (a->nr[!curr] > 0) {
1528                         sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
1529
1530                         /* Look for corresponding structure in previous iteration */
1531                         j = i;
1532
1533                         if (j >= a->nr[!curr]) {
1534                                 j = a->nr[!curr] - 1;
1535                         }
1536
1537                         j0 = j;
1538
1539                         do {
1540                                 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
1541                                 if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
1542                                         found = TRUE;
1543                                         break;
1544                                 }
1545                                 if (++j >= a->nr[!curr]) {
1546                                         j = 0;
1547                                 }
1548                         }
1549                         while (j != j0);
1550                 }
1551
1552                 if (!found)
1553                         continue;
1554
1555                 printf("%s; %s; %s;", timestr, pfield(a->hdr_line, FIRST), sfcc->fchost_name);
1556                 printf(" %s", pfield(NULL, 0));
1557                 pval((unsigned long long) sfcp->f_rxframes, (unsigned long long) sfcc->f_rxframes);
1558                 printf(" %s", pfield(NULL, 0));
1559                 pval((unsigned long long) sfcp->f_txframes, (unsigned long long) sfcc->f_txframes);
1560                 printf(" %s", pfield(NULL, 0));
1561                 pval((unsigned long long) sfcp->f_rxwords, (unsigned long long) sfcc->f_rxwords);
1562                 printf(" %s", pfield(NULL, 0));
1563                 pval((unsigned long long) sfcp->f_txwords, (unsigned long long) sfcc->f_txwords);
1564                 printf("\n");
1565         }
1566 }
1567
1568 /*
1569  ***************************************************************************
1570  * Display softnet statistics in raw format.
1571  *
1572  * IN:
1573  * @a           Activity structure with statistics.
1574  * @timestr     Time for current statistics sample.
1575  * @curr        Index in array for current sample statistics.
1576  ***************************************************************************
1577  */
1578 __print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int curr)
1579 {
1580         int i;
1581         struct stats_softnet *ssnc, *ssnp;
1582
1583         /* @nr[curr] cannot normally be greater than @nr_ini */
1584         if (a->nr[curr] > a->nr_ini) {
1585                 a->nr_ini = a->nr[curr];
1586         }
1587
1588         /* Don't display CPU "all" which doesn't exist in file */
1589         for (i = 1; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
1590
1591                 /*
1592                  * The size of a->buf[...] CPU structure may be different from the default
1593                  * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1594                  * That's why we don't use a syntax like:
1595                  * ssnc = (struct stats_softnet *) a->buf[...] + i;
1596                  */
1597                 ssnc = (struct stats_softnet *) ((char *) a->buf[curr]  + i * a->msize);
1598                 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
1599
1600                 /*
1601                  * Note: a->nr is in [1, NR_CPUS + 1].
1602                  * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1603                  * Anyway, NR_CPUS may vary between the version of sysstat
1604                  * used by sadc to create a file, and the version of sysstat
1605                  * used by sar to read it...
1606                  */
1607
1608                 /* Should current CPU (including CPU "all") be displayed? */
1609                 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
1610                         /* No */
1611                         continue;
1612
1613                 /* Yes: Display current CPU stats */
1614                 printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
1615                 if (DISPLAY_DEBUG_MODE(flags) && i) {
1616                         if (ssnc->processed + ssnc->dropped + ssnc->time_squeeze +
1617                             ssnc->received_rps + ssnc->flow_limit == 0) {
1618                                 /* CPU is considered offline */
1619                                 printf(" [OFF]");
1620                         }
1621                 }
1622                 printf("; %d;", i - 1);
1623
1624                 printf(" %s", pfield(NULL, 0));
1625                 pval((unsigned long long) ssnp->processed, (unsigned long long) ssnc->processed);
1626                 printf(" %s", pfield(NULL, 0));
1627                 pval((unsigned long long) ssnp->dropped, (unsigned long long) ssnc->dropped);
1628                 printf(" %s", pfield(NULL, 0));
1629                 pval((unsigned long long) ssnp->time_squeeze, (unsigned long long) ssnc->time_squeeze);
1630                 printf(" %s", pfield(NULL, 0));
1631                 pval((unsigned long long) ssnp->received_rps, (unsigned long long) ssnc->received_rps);
1632                 printf(" %s", pfield(NULL, 0));
1633                 pval((unsigned long long) ssnp->flow_limit, (unsigned long long) ssnc->flow_limit);
1634                 printf("\n");
1635         }
1636 }