]> granicus.if.org Git - sysstat/blob - rndr_stats.c
sar: Add softnet statistics (part 4): ppc and CSV output formats
[sysstat] / rndr_stats.c
1 /*
2  * rndr_stats.c: Funtions used by sadf to display statistics in selected format.
3  * (C) 1999-2016 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
26 #include "sa.h"
27 #include "ioconf.h"
28 #include "rndr_stats.h"
29
30 #ifdef USE_NLS
31 #include <locale.h>
32 #include <libintl.h>
33 #define _(string) gettext(string)
34 #else
35 #define _(string) (string)
36 #endif
37
38 char *seps[] =  {"\t", ";"};
39
40 extern unsigned int flags;
41 extern unsigned int dm_major;
42
43 /*
44  ***************************************************************************
45  * cons() -
46  *   encapsulate a pair of ints or pair of char * into a static Cons and
47  *   return a pointer to it.
48  *
49  * given:   t - type of Cons {iv, sv}
50  *          arg1 - unsigned long int (if iv), char * (if sv) to become
51  *                 element 'a'
52  *          arg2 - unsigned long int (if iv), char * (if sv) to become
53  *                 element 'b'
54  *
55  * does:    load a static Cons with values using the t parameter to
56  *          guide pulling values from the arglist
57  *
58  * return:  the address of its static Cons.  If you need to keep
59  *          the contents of this Cons, copy it somewhere before calling
60  *          cons() against to avoid overwrite.
61  *          ie. don't do this:  f( cons( iv, i, j ), cons( iv, a, b ) );
62  ***************************************************************************
63  */
64 static Cons *cons(tcons t, ...)
65 {
66         va_list ap;
67         static Cons c;
68
69         c.t = t;
70
71         va_start(ap, t);
72         if (t == iv) {
73                 c.a.i = va_arg(ap, unsigned long int);
74                 c.b.i = va_arg(ap, unsigned long int);
75         }
76         else {
77                 c.a.s = va_arg(ap, char *);
78                 c.b.s = va_arg(ap, char *);
79         }
80         va_end(ap);
81         return(&c);
82 }
83
84 /*
85  ***************************************************************************
86  * render():
87  *
88  * given:    isdb - flag, true if db printing, false if ppc printing
89  *           pre  - prefix string for output entries
90  *           rflags - PT_.... rendering flags
91  *           pptxt - printf-format text required for ppc output (may be null)
92  *           dbtxt - printf-format text required for db output (may be null)
93  *           mid - pptxt/dbtxt format args as a Cons.
94  *           luval - %lu printable arg (PT_USEINT must be set)
95  *           dval  - %.2f printable arg (used unless PT_USEINT is set)
96  *           sval - %s printable arg (PT_USESTR must be set)
97  *
98  * does:     print [pre<sep>]([dbtxt,arg,arg<sep>]|[pptxt,arg,arg<sep>]) \
99  *                     (luval|dval)(<sep>|\n)
100  *
101  * return:   void.
102  ***************************************************************************
103  */
104 static void render(int isdb, char *pre, int rflags, const char *pptxt,
105                    const char *dbtxt, Cons *mid, unsigned long int luval,
106                    double dval, char *sval)
107 {
108         static int newline = 1;
109         const char *txt[]  = {pptxt, dbtxt};
110
111         /* Start a new line? */
112         if (newline && !DISPLAY_HORIZONTALLY(flags)) {
113                 printf("%s", pre);
114         }
115
116         /* Terminate this one ? ppc always gets a newline */
117         newline = ((rflags & PT_NEWLIN) || !isdb);
118
119         if (txt[isdb]) {
120                 /* pp/dbtxt? */
121
122                 printf("%s", seps[isdb]);       /* Only if something actually gets printed */
123
124                 if (mid) {
125                         /* Got format args? */
126                         switch(mid->t) {
127                         case iv:
128                                 printf(txt[isdb], mid->a.i, mid->b.i);
129                                 break;
130                         case sv:
131                                 printf(txt[isdb], mid->a.s, mid->b.s);
132                                 break;
133                         }
134                 }
135                 else {
136                         /*
137                          * Additional NULL parameter below works around
138                          * fatal error when compiled with -Werror=format-security.
139                          */
140                         printf(txt[isdb], NULL);        /* No args */
141                 }
142         }
143
144         if (rflags & PT_USEINT) {
145                 printf("%s%lu", seps[isdb], luval);
146         }
147         else if (rflags & PT_USESTR) {
148                 printf("%s%s", seps[isdb], sval);
149         }
150         else if (rflags & PT_USERND) {
151                 printf("%s%.0f", seps[isdb], dval);
152         }
153         else {
154                 printf("%s%.2f", seps[isdb], dval);
155         }
156         if (newline) {
157                 printf("\n");
158         }
159 }
160
161 /*
162  ***************************************************************************
163  * Display CPU statistics in selected format.
164  *
165  * IN:
166  * @a           Activity structure with statistics.
167  * @isdb        Flag, true if db printing, false if ppc printing.
168  * @pre         Prefix string for output entries
169  * @curr        Index in array for current sample statistics.
170  * @g_itv       Interval of time in jiffies multiplied by the number
171  *              of processors.
172  ***************************************************************************
173  */
174 __print_funct_t render_cpu_stats(struct activity *a, int isdb, char *pre,
175                                  int curr, unsigned long long g_itv)
176 {
177         int i, cpu_offline;
178         struct stats_cpu *scc, *scp;
179         int pt_newlin
180                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
181
182         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
183
184                 scc = (struct stats_cpu *) ((char *) a->buf[curr]  + i * a->msize);
185                 scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
186
187                 /* Should current CPU (including CPU "all") be displayed? */
188                 if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
189                         /* No */
190                         continue;
191
192                 if (!i) {
193                         /* This is CPU "all" */
194                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
195                                 render(isdb, pre,
196                                        PT_NOFLAG,       /* that's zero but you know what it means */
197                                        "all\t%%user",   /* all ppctext is used as format, thus '%%' */
198                                        "-1",            /* look! dbtext */
199                                        NULL,            /* no args */
200                                        NOVAL,           /* another 0, named for readability */
201                                        ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv),
202                                        NULL);           /* No string arg */
203                         }
204                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
205                                 render(isdb, pre, PT_NOFLAG,
206                                        "all\t%%usr", "-1", NULL,
207                                        NOVAL,
208                                        (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
209                                        0.0 :
210                                        ll_sp_value(scp->cpu_user - scp->cpu_guest,
211                                                    scc->cpu_user - scc->cpu_guest,
212                                                    g_itv),
213                                        NULL);
214                         }
215
216                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
217                                 render(isdb, pre, PT_NOFLAG,
218                                        "all\t%%nice", NULL, NULL,
219                                        NOVAL,
220                                        ll_sp_value(scp->cpu_nice, scc->cpu_nice, g_itv),
221                                        NULL);
222                         }
223                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
224                                 render(isdb, pre, PT_NOFLAG,
225                                        "all\t%%nice", NULL, NULL,
226                                        NOVAL,
227                                        (scc->cpu_nice - scc->cpu_guest_nice) < (scp->cpu_nice - scp->cpu_guest_nice) ?
228                                        0.0 :
229                                        ll_sp_value(scp->cpu_nice - scp->cpu_guest_nice,
230                                                    scc->cpu_nice - scc->cpu_guest_nice,
231                                                    g_itv),
232                                        NULL);
233                         }
234
235                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
236                                 render(isdb, pre, PT_NOFLAG,
237                                        "all\t%%system", NULL, NULL,
238                                        NOVAL,
239                                        ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
240                                                    scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
241                                                    g_itv),
242                                        NULL);
243                         }
244                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
245                                 render(isdb, pre, PT_NOFLAG,
246                                        "all\t%%sys", NULL, NULL,
247                                        NOVAL,
248                                        ll_sp_value(scp->cpu_sys, scc->cpu_sys, g_itv),
249                                        NULL);
250                         }
251
252                         render(isdb, pre, PT_NOFLAG,
253                                "all\t%%iowait", NULL, NULL,
254                                NOVAL,
255                                ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
256                                NULL);
257
258                         render(isdb, pre, PT_NOFLAG,
259                                "all\t%%steal", NULL, NULL,
260                                NOVAL,
261                                ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv),
262                                NULL);
263
264                         if (DISPLAY_CPU_ALL(a->opt_flags)) {
265                                 render(isdb, pre, PT_NOFLAG,
266                                        "all\t%%irq", NULL, NULL,
267                                        NOVAL,
268                                        ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
269                                        NULL);
270
271                                 render(isdb, pre, PT_NOFLAG,
272                                        "all\t%%soft", NULL, NULL,
273                                        NOVAL,
274                                        ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
275                                        NULL);
276
277                                 render(isdb, pre, PT_NOFLAG,
278                                        "all\t%%guest", NULL, NULL,
279                                        NOVAL,
280                                        ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv),
281                                        NULL);
282
283                                 render(isdb, pre, PT_NOFLAG,
284                                        "all\t%%gnice", NULL, NULL,
285                                        NOVAL,
286                                        ll_sp_value(scp->cpu_guest_nice, scc->cpu_guest_nice, g_itv),
287                                        NULL);
288                         }
289
290                         render(isdb, pre, pt_newlin,
291                                "all\t%%idle", NULL, NULL,
292                                NOVAL,
293                                (scc->cpu_idle < scp->cpu_idle) ?
294                                0.0 :
295                                ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv),
296                                NULL);
297                 }
298                 else {
299                         /*
300                          * If the CPU is offline then it is omited from /proc/stat:
301                          * All the fields couldn't have been read and the sum of them is zero.
302                          * (Remember that guest/guest_nice times are already included in
303                          * user/nice modes.)
304                          */
305                         if ((scc->cpu_user    + scc->cpu_nice + scc->cpu_sys   +
306                              scc->cpu_iowait  + scc->cpu_idle + scc->cpu_steal +
307                              scc->cpu_hardirq + scc->cpu_softirq) == 0) {
308                                 /*
309                                  * Set current struct fields (which have been set to zero)
310                                  * to values from previous iteration. Hence their values won't
311                                  * jump from zero when the CPU comes back online.
312                                  */
313                                 *scc = *scp;
314
315                                 g_itv = 0;
316                                 cpu_offline = TRUE;
317                         }
318                         else {
319                                 /*
320                                  * Recalculate itv for current proc.
321                                  * If the result is 0, then current CPU is a tickless one.
322                                  */
323                                 g_itv = get_per_cpu_interval(scc, scp);
324                                 cpu_offline = FALSE;
325                         }
326
327                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
328                                 render(isdb, pre, PT_NOFLAG,
329                                        "cpu%d\t%%user",         /* ppc text with formatting */
330                                        "%d",                    /* db text with format char */
331                                        cons(iv, i - 1, NOVAL),  /* how we pass format args  */
332                                        NOVAL,
333                                        !g_itv ?
334                                        0.0 :                    /* CPU is offline or tickless */
335                                        ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv),
336                                        NULL);
337                         }
338                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
339                                 render(isdb, pre, PT_NOFLAG,
340                                        "cpu%d\t%%usr", "%d", cons(iv, i - 1, NOVAL),
341                                        NOVAL,
342                                        (!g_itv ||
343                                        ((scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest))) ?
344                                        0.0 :
345                                        ll_sp_value(scp->cpu_user - scp->cpu_guest,
346                                                    scc->cpu_user - scc->cpu_guest, g_itv),
347                                        NULL);
348                         }
349
350                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
351                                 render(isdb, pre, PT_NOFLAG,
352                                        "cpu%d\t%%nice", NULL, cons(iv, i - 1, NOVAL),
353                                        NOVAL,
354                                        !g_itv ?
355                                        0.0 :
356                                        ll_sp_value(scp->cpu_nice, scc->cpu_nice, g_itv),
357                                        NULL);
358                         }
359                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
360                                 render(isdb, pre, PT_NOFLAG,
361                                        "cpu%d\t%%nice", NULL, cons(iv, i - 1, NOVAL),
362                                        NOVAL,
363                                        (!g_itv ||
364                                        ((scc->cpu_nice - scc->cpu_guest_nice) < (scp->cpu_nice - scp->cpu_guest_nice))) ?
365                                        0.0 :
366                                        ll_sp_value(scp->cpu_nice - scp->cpu_guest_nice,
367                                                    scc->cpu_nice - scc->cpu_guest_nice, g_itv),
368                                        NULL);
369                         }
370
371                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
372                                 render(isdb, pre, PT_NOFLAG,
373                                        "cpu%d\t%%system", NULL, cons(iv, i - 1, NOVAL),
374                                        NOVAL,
375                                        !g_itv ?
376                                        0.0 :
377                                        ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
378                                                    scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
379                                                    g_itv),
380                                        NULL);
381                         }
382                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
383                                 render(isdb, pre, PT_NOFLAG,
384                                        "cpu%d\t%%sys", NULL, cons(iv, i - 1, NOVAL),
385                                        NOVAL,
386                                        !g_itv ?
387                                        0.0 :
388                                        ll_sp_value(scp->cpu_sys, scc->cpu_sys, g_itv),
389                                        NULL);
390                         }
391
392                         render(isdb, pre, PT_NOFLAG,
393                                "cpu%d\t%%iowait", NULL, cons(iv, i - 1, NOVAL),
394                                NOVAL,
395                                !g_itv ?
396                                0.0 :
397                                ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
398                                NULL);
399
400                         render(isdb, pre, PT_NOFLAG,
401                                "cpu%d\t%%steal", NULL, cons(iv, i - 1, NOVAL),
402                                NOVAL,
403                                !g_itv ?
404                                0.0 :
405                                ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv),
406                                NULL);
407
408                         if (DISPLAY_CPU_ALL(a->opt_flags)) {
409                                 render(isdb, pre, PT_NOFLAG,
410                                        "cpu%d\t%%irq", NULL, cons(iv, i - 1, NOVAL),
411                                        NOVAL,
412                                        !g_itv ?
413                                        0.0 :
414                                        ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
415                                        NULL);
416
417                                 render(isdb, pre, PT_NOFLAG,
418                                        "cpu%d\t%%soft", NULL, cons(iv, i - 1, NOVAL),
419                                        NOVAL,
420                                        !g_itv ?
421                                        0.0 :
422                                        ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
423                                        NULL);
424
425                                 render(isdb, pre, PT_NOFLAG,
426                                        "cpu%d\t%%guest", NULL, cons(iv, i - 1, NOVAL),
427                                        NOVAL,
428                                        !g_itv ?
429                                        0.0 :
430                                        ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv),
431                                        NULL);
432
433                                 render(isdb, pre, PT_NOFLAG,
434                                        "cpu%d\t%%gnice", NULL, cons(iv, i - 1, NOVAL),
435                                        NOVAL,
436                                        !g_itv ?
437                                        0.0 :
438                                        ll_sp_value(scp->cpu_guest_nice, scc->cpu_guest_nice, g_itv),
439                                        NULL);
440                         }
441
442                         if (!g_itv) {
443                                 /* CPU is offline or tickless */
444                                 render(isdb, pre, pt_newlin,
445                                        "cpu%d\t%%idle", NULL, cons(iv, i - 1, NOVAL),
446                                        NOVAL,
447                                        cpu_offline ?
448                                        0.0 : 100.0,
449                                        NULL);
450                         }
451                         else {
452                                 render(isdb, pre, pt_newlin,
453                                        "cpu%d\t%%idle", NULL, cons(iv, i - 1, NOVAL),
454                                        NOVAL,
455                                        (scc->cpu_idle < scp->cpu_idle) ?
456                                        0.0 :
457                                        ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv),
458                                        NULL);
459                         }
460                 }
461         }
462 }
463
464 /*
465  ***************************************************************************
466  * Display task creation and context switch statistics in selected format.
467  *
468  * IN:
469  * @a           Activity structure with statistics.
470  * @isdb        Flag, true if db printing, false if ppc printing.
471  * @pre         Prefix string for output entries
472  * @curr        Index in array for current sample statistics.
473  * @itv         Interval of time in jiffies.
474  ***************************************************************************
475  */
476 __print_funct_t render_pcsw_stats(struct activity *a, int isdb, char *pre,
477                                   int curr, unsigned long long itv)
478 {
479         struct stats_pcsw
480                 *spc = (struct stats_pcsw *) a->buf[curr],
481                 *spp = (struct stats_pcsw *) a->buf[!curr];
482         int pt_newlin
483                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
484
485         /* The first one as an example */
486         render(isdb,            /* db/ppc flag */
487                pre,             /* the preformatted line leader */
488                PT_NOFLAG,       /* is this the end of a db line? */
489                "-\tproc/s",     /* ppc text */
490                NULL,            /* db text */
491                NULL,            /* db/ppc text format args (Cons *) */
492                NOVAL,           /* %lu value (unused unless PT_USEINT) */
493                /* and %.2f value, used unless PT_USEINT */
494                S_VALUE(spp->processes, spc->processes, itv),
495                NULL);           /* %s value */
496
497         render(isdb, pre, pt_newlin,
498                "-\tcswch/s", NULL, NULL,
499                NOVAL,
500                S_VALUE(spp->context_switch, spc->context_switch, itv),
501                NULL);
502 }
503
504 /*
505  ***************************************************************************
506  * Display interrupts statistics in selected format.
507  *
508  * IN:
509  * @a           Activity structure with statistics.
510  * @isdb        Flag, true if db printing, false if ppc printing.
511  * @pre         Prefix string for output entries
512  * @curr        Index in array for current sample statistics.
513  * @itv         Interval of time in jiffies.
514  ***************************************************************************
515  */
516 __print_funct_t render_irq_stats(struct activity *a, int isdb, char *pre,
517                                  int curr, unsigned long long itv)
518 {
519         int i;
520         struct stats_irq *sic, *sip;
521         int pt_newlin
522                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
523
524         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
525
526                 sic = (struct stats_irq *) ((char *) a->buf[curr]  + i * a->msize);
527                 sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
528
529                 /* Should current interrupt (including int "sum") be displayed? */
530                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
531
532                         /* Yes: Display it */
533                         if (!i) {
534                                 /* This is interrupt "sum" */
535                                 render(isdb, pre, pt_newlin,
536                                        "sum\tintr/s", "-1", NULL,
537                                        NOVAL,
538                                        S_VALUE(sip->irq_nr, sic->irq_nr, itv),
539                                        NULL);
540                         }
541                         else {
542                                 render(isdb, pre, pt_newlin,
543                                        "i%03d\tintr/s", "%d", cons(iv, i - 1, NOVAL),
544                                        NOVAL,
545                                        S_VALUE(sip->irq_nr, sic->irq_nr, itv),
546                                        NULL);
547                         }
548                 }
549         }
550 }
551
552 /*
553  ***************************************************************************
554  * Display swapping statistics in selected format.
555  *
556  * IN:
557  * @a           Activity structure with statistics.
558  * @isdb        Flag, true if db printing, false if ppc printing.
559  * @pre         Prefix string for output entries
560  * @curr        Index in array for current sample statistics.
561  * @itv         Interval of time in jiffies.
562  ***************************************************************************
563  */
564 __print_funct_t render_swap_stats(struct activity *a, int isdb, char *pre,
565                                   int curr, unsigned long long itv)
566 {
567         struct stats_swap
568                 *ssc = (struct stats_swap *) a->buf[curr],
569                 *ssp = (struct stats_swap *) a->buf[!curr];
570         int pt_newlin
571                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
572
573         render(isdb, pre, PT_NOFLAG,
574                "-\tpswpin/s", NULL, NULL,
575                NOVAL,
576                S_VALUE(ssp->pswpin, ssc->pswpin, itv),
577                NULL);
578         render(isdb, pre, pt_newlin,
579                "-\tpswpout/s", NULL, NULL,
580                NOVAL,
581                S_VALUE(ssp->pswpout, ssc->pswpout, itv),
582                NULL);
583 }
584
585 /*
586  ***************************************************************************
587  * Display paging statistics in selected format.
588  *
589  * IN:
590  * @a           Activity structure with statistics.
591  * @isdb        Flag, true if db printing, false if ppc printing.
592  * @pre         Prefix string for output entries
593  * @curr        Index in array for current sample statistics.
594  * @itv         Interval of time in jiffies.
595  ***************************************************************************
596  */
597 __print_funct_t render_paging_stats(struct activity *a, int isdb, char *pre,
598                                     int curr, unsigned long long itv)
599 {
600         struct stats_paging
601                 *spc = (struct stats_paging *) a->buf[curr],
602                 *spp = (struct stats_paging *) a->buf[!curr];
603         int pt_newlin
604                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
605
606         render(isdb, pre, PT_NOFLAG,
607                "-\tpgpgin/s", NULL, NULL,
608                NOVAL,
609                S_VALUE(spp->pgpgin, spc->pgpgin, itv),
610                NULL);
611
612         render(isdb, pre, PT_NOFLAG,
613                "-\tpgpgout/s", NULL, NULL,
614                NOVAL,
615                S_VALUE(spp->pgpgout, spc->pgpgout, itv),
616                NULL);
617
618         render(isdb, pre, PT_NOFLAG,
619                "-\tfault/s", NULL, NULL,
620                NOVAL,
621                S_VALUE(spp->pgfault, spc->pgfault, itv),
622                NULL);
623
624         render(isdb, pre, PT_NOFLAG,
625                "-\tmajflt/s", NULL, NULL,
626                NOVAL,
627                S_VALUE(spp->pgmajfault, spc->pgmajfault, itv),
628                NULL);
629
630         render(isdb, pre, PT_NOFLAG,
631                "-\tpgfree/s", NULL, NULL,
632                NOVAL,
633                S_VALUE(spp->pgfree, spc->pgfree, itv),
634                NULL);
635
636         render(isdb, pre, PT_NOFLAG,
637                "-\tpgscank/s", NULL, NULL,
638                NOVAL,
639                S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
640                NULL);
641
642         render(isdb, pre, PT_NOFLAG,
643                "-\tpgscand/s", NULL, NULL,
644                NOVAL,
645                S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
646                NULL);
647
648         render(isdb, pre, PT_NOFLAG,
649                "-\tpgsteal/s", NULL, NULL,
650                NOVAL,
651                S_VALUE(spp->pgsteal, spc->pgsteal, itv),
652                NULL);
653
654         render(isdb, pre, pt_newlin,
655                "-\t%%vmeff", NULL, NULL,
656                NOVAL,
657                (spc->pgscan_kswapd + spc->pgscan_direct -
658                 spp->pgscan_kswapd - spp->pgscan_direct) ?
659                SP_VALUE(spp->pgsteal, spc->pgsteal,
660                         spc->pgscan_kswapd + spc->pgscan_direct -
661                         spp->pgscan_kswapd - spp->pgscan_direct) : 0.0,
662                NULL);
663 }
664
665 /*
666  ***************************************************************************
667  * Display I/O and transfer rate statistics in selected format.
668  *
669  * IN:
670  * @a           Activity structure with statistics.
671  * @isdb        Flag, true if db printing, false if ppc printing.
672  * @pre         Prefix string for output entries
673  * @curr        Index in array for current sample statistics.
674  * @itv         Interval of time in jiffies.
675  ***************************************************************************
676  */
677 __print_funct_t render_io_stats(struct activity *a, int isdb, char *pre,
678                                 int curr, unsigned long long itv)
679 {
680         struct stats_io
681                 *sic = (struct stats_io *) a->buf[curr],
682                 *sip = (struct stats_io *) a->buf[!curr];
683         int pt_newlin
684                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
685
686         /*
687          * If we get negative values, this is probably because
688          * one or more devices/filesystems have been unmounted.
689          * We display 0.0 in this case though we should rather tell
690          * the user that the value cannot be calculated here.
691          */
692         render(isdb, pre, PT_NOFLAG,
693                "-\ttps", NULL, NULL,
694                NOVAL,
695                sic->dk_drive < sip->dk_drive ? 0.0 :
696                S_VALUE(sip->dk_drive, sic->dk_drive, itv),
697                NULL);
698
699         render(isdb, pre, PT_NOFLAG,
700                "-\trtps", NULL, NULL,
701                NOVAL,
702                sic->dk_drive_rio < sip->dk_drive_rio ? 0.0 :
703                S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
704                NULL);
705
706         render(isdb, pre, PT_NOFLAG,
707                "-\twtps", NULL, NULL,
708                NOVAL,
709                sic->dk_drive_wio < sip->dk_drive_wio ? 0.0 :
710                S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
711                NULL);
712
713         render(isdb, pre, PT_NOFLAG,
714                "-\tbread/s", NULL, NULL,
715                NOVAL,
716                sic->dk_drive_rblk < sip->dk_drive_rblk ? 0.0 :
717                S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv),
718                NULL);
719
720         render(isdb, pre, pt_newlin,
721                "-\tbwrtn/s", NULL, NULL,
722                NOVAL,
723                sic->dk_drive_wblk < sip->dk_drive_wblk ? 0.0 :
724                S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv),
725                NULL);
726 }
727
728 /*
729  ***************************************************************************
730  * Display memory and swap statistics in selected format.
731  *
732  * IN:
733  * @a           Activity structure with statistics.
734  * @isdb        Flag, true if db printing, false if ppc printing.
735  * @pre         Prefix string for output entries
736  * @curr        Index in array for current sample statistics.
737  * @itv         Interval of time in jiffies.
738  ***************************************************************************
739  */
740 __print_funct_t render_memory_stats(struct activity *a, int isdb, char *pre,
741                                     int curr, unsigned long long itv)
742 {
743         struct stats_memory
744                 *smc = (struct stats_memory *) a->buf[curr],
745                 *smp = (struct stats_memory *) a->buf[!curr];
746         int pt_newlin
747                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
748         int ptn;
749
750         if (DISPLAY_MEMORY(a->opt_flags)) {
751
752                 render(isdb, pre, PT_NOFLAG,
753                        "-\tfrmpg/s", NULL, NULL,
754                        NOVAL,
755                        S_VALUE((double) KB_TO_PG(smp->frmkb),
756                                (double) KB_TO_PG(smc->frmkb), itv),
757                        NULL);
758
759                 render(isdb, pre, PT_NOFLAG,
760                        "-\tbufpg/s", NULL, NULL,
761                        NOVAL,
762                        S_VALUE((double) KB_TO_PG(smp->bufkb),
763                                (double) KB_TO_PG(smc->bufkb), itv),
764                        NULL);
765
766                 render(isdb, pre, pt_newlin,
767                        "-\tcampg/s", NULL, NULL,
768                        NOVAL,
769                        S_VALUE((double) KB_TO_PG(smp->camkb),
770                                (double) KB_TO_PG(smc->camkb), itv),
771                        NULL);
772         }
773
774         if (DISPLAY_MEM_AMT(a->opt_flags)) {
775
776                 render(isdb, pre, PT_USEINT,
777                        "-\tkbmemfree", NULL, NULL,
778                        smc->frmkb, DNOVAL, NULL);
779
780                 render(isdb, pre, PT_USEINT,
781                        "-\tkbmemused", NULL, NULL,
782                        smc->tlmkb - smc->frmkb, DNOVAL, NULL);
783
784                 render(isdb, pre, PT_NOFLAG,
785                        "-\t%%memused", NULL, NULL, NOVAL,
786                        smc->tlmkb ?
787                        SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) :
788                        0.0, NULL);
789
790                 render(isdb, pre, PT_USEINT,
791                        "-\tkbbuffers", NULL, NULL,
792                        smc->bufkb, DNOVAL, NULL);
793
794                 render(isdb, pre, PT_USEINT,
795                        "-\tkbcached", NULL, NULL,
796                        smc->camkb, DNOVAL, NULL);
797
798                 render(isdb, pre, PT_USEINT,
799                        "-\tkbcommit", NULL, NULL,
800                        smc->comkb, DNOVAL, NULL);
801
802                 render(isdb, pre, PT_NOFLAG,
803                        "-\t%%commit", NULL, NULL, NOVAL,
804                        (smc->tlmkb + smc->tlskb) ?
805                        SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
806                        0.0, NULL);
807
808                 render(isdb, pre, PT_USEINT,
809                        "-\tkbactive", NULL, NULL,
810                        smc->activekb, DNOVAL, NULL);
811
812                 render(isdb, pre, PT_USEINT,
813                        "-\tkbinact", NULL, NULL,
814                        smc->inactkb, DNOVAL, NULL);
815
816                 ptn = DISPLAY_MEM_ALL(a->opt_flags) ? 0 : pt_newlin;
817                 render(isdb, pre, PT_USEINT | ptn,
818                        "-\tkbdirty", NULL, NULL,
819                        smc->dirtykb, DNOVAL, NULL);
820
821                 if (DISPLAY_MEM_ALL(a->opt_flags)) {
822                         render(isdb, pre, PT_USEINT,
823                                "-\tkbanonpg", NULL, NULL,
824                                smc->anonpgkb, DNOVAL, NULL);
825
826                         render(isdb, pre, PT_USEINT,
827                                "-\tkbslab", NULL, NULL,
828                                smc->slabkb, DNOVAL, NULL);
829
830                         render(isdb, pre, PT_USEINT,
831                                "-\tkbkstack", NULL, NULL,
832                                smc->kstackkb, DNOVAL, NULL);
833
834                         render(isdb, pre, PT_USEINT,
835                                "-\tkbpgtbl", NULL, NULL,
836                                smc->pgtblkb, DNOVAL, NULL);
837
838                         render(isdb, pre, PT_USEINT | pt_newlin,
839                                "-\tkbvmused", NULL, NULL,
840                                smc->vmusedkb, DNOVAL, NULL);
841                 }
842         }
843
844         if (DISPLAY_SWAP(a->opt_flags)) {
845
846                 render(isdb, pre, PT_USEINT,
847                        "-\tkbswpfree", NULL, NULL,
848                        smc->frskb, DNOVAL, NULL);
849
850                 render(isdb, pre, PT_USEINT,
851                        "-\tkbswpused", NULL, NULL,
852                        smc->tlskb - smc->frskb, DNOVAL, NULL);
853
854                 render(isdb, pre, PT_NOFLAG,
855                        "-\t%%swpused", NULL, NULL, NOVAL,
856                        smc->tlskb ?
857                        SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
858                        0.0, NULL);
859
860                 render(isdb, pre, PT_USEINT,
861                        "-\tkbswpcad", NULL, NULL,
862                        smc->caskb, DNOVAL, NULL);
863
864                 render(isdb, pre, pt_newlin,
865                        "-\t%%swpcad", NULL, NULL, NOVAL,
866                        (smc->tlskb - smc->frskb) ?
867                        SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
868                        0.0, NULL);
869         }
870 }
871
872 /*
873  ***************************************************************************
874  * Display kernel tables statistics in selected format.
875  *
876  * IN:
877  * @a           Activity structure with statistics.
878  * @isdb        Flag, true if db printing, false if ppc printing.
879  * @pre         Prefix string for output entries
880  * @curr        Index in array for current sample statistics.
881  * @itv         Interval of time in jiffies.
882  ***************************************************************************
883  */
884 __print_funct_t render_ktables_stats(struct activity *a, int isdb, char *pre,
885                                      int curr, unsigned long long itv)
886 {
887         struct stats_ktables
888                 *skc = (struct stats_ktables *) a->buf[curr];
889         int pt_newlin
890                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
891
892         render(isdb, pre, PT_USEINT,
893                "-\tdentunusd", NULL, NULL,
894                skc->dentry_stat, DNOVAL, NULL);
895
896         render(isdb, pre, PT_USEINT,
897                "-\tfile-nr", NULL, NULL,
898                skc->file_used, DNOVAL, NULL);
899
900         render(isdb, pre, PT_USEINT,
901                "-\tinode-nr", NULL, NULL,
902                skc->inode_used, DNOVAL, NULL);
903
904         render(isdb, pre, PT_USEINT | pt_newlin,
905                "-\tpty-nr", NULL, NULL,
906                skc->pty_nr, DNOVAL, NULL);
907 }
908
909 /*
910  ***************************************************************************
911  * Display queue and load statistics in selected format.
912  *
913  * IN:
914  * @a           Activity structure with statistics.
915  * @isdb        Flag, true if db printing, false if ppc printing.
916  * @pre         Prefix string for output entries
917  * @curr        Index in array for current sample statistics.
918  * @itv         Interval of time in jiffies.
919  ***************************************************************************
920  */
921 __print_funct_t render_queue_stats(struct activity *a, int isdb, char *pre,
922                                    int curr, unsigned long long itv)
923 {
924         struct stats_queue
925                 *sqc = (struct stats_queue *) a->buf[curr];
926         int pt_newlin
927                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
928
929         render(isdb, pre, PT_USEINT,
930                "-\trunq-sz", NULL, NULL,
931                sqc->nr_running, DNOVAL, NULL);
932
933         render(isdb, pre, PT_USEINT,
934                "-\tplist-sz", NULL, NULL,
935                sqc->nr_threads, DNOVAL, NULL);
936
937         render(isdb, pre, PT_NOFLAG,
938                "-\tldavg-1", NULL, NULL,
939                NOVAL,
940                (double) sqc->load_avg_1 / 100,
941                NULL);
942
943         render(isdb, pre, PT_NOFLAG,
944                "-\tldavg-5", NULL, NULL,
945                NOVAL,
946                (double) sqc->load_avg_5 / 100,
947                NULL);
948
949         render(isdb, pre, PT_NOFLAG,
950                "-\tldavg-15", NULL, NULL,
951                NOVAL,
952                (double) sqc->load_avg_15 / 100,
953                NULL);
954
955         render(isdb, pre, PT_USEINT | pt_newlin,
956                "-\tblocked", NULL, NULL,
957                sqc->procs_blocked, DNOVAL, NULL);
958 }
959
960 /*
961  ***************************************************************************
962  * Display serial lines statistics in selected format.
963  *
964  * IN:
965  * @a           Activity structure with statistics.
966  * @isdb        Flag, true if db printing, false if ppc printing.
967  * @pre         Prefix string for output entries
968  * @curr        Index in array for current sample statistics.
969  * @itv         Interval of time in jiffies.
970  ***************************************************************************
971  */
972 __print_funct_t render_serial_stats(struct activity *a, int isdb, char *pre,
973                                     int curr, unsigned long long itv)
974 {
975         int i;
976         struct stats_serial *ssc, *ssp;
977         int pt_newlin
978                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
979
980         for (i = 0; i < a->nr; i++) {
981
982                 ssc = (struct stats_serial *) ((char *) a->buf[curr]  + i * a->msize);
983                 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
984
985                 if (ssc->line == 0)
986                         continue;
987
988                 if (ssc->line == ssp->line) {
989                         render(isdb, pre, PT_NOFLAG,
990                                "ttyS%d\trcvin/s", "%d",
991                                cons(iv, ssc->line - 1, NOVAL),
992                                NOVAL,
993                                S_VALUE(ssp->rx, ssc->rx, itv),
994                                NULL);
995
996                         render(isdb, pre, PT_NOFLAG,
997                                "ttyS%d\txmtin/s", "%d",
998                                cons(iv, ssc->line - 1, NOVAL),
999                                NOVAL,
1000                                S_VALUE(ssp->tx, ssc->tx, itv),
1001                                NULL);
1002
1003                         render(isdb, pre, PT_NOFLAG,
1004                                "ttyS%d\tframerr/s", "%d",
1005                                cons(iv, ssc->line - 1, NOVAL),
1006                                NOVAL,
1007                                S_VALUE(ssp->frame, ssc->frame, itv),
1008                                NULL);
1009
1010                         render(isdb, pre, PT_NOFLAG,
1011                                "ttyS%d\tprtyerr/s", "%d",
1012                                cons(iv, ssc->line - 1, NOVAL),
1013                                NOVAL,
1014                                S_VALUE(ssp->parity, ssc->parity, itv),
1015                                NULL);
1016
1017                         render(isdb, pre, PT_NOFLAG,
1018                                "ttyS%d\tbrk/s", "%d",
1019                                cons(iv, ssc->line - 1, NOVAL),
1020                                NOVAL,
1021                                S_VALUE(ssp->brk, ssc->brk, itv),
1022                                NULL);
1023
1024                         render(isdb, pre, pt_newlin,
1025                                "ttyS%d\tovrun/s", "%d",
1026                                cons(iv, ssc->line - 1, NOVAL),
1027                                NOVAL,
1028                                S_VALUE(ssp->overrun, ssc->overrun, itv),
1029                                NULL);
1030                 }
1031         }
1032 }
1033
1034 /*
1035  ***************************************************************************
1036  * Display disks statistics in selected format.
1037  *
1038  * IN:
1039  * @a           Activity structure with statistics.
1040  * @isdb        Flag, true if db printing, false if ppc printing.
1041  * @pre         Prefix string for output entries
1042  * @curr        Index in array for current sample statistics.
1043  * @itv         Interval of time in jiffies.
1044  ***************************************************************************
1045  */
1046 __print_funct_t render_disk_stats(struct activity *a, int isdb, char *pre,
1047                                   int curr, unsigned long long itv)
1048 {
1049         int i, j;
1050         struct stats_disk *sdc, *sdp;
1051         struct ext_disk_stats xds;
1052         char *dev_name, *persist_dev_name;
1053         int pt_newlin
1054                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1055
1056         for (i = 0; i < a->nr; i++) {
1057
1058                 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
1059
1060                 if (!(sdc->major + sdc->minor))
1061                         continue;
1062
1063                 j = check_disk_reg(a, curr, !curr, i);
1064                 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
1065
1066                 /* Compute extended stats (service time, etc.) */
1067                 compute_ext_disk_stats(sdc, sdp, itv, &xds);
1068
1069                 dev_name = NULL;
1070                 persist_dev_name = NULL;
1071
1072                 if (DISPLAY_PERSIST_NAME_S(flags)) {
1073                         persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
1074                 }
1075
1076                 if (persist_dev_name) {
1077                         dev_name = persist_dev_name;
1078                 }
1079                 else {
1080                         if ((USE_PRETTY_OPTION(flags)) && (sdc->major == dm_major)) {
1081                                 dev_name = transform_devmapname(sdc->major, sdc->minor);
1082                         }
1083
1084                         if (!dev_name) {
1085                                 dev_name = get_devname(sdc->major, sdc->minor,
1086                                                        USE_PRETTY_OPTION(flags));
1087                         }
1088                 }
1089
1090                 render(isdb, pre, PT_NOFLAG,
1091                        "%s\ttps", "%s",
1092                        cons(sv, dev_name, NULL),
1093                        NOVAL,
1094                        S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
1095                        NULL);
1096
1097                 render(isdb, pre, PT_NOFLAG,
1098                        "%s\trd_sec/s", NULL,
1099                        cons(sv, dev_name, NULL),
1100                        NOVAL,
1101                        S_VALUE(sdp->rd_sect, sdc->rd_sect, itv),
1102                        NULL);
1103
1104                 render(isdb, pre, PT_NOFLAG,
1105                        "%s\twr_sec/s", NULL,
1106                        cons(sv, dev_name, NULL),
1107                        NOVAL,
1108                        S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
1109                        NULL);
1110
1111                 render(isdb, pre, PT_NOFLAG,
1112                        "%s\tavgrq-sz", NULL,
1113                        cons(sv, dev_name, NULL),
1114                        NOVAL,
1115                        xds.arqsz,
1116                        NULL);
1117
1118                 render(isdb, pre, PT_NOFLAG,
1119                        "%s\tavgqu-sz", NULL,
1120                        cons(sv, dev_name, NULL),
1121                        NOVAL,
1122                        S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
1123                        NULL);
1124
1125                 render(isdb, pre, PT_NOFLAG,
1126                        "%s\tawait", NULL,
1127                        cons(sv, dev_name, NULL),
1128                        NOVAL,
1129                        xds.await,
1130                        NULL);
1131
1132                 render(isdb, pre, PT_NOFLAG,
1133                        "%s\tsvctm", NULL,
1134                        cons(sv, dev_name, NULL),
1135                        NOVAL,
1136                        xds.svctm,
1137                        NULL);
1138
1139                 render(isdb, pre, pt_newlin,
1140                        "%s\t%%util", NULL,
1141                        cons(sv, dev_name, NULL),
1142                        NOVAL,
1143                        xds.util / 10.0,
1144                        NULL);
1145         }
1146 }
1147
1148 /*
1149  ***************************************************************************
1150  * Display network interfaces statistics in selected format.
1151  *
1152  * IN:
1153  * @a           Activity structure with statistics.
1154  * @isdb        Flag, true if db printing, false if ppc printing.
1155  * @pre         Prefix string for output entries
1156  * @curr        Index in array for current sample statistics.
1157  * @itv         Interval of time in jiffies.
1158  ***************************************************************************
1159  */
1160 __print_funct_t render_net_dev_stats(struct activity *a, int isdb, char *pre,
1161                                      int curr, unsigned long long itv)
1162 {
1163         int i, j;
1164         struct stats_net_dev *sndc, *sndp;
1165         double rxkb, txkb, ifutil;
1166         int pt_newlin
1167                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1168
1169         for (i = 0; i < a->nr; i++) {
1170
1171                 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
1172
1173                 if (!strcmp(sndc->interface, ""))
1174                         continue;
1175
1176                 j = check_net_dev_reg(a, curr, !curr, i);
1177                 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
1178
1179                 render(isdb, pre, PT_NOFLAG,
1180                        "%s\trxpck/s", "%s",
1181                        cons(sv, sndc->interface, NULL), /* What if the format args are strings? */
1182                        NOVAL,
1183                        S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
1184                        NULL);
1185
1186                 render(isdb, pre, PT_NOFLAG,
1187                        "%s\ttxpck/s", NULL,
1188                        cons(sv, sndc->interface, NULL),
1189                        NOVAL,
1190                        S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
1191                        NULL);
1192
1193                 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
1194                 render(isdb, pre, PT_NOFLAG,
1195                        "%s\trxkB/s", NULL,
1196                        cons(sv, sndc->interface, NULL),
1197                        NOVAL,
1198                        rxkb / 1024,
1199                        NULL);
1200
1201                 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
1202                 render(isdb, pre, PT_NOFLAG,
1203                        "%s\ttxkB/s", NULL,
1204                        cons(sv, sndc->interface, NULL),
1205                        NOVAL,
1206                        txkb / 1024,
1207                        NULL);
1208
1209                 render(isdb, pre, PT_NOFLAG,
1210                        "%s\trxcmp/s", NULL,
1211                        cons(sv, sndc->interface, NULL),
1212                        NOVAL,
1213                        S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
1214                        NULL);
1215
1216                 render(isdb, pre, PT_NOFLAG,
1217                        "%s\ttxcmp/s", NULL,
1218                        cons(sv, sndc->interface, NULL),
1219                        NOVAL,
1220                        S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
1221                        NULL);
1222
1223                 render(isdb, pre, PT_NOFLAG,
1224                        "%s\trxmcst/s", NULL,
1225                        cons(sv, sndc->interface, NULL),
1226                        NOVAL,
1227                        S_VALUE(sndp->multicast, sndc->multicast, itv),
1228                        NULL);
1229
1230                 ifutil = compute_ifutil(sndc, rxkb, txkb);
1231                 render(isdb, pre, pt_newlin,
1232                        "%s\t%%ifutil", NULL,
1233                        cons(sv, sndc->interface, NULL),
1234                        NOVAL,
1235                        ifutil,
1236                        NULL);
1237         }
1238 }
1239
1240 /*
1241  ***************************************************************************
1242  * Display network interface errors statistics in selected format.
1243  *
1244  * IN:
1245  * @a           Activity structure with statistics.
1246  * @isdb        Flag, true if db printing, false if ppc printing.
1247  * @pre         Prefix string for output entries
1248  * @curr        Index in array for current sample statistics.
1249  * @itv         Interval of time in jiffies.
1250  ***************************************************************************
1251  */
1252 __print_funct_t render_net_edev_stats(struct activity *a, int isdb, char *pre,
1253                                       int curr, unsigned long long itv)
1254 {
1255         int i, j;
1256         struct stats_net_edev *snedc, *snedp;
1257         int pt_newlin
1258                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1259
1260         for (i = 0; i < a->nr; i++) {
1261
1262                 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
1263
1264                 if (!strcmp(snedc->interface, ""))
1265                         continue;
1266
1267                 j = check_net_edev_reg(a, curr, !curr, i);
1268                 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
1269
1270                 render(isdb, pre, PT_NOFLAG,
1271                        "%s\trxerr/s", "%s",
1272                        cons(sv, snedc->interface, NULL),
1273                        NOVAL,
1274                        S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
1275                        NULL);
1276
1277                 render(isdb, pre, PT_NOFLAG,
1278                        "%s\ttxerr/s", NULL,
1279                        cons(sv, snedc->interface, NULL),
1280                        NOVAL,
1281                        S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
1282                        NULL);
1283
1284                 render(isdb, pre, PT_NOFLAG,
1285                        "%s\tcoll/s", NULL,
1286                        cons(sv, snedc->interface, NULL),
1287                        NOVAL,
1288                        S_VALUE(snedp->collisions, snedc->collisions, itv),
1289                        NULL);
1290
1291                 render(isdb, pre, PT_NOFLAG,
1292                        "%s\trxdrop/s", NULL,
1293                        cons(sv, snedc->interface, NULL),
1294                        NOVAL,
1295                        S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
1296                        NULL);
1297
1298                 render(isdb, pre, PT_NOFLAG,
1299                        "%s\ttxdrop/s", NULL,
1300                        cons(sv, snedc->interface, NULL),
1301                        NOVAL,
1302                        S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
1303                        NULL);
1304
1305                 render(isdb, pre, PT_NOFLAG,
1306                        "%s\ttxcarr/s", NULL,
1307                        cons(sv, snedc->interface, NULL),
1308                        NOVAL,
1309                        S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
1310                        NULL);
1311
1312                 render(isdb, pre, PT_NOFLAG,
1313                        "%s\trxfram/s", NULL,
1314                        cons(sv, snedc->interface, NULL),
1315                        NOVAL,
1316                        S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
1317                        NULL);
1318
1319                 render(isdb, pre, PT_NOFLAG,
1320                        "%s\trxfifo/s", NULL,
1321                        cons(sv, snedc->interface, NULL),
1322                        NOVAL,
1323                        S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
1324                        NULL);
1325
1326                 render(isdb, pre, pt_newlin,
1327                        "%s\ttxfifo/s", NULL,
1328                        cons(sv, snedc->interface, NULL),
1329                        NOVAL,
1330                        S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv),
1331                        NULL);
1332         }
1333 }
1334
1335 /*
1336  ***************************************************************************
1337  * Display NFS client statistics in selected format.
1338  *
1339  * IN:
1340  * @a           Activity structure with statistics.
1341  * @isdb        Flag, true if db printing, false if ppc printing.
1342  * @pre         Prefix string for output entries
1343  * @curr        Index in array for current sample statistics.
1344  * @itv         Interval of time in jiffies.
1345  ***************************************************************************
1346  */
1347 __print_funct_t render_net_nfs_stats(struct activity *a, int isdb, char *pre,
1348                                      int curr, unsigned long long itv)
1349 {
1350         struct stats_net_nfs
1351                 *snnc = (struct stats_net_nfs *) a->buf[curr],
1352                 *snnp = (struct stats_net_nfs *) a->buf[!curr];
1353         int pt_newlin
1354                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1355
1356         render(isdb, pre, PT_NOFLAG,
1357                "-\tcall/s", NULL, NULL,
1358                NOVAL,
1359                S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
1360                NULL);
1361
1362         render(isdb, pre, PT_NOFLAG,
1363                "-\tretrans/s", NULL, NULL,
1364                NOVAL,
1365                S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
1366                NULL);
1367
1368         render(isdb, pre, PT_NOFLAG,
1369                "-\tread/s", NULL, NULL,
1370                NOVAL,
1371                S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
1372                NULL);
1373
1374         render(isdb, pre, PT_NOFLAG,
1375                "-\twrite/s", NULL, NULL,
1376                NOVAL,
1377                S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
1378                NULL);
1379
1380         render(isdb, pre, PT_NOFLAG,
1381                "-\taccess/s", NULL, NULL,
1382                NOVAL,
1383                S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
1384                NULL);
1385
1386         render(isdb, pre, pt_newlin,
1387                "-\tgetatt/s", NULL, NULL,
1388                NOVAL,
1389                S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv),
1390                NULL);
1391 }
1392
1393 /*
1394  ***************************************************************************
1395  * Display NFS server statistics in selected format.
1396  *
1397  * IN:
1398  * @a           Activity structure with statistics.
1399  * @isdb        Flag, true if db printing, false if ppc printing.
1400  * @pre         Prefix string for output entries
1401  * @curr        Index in array for current sample statistics.
1402  * @itv         Interval of time in jiffies.
1403  ***************************************************************************
1404  */
1405 __print_funct_t render_net_nfsd_stats(struct activity *a, int isdb, char *pre,
1406                                       int curr, unsigned long long itv)
1407 {
1408         struct stats_net_nfsd
1409                 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1410                 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1411         int pt_newlin
1412                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1413
1414         render(isdb, pre, PT_NOFLAG,
1415                "-\tscall/s", NULL, NULL,
1416                NOVAL,
1417                S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1418                NULL);
1419
1420         render(isdb, pre, PT_NOFLAG,
1421                "-\tbadcall/s", NULL, NULL,
1422                NOVAL,
1423                S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1424                NULL);
1425
1426         render(isdb, pre, PT_NOFLAG,
1427                "-\tpacket/s", NULL, NULL,
1428                NOVAL,
1429                S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1430                NULL);
1431
1432         render(isdb, pre, PT_NOFLAG,
1433                "-\tudp/s", NULL, NULL,
1434                NOVAL,
1435                S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1436                NULL);
1437
1438         render(isdb, pre, PT_NOFLAG,
1439                "-\ttcp/s", NULL, NULL,
1440                NOVAL,
1441                S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1442                NULL);
1443
1444         render(isdb, pre, PT_NOFLAG,
1445                "-\thit/s", NULL, NULL,
1446                NOVAL,
1447                S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1448                NULL);
1449
1450         render(isdb, pre, PT_NOFLAG,
1451                "-\tmiss/s", NULL, NULL,
1452                NOVAL,
1453                S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1454                NULL);
1455
1456         render(isdb, pre, PT_NOFLAG,
1457                "-\tsread/s", NULL, NULL,
1458                NOVAL,
1459                S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1460                NULL);
1461
1462         render(isdb, pre, PT_NOFLAG,
1463                "-\tswrite/s", NULL, NULL,
1464                NOVAL,
1465                S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1466                NULL);
1467
1468         render(isdb, pre, PT_NOFLAG,
1469                "-\tsaccess/s", NULL, NULL,
1470                NOVAL,
1471                S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1472                NULL);
1473
1474         render(isdb, pre, pt_newlin,
1475                "-\tsgetatt/s", NULL, NULL,
1476                NOVAL,
1477                S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv),
1478                NULL);
1479 }
1480
1481 /*
1482  ***************************************************************************
1483  * Display network sockets statistics in selected format.
1484  *
1485  * IN:
1486  * @a           Activity structure with statistics.
1487  * @isdb        Flag, true if db printing, false if ppc printing.
1488  * @pre         Prefix string for output entries
1489  * @curr        Index in array for current sample statistics.
1490  * @itv         Interval of time in jiffies.
1491  ***************************************************************************
1492  */
1493 __print_funct_t render_net_sock_stats(struct activity *a, int isdb, char *pre,
1494                                       int curr, unsigned long long itv)
1495 {
1496         struct stats_net_sock
1497                 *snsc = (struct stats_net_sock *) a->buf[curr];
1498         int pt_newlin
1499                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1500
1501         render(isdb, pre, PT_USEINT,
1502                "-\ttotsck", NULL, NULL,
1503                snsc->sock_inuse, DNOVAL, NULL);
1504
1505         render(isdb, pre, PT_USEINT,
1506                "-\ttcpsck", NULL, NULL,
1507                snsc->tcp_inuse, DNOVAL, NULL);
1508
1509         render(isdb, pre, PT_USEINT,
1510                "-\tudpsck",  NULL, NULL,
1511                snsc->udp_inuse, DNOVAL, NULL);
1512
1513         render(isdb, pre, PT_USEINT,
1514                "-\trawsck", NULL, NULL,
1515                snsc->raw_inuse, DNOVAL, NULL);
1516
1517         render(isdb, pre, PT_USEINT,
1518                "-\tip-frag", NULL, NULL,
1519                snsc->frag_inuse, DNOVAL, NULL);
1520
1521         render(isdb, pre, PT_USEINT | pt_newlin,
1522                "-\ttcp-tw", NULL, NULL,
1523                snsc->tcp_tw, DNOVAL, NULL);
1524 }
1525
1526 /*
1527  ***************************************************************************
1528  * Display IP network statistics in selected format.
1529  *
1530  * IN:
1531  * @a           Activity structure with statistics.
1532  * @isdb        Flag, true if db printing, false if ppc printing.
1533  * @pre         Prefix string for output entries
1534  * @curr        Index in array for current sample statistics.
1535  * @itv         Interval of time in jiffies.
1536  ***************************************************************************
1537  */
1538 __print_funct_t render_net_ip_stats(struct activity *a, int isdb, char *pre,
1539                                     int curr, unsigned long long itv)
1540 {
1541         struct stats_net_ip
1542                 *snic = (struct stats_net_ip *) a->buf[curr],
1543                 *snip = (struct stats_net_ip *) a->buf[!curr];
1544         int pt_newlin
1545                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1546
1547         render(isdb, pre, PT_NOFLAG,
1548                "-\tirec/s", NULL, NULL,
1549                NOVAL,
1550                S_VALUE(snip->InReceives, snic->InReceives, itv),
1551                NULL);
1552
1553         render(isdb, pre, PT_NOFLAG,
1554                "-\tfwddgm/s", NULL, NULL,
1555                NOVAL,
1556                S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1557                NULL);
1558
1559         render(isdb, pre, PT_NOFLAG,
1560                "-\tidel/s", NULL, NULL,
1561                NOVAL,
1562                S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1563                NULL);
1564
1565         render(isdb, pre, PT_NOFLAG,
1566                "-\torq/s", NULL, NULL,
1567                NOVAL,
1568                S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1569                NULL);
1570
1571         render(isdb, pre, PT_NOFLAG,
1572                "-\tasmrq/s", NULL, NULL,
1573                NOVAL,
1574                S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1575                NULL);
1576
1577         render(isdb, pre, PT_NOFLAG,
1578                "-\tasmok/s", NULL, NULL,
1579                NOVAL,
1580                S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1581                NULL);
1582
1583         render(isdb, pre, PT_NOFLAG,
1584                "-\tfragok/s", NULL, NULL,
1585                NOVAL,
1586                S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1587                NULL);
1588
1589         render(isdb, pre, pt_newlin,
1590                "-\tfragcrt/s", NULL, NULL,
1591                NOVAL,
1592                S_VALUE(snip->FragCreates, snic->FragCreates, itv),
1593                NULL);
1594 }
1595
1596 /*
1597  ***************************************************************************
1598  * Display IP network errors statistics in selected format.
1599  *
1600  * IN:
1601  * @a           Activity structure with statistics.
1602  * @isdb        Flag, true if db printing, false if ppc printing.
1603  * @pre         Prefix string for output entries
1604  * @curr        Index in array for current sample statistics.
1605  * @itv         Interval of time in jiffies.
1606  ***************************************************************************
1607  */
1608 __print_funct_t render_net_eip_stats(struct activity *a, int isdb, char *pre,
1609                                      int curr, unsigned long long itv)
1610 {
1611         struct stats_net_eip
1612                 *sneic = (struct stats_net_eip *) a->buf[curr],
1613                 *sneip = (struct stats_net_eip *) a->buf[!curr];
1614         int pt_newlin
1615                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1616
1617         render(isdb, pre, PT_NOFLAG,
1618                "-\tihdrerr/s", NULL, NULL,
1619                NOVAL,
1620                S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1621                NULL);
1622
1623         render(isdb, pre, PT_NOFLAG,
1624                "-\tiadrerr/s", NULL, NULL,
1625                NOVAL,
1626                S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1627                NULL);
1628
1629         render(isdb, pre, PT_NOFLAG,
1630                "-\tiukwnpr/s", NULL, NULL,
1631                NOVAL,
1632                S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1633                NULL);
1634
1635         render(isdb, pre, PT_NOFLAG,
1636                "-\tidisc/s", NULL, NULL,
1637                NOVAL,
1638                S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1639                NULL);
1640
1641         render(isdb, pre, PT_NOFLAG,
1642                "-\todisc/s", NULL, NULL,
1643                NOVAL,
1644                S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1645                NULL);
1646
1647         render(isdb, pre, PT_NOFLAG,
1648                "-\tonort/s", NULL, NULL,
1649                NOVAL,
1650                S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1651                NULL);
1652
1653         render(isdb, pre, PT_NOFLAG,
1654                "-\tasmf/s", NULL, NULL,
1655                NOVAL,
1656                S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1657                NULL);
1658
1659         render(isdb, pre, pt_newlin,
1660                "-\tfragf/s", NULL, NULL,
1661                NOVAL,
1662                S_VALUE(sneip->FragFails, sneic->FragFails, itv),
1663                NULL);
1664 }
1665
1666 /*
1667  ***************************************************************************
1668  * Display ICMP network statistics in selected format.
1669  *
1670  * IN:
1671  * @a           Activity structure with statistics.
1672  * @isdb        Flag, true if db printing, false if ppc printing.
1673  * @pre         Prefix string for output entries
1674  * @curr        Index in array for current sample statistics.
1675  * @itv         Interval of time in jiffies.
1676  ***************************************************************************
1677  */
1678 __print_funct_t render_net_icmp_stats(struct activity *a, int isdb, char *pre,
1679                                       int curr, unsigned long long itv)
1680 {
1681         struct stats_net_icmp
1682                 *snic = (struct stats_net_icmp *) a->buf[curr],
1683                 *snip = (struct stats_net_icmp *) a->buf[!curr];
1684         int pt_newlin
1685                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1686
1687         render(isdb, pre, PT_NOFLAG,
1688                "-\timsg/s", NULL, NULL,
1689                NOVAL,
1690                S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1691                NULL);
1692
1693         render(isdb, pre, PT_NOFLAG,
1694                "-\tomsg/s", NULL, NULL,
1695                NOVAL,
1696                S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1697                NULL);
1698
1699         render(isdb, pre, PT_NOFLAG,
1700                "-\tiech/s", NULL, NULL,
1701                NOVAL,
1702                S_VALUE(snip->InEchos, snic->InEchos, itv),
1703                NULL);
1704
1705         render(isdb, pre, PT_NOFLAG,
1706                "-\tiechr/s", NULL, NULL,
1707                NOVAL,
1708                S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1709                NULL);
1710
1711         render(isdb, pre, PT_NOFLAG,
1712                "-\toech/s", NULL, NULL,
1713                NOVAL,
1714                S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1715                NULL);
1716
1717         render(isdb, pre, PT_NOFLAG,
1718                "-\toechr/s", NULL, NULL,
1719                NOVAL,
1720                S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1721                NULL);
1722
1723         render(isdb, pre, PT_NOFLAG,
1724                "-\titm/s", NULL, NULL,
1725                NOVAL,
1726                S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1727                NULL);
1728
1729         render(isdb, pre, PT_NOFLAG,
1730                "-\titmr/s", NULL, NULL,
1731                NOVAL,
1732                S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1733                NULL);
1734
1735         render(isdb, pre, PT_NOFLAG,
1736                "-\totm/s", NULL, NULL,
1737                NOVAL,
1738                S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1739                NULL);
1740
1741         render(isdb, pre, PT_NOFLAG,
1742                "-\totmr/s", NULL, NULL,
1743                NOVAL,
1744                S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1745                NULL);
1746
1747         render(isdb, pre, PT_NOFLAG,
1748                "-\tiadrmk/s", NULL, NULL,
1749                NOVAL,
1750                S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1751                NULL);
1752
1753         render(isdb, pre, PT_NOFLAG,
1754                "-\tiadrmkr/s", NULL, NULL,
1755                NOVAL,
1756                S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1757                NULL);
1758
1759         render(isdb, pre, PT_NOFLAG,
1760                "-\toadrmk/s", NULL, NULL,
1761                NOVAL,
1762                S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1763                NULL);
1764
1765         render(isdb, pre, pt_newlin,
1766                "-\toadrmkr/s", NULL, NULL,
1767                NOVAL,
1768                S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv),
1769                NULL);
1770 }
1771
1772 /*
1773  ***************************************************************************
1774  * Display ICMP error messages statistics in selected format.
1775  *
1776  * IN:
1777  * @a           Activity structure with statistics.
1778  * @isdb        Flag, true if db printing, false if ppc printing.
1779  * @pre         Prefix string for output entries
1780  * @curr        Index in array for current sample statistics.
1781  * @itv         Interval of time in jiffies.
1782  ***************************************************************************
1783  */
1784 __print_funct_t render_net_eicmp_stats(struct activity *a, int isdb, char *pre,
1785                                        int curr, unsigned long long itv)
1786 {
1787         struct stats_net_eicmp
1788                 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1789                 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1790         int pt_newlin
1791                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1792
1793         render(isdb, pre, PT_NOFLAG,
1794                "-\tierr/s", NULL, NULL,
1795                NOVAL,
1796                S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1797                NULL);
1798
1799         render(isdb, pre, PT_NOFLAG,
1800                "-\toerr/s", NULL, NULL,
1801                NOVAL,
1802                S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1803                NULL);
1804
1805         render(isdb, pre, PT_NOFLAG,
1806                "-\tidstunr/s", NULL, NULL,
1807                NOVAL,
1808                S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1809                NULL);
1810
1811         render(isdb, pre, PT_NOFLAG,
1812                "-\todstunr/s", NULL, NULL,
1813                NOVAL,
1814                S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1815                NULL);
1816
1817         render(isdb, pre, PT_NOFLAG,
1818                "-\titmex/s", NULL, NULL,
1819                NOVAL,
1820                S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1821                NULL);
1822
1823         render(isdb, pre, PT_NOFLAG,
1824                "-\totmex/s", NULL, NULL,
1825                NOVAL,
1826                S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1827                NULL);
1828
1829         render(isdb, pre, PT_NOFLAG,
1830                "-\tiparmpb/s", NULL, NULL,
1831                NOVAL,
1832                S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1833                NULL);
1834
1835         render(isdb, pre, PT_NOFLAG,
1836                "-\toparmpb/s", NULL, NULL,
1837                NOVAL,
1838                S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1839                NULL);
1840
1841         render(isdb, pre, PT_NOFLAG,
1842                "-\tisrcq/s", NULL, NULL,
1843                NOVAL,
1844                S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1845                NULL);
1846
1847         render(isdb, pre, PT_NOFLAG,
1848                "-\tosrcq/s", NULL, NULL,
1849                NOVAL,
1850                S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1851                NULL);
1852
1853         render(isdb, pre, PT_NOFLAG,
1854                "-\tiredir/s", NULL, NULL,
1855                NOVAL,
1856                S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1857                NULL);
1858
1859         render(isdb, pre, pt_newlin,
1860                "-\toredir/s", NULL, NULL,
1861                NOVAL,
1862                S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv),
1863                NULL);
1864 }
1865
1866 /*
1867  ***************************************************************************
1868  * Display TCP network statistics in selected format.
1869  *
1870  * IN:
1871  * @a           Activity structure with statistics.
1872  * @isdb        Flag, true if db printing, false if ppc printing.
1873  * @pre         Prefix string for output entries
1874  * @curr        Index in array for current sample statistics.
1875  * @itv         Interval of time in jiffies.
1876  ***************************************************************************
1877  */
1878 __print_funct_t render_net_tcp_stats(struct activity *a, int isdb, char *pre,
1879                                      int curr, unsigned long long itv)
1880 {
1881         struct stats_net_tcp
1882                 *sntc = (struct stats_net_tcp *) a->buf[curr],
1883                 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1884         int pt_newlin
1885                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1886
1887         render(isdb, pre, PT_NOFLAG,
1888                "-\tactive/s", NULL, NULL,
1889                NOVAL,
1890                S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1891                NULL);
1892
1893         render(isdb, pre, PT_NOFLAG,
1894                "-\tpassive/s", NULL, NULL,
1895                NOVAL,
1896                S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1897                NULL);
1898
1899         render(isdb, pre, PT_NOFLAG,
1900                "-\tiseg/s", NULL, NULL,
1901                NOVAL,
1902                S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1903                NULL);
1904
1905         render(isdb, pre, pt_newlin,
1906                "-\toseg/s", NULL, NULL,
1907                NOVAL,
1908                S_VALUE(sntp->OutSegs, sntc->OutSegs, itv),
1909                NULL);
1910 }
1911
1912 /*
1913  ***************************************************************************
1914  * Display TCP network errors statistics in selected format.
1915  *
1916  * IN:
1917  * @a           Activity structure with statistics.
1918  * @isdb        Flag, true if db printing, false if ppc printing.
1919  * @pre         Prefix string for output entries
1920  * @curr        Index in array for current sample statistics.
1921  * @itv         Interval of time in jiffies.
1922  ***************************************************************************
1923  */
1924 __print_funct_t render_net_etcp_stats(struct activity *a, int isdb, char *pre,
1925                                       int curr, unsigned long long itv)
1926 {
1927         struct stats_net_etcp
1928                 *snetc = (struct stats_net_etcp *) a->buf[curr],
1929                 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1930         int pt_newlin
1931                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1932
1933         render(isdb, pre, PT_NOFLAG,
1934                "-\tatmptf/s", NULL, NULL,
1935                NOVAL,
1936                S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1937                NULL);
1938
1939         render(isdb, pre, PT_NOFLAG,
1940                "-\testres/s", NULL, NULL,
1941                NOVAL,
1942                S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1943                NULL);
1944
1945         render(isdb, pre, PT_NOFLAG,
1946                "-\tretrans/s", NULL, NULL,
1947                NOVAL,
1948                S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1949                NULL);
1950
1951         render(isdb, pre, PT_NOFLAG,
1952                "-\tisegerr/s", NULL, NULL,
1953                NOVAL,
1954                S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1955                NULL);
1956
1957         render(isdb, pre, pt_newlin,
1958                "-\torsts/s", NULL, NULL,
1959                NOVAL,
1960                S_VALUE(snetp->OutRsts, snetc->OutRsts, itv),
1961                NULL);
1962 }
1963
1964 /*
1965  ***************************************************************************
1966  * Display UDP network statistics in selected format.
1967  *
1968  * IN:
1969  * @a           Activity structure with statistics.
1970  * @isdb        Flag, true if db printing, false if ppc printing.
1971  * @pre         Prefix string for output entries
1972  * @curr        Index in array for current sample statistics.
1973  * @itv         Interval of time in jiffies.
1974  ***************************************************************************
1975  */
1976 __print_funct_t render_net_udp_stats(struct activity *a, int isdb, char *pre,
1977                                      int curr, unsigned long long itv)
1978 {
1979         struct stats_net_udp
1980                 *snuc = (struct stats_net_udp *) a->buf[curr],
1981                 *snup = (struct stats_net_udp *) a->buf[!curr];
1982         int pt_newlin
1983                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1984
1985         render(isdb, pre, PT_NOFLAG,
1986                "-\tidgm/s", NULL, NULL,
1987                NOVAL,
1988                S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1989                NULL);
1990
1991         render(isdb, pre, PT_NOFLAG,
1992                "-\todgm/s", NULL, NULL,
1993                NOVAL,
1994                S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1995                NULL);
1996
1997         render(isdb, pre, PT_NOFLAG,
1998                "-\tnoport/s", NULL, NULL,
1999                NOVAL,
2000                S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
2001                NULL);
2002
2003         render(isdb, pre, pt_newlin,
2004                "-\tidgmerr/s", NULL, NULL,
2005                NOVAL,
2006                S_VALUE(snup->InErrors, snuc->InErrors, itv),
2007                NULL);
2008 }
2009
2010 /*
2011  ***************************************************************************
2012  * Display IPv6 network sockets statistics in selected format.
2013  *
2014  * IN:
2015  * @a           Activity structure with statistics.
2016  * @isdb        Flag, true if db printing, false if ppc printing.
2017  * @pre         Prefix string for output entries
2018  * @curr        Index in array for current sample statistics.
2019  * @itv         Interval of time in jiffies.
2020  ***************************************************************************
2021  */
2022 __print_funct_t render_net_sock6_stats(struct activity *a, int isdb, char *pre,
2023                                        int curr, unsigned long long itv)
2024 {
2025         struct stats_net_sock6
2026                 *snsc = (struct stats_net_sock6 *) a->buf[curr];
2027         int pt_newlin
2028                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2029
2030         render(isdb, pre, PT_USEINT,
2031                "-\ttcp6sck", NULL, NULL,
2032                snsc->tcp6_inuse, DNOVAL, NULL);
2033
2034         render(isdb, pre, PT_USEINT,
2035                "-\tudp6sck",  NULL, NULL,
2036                snsc->udp6_inuse, DNOVAL, NULL);
2037
2038         render(isdb, pre, PT_USEINT,
2039                "-\traw6sck", NULL, NULL,
2040                snsc->raw6_inuse, DNOVAL, NULL);
2041
2042         render(isdb, pre, PT_USEINT | pt_newlin,
2043                "-\tip6-frag", NULL, NULL,
2044                snsc->frag6_inuse, DNOVAL, NULL);
2045 }
2046
2047 /*
2048  ***************************************************************************
2049  * Display IPv6 network statistics in selected format.
2050  *
2051  * IN:
2052  * @a           Activity structure with statistics.
2053  * @isdb        Flag, true if db printing, false if ppc printing.
2054  * @pre         Prefix string for output entries
2055  * @curr        Index in array for current sample statistics.
2056  * @itv         Interval of time in jiffies.
2057  ***************************************************************************
2058  */
2059 __print_funct_t render_net_ip6_stats(struct activity *a, int isdb, char *pre,
2060                                      int curr, unsigned long long itv)
2061 {
2062         struct stats_net_ip6
2063                 *snic = (struct stats_net_ip6 *) a->buf[curr],
2064                 *snip = (struct stats_net_ip6 *) a->buf[!curr];
2065         int pt_newlin
2066                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2067
2068         render(isdb, pre, PT_NOFLAG,
2069                "-\tirec6/s", NULL, NULL,
2070                NOVAL,
2071                S_VALUE(snip->InReceives6, snic->InReceives6, itv),
2072                NULL);
2073
2074         render(isdb, pre, PT_NOFLAG,
2075                "-\tfwddgm6/s", NULL, NULL,
2076                NOVAL,
2077                S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
2078                NULL);
2079
2080         render(isdb, pre, PT_NOFLAG,
2081                "-\tidel6/s", NULL, NULL,
2082                NOVAL,
2083                S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
2084                NULL);
2085
2086         render(isdb, pre, PT_NOFLAG,
2087                "-\torq6/s", NULL, NULL,
2088                NOVAL,
2089                S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
2090                NULL);
2091
2092         render(isdb, pre, PT_NOFLAG,
2093                "-\tasmrq6/s", NULL, NULL,
2094                NOVAL,
2095                S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
2096                NULL);
2097
2098         render(isdb, pre, PT_NOFLAG,
2099                "-\tasmok6/s", NULL, NULL,
2100                NOVAL,
2101                S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
2102                NULL);
2103
2104         render(isdb, pre, PT_NOFLAG,
2105                "-\timcpck6/s", NULL, NULL,
2106                NOVAL,
2107                S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
2108                NULL);
2109
2110         render(isdb, pre, PT_NOFLAG,
2111                "-\tomcpck6/s", NULL, NULL,
2112                NOVAL,
2113                S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
2114                NULL);
2115
2116         render(isdb, pre, PT_NOFLAG,
2117                "-\tfragok6/s", NULL, NULL,
2118                NOVAL,
2119                S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
2120                NULL);
2121
2122         render(isdb, pre, pt_newlin,
2123                "-\tfragcr6/s", NULL, NULL,
2124                NOVAL,
2125                S_VALUE(snip->FragCreates6, snic->FragCreates6, itv),
2126                NULL);
2127 }
2128
2129 /*
2130  ***************************************************************************
2131  * Display IPv6 network errors statistics in selected format.
2132  *
2133  * IN:
2134  * @a           Activity structure with statistics.
2135  * @isdb        Flag, true if db printing, false if ppc printing.
2136  * @pre         Prefix string for output entries
2137  * @curr        Index in array for current sample statistics.
2138  * @itv         Interval of time in jiffies.
2139  ***************************************************************************
2140  */
2141 __print_funct_t render_net_eip6_stats(struct activity *a, int isdb, char *pre,
2142                                       int curr, unsigned long long itv)
2143 {
2144         struct stats_net_eip6
2145                 *sneic = (struct stats_net_eip6 *) a->buf[curr],
2146                 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
2147         int pt_newlin
2148                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2149
2150         render(isdb, pre, PT_NOFLAG,
2151                "-\tihdrer6/s", NULL, NULL,
2152                NOVAL,
2153                S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
2154                NULL);
2155
2156         render(isdb, pre, PT_NOFLAG,
2157                "-\tiadrer6/s", NULL, NULL,
2158                NOVAL,
2159                S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
2160                NULL);
2161
2162         render(isdb, pre, PT_NOFLAG,
2163                "-\tiukwnp6/s", NULL, NULL,
2164                NOVAL,
2165                S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
2166                NULL);
2167
2168         render(isdb, pre, PT_NOFLAG,
2169                "-\ti2big6/s", NULL, NULL,
2170                NOVAL,
2171                S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
2172                NULL);
2173
2174         render(isdb, pre, PT_NOFLAG,
2175                "-\tidisc6/s", NULL, NULL,
2176                NOVAL,
2177                S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
2178                NULL);
2179
2180         render(isdb, pre, PT_NOFLAG,
2181                "-\todisc6/s", NULL, NULL,
2182                NOVAL,
2183                S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
2184                NULL);
2185
2186         render(isdb, pre, PT_NOFLAG,
2187                "-\tinort6/s", NULL, NULL,
2188                NOVAL,
2189                S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
2190                NULL);
2191
2192         render(isdb, pre, PT_NOFLAG,
2193                "-\tonort6/s", NULL, NULL,
2194                NOVAL,
2195                S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
2196                NULL);
2197
2198         render(isdb, pre, PT_NOFLAG,
2199                "-\tasmf6/s", NULL, NULL,
2200                NOVAL,
2201                S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
2202                NULL);
2203
2204         render(isdb, pre, PT_NOFLAG,
2205                "-\tfragf6/s", NULL, NULL,
2206                NOVAL,
2207                S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
2208                NULL);
2209
2210         render(isdb, pre, pt_newlin,
2211                "-\titrpck6/s", NULL, NULL,
2212                NOVAL,
2213                S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv),
2214                NULL);
2215 }
2216
2217 /*
2218  ***************************************************************************
2219  * Display ICMPv6 network statistics in selected format.
2220  *
2221  * IN:
2222  * @a           Activity structure with statistics.
2223  * @isdb        Flag, true if db printing, false if ppc printing.
2224  * @pre         Prefix string for output entries
2225  * @curr        Index in array for current sample statistics.
2226  * @itv         Interval of time in jiffies.
2227  ***************************************************************************
2228  */
2229 __print_funct_t render_net_icmp6_stats(struct activity *a, int isdb, char *pre,
2230                                        int curr, unsigned long long itv)
2231 {
2232         struct stats_net_icmp6
2233                 *snic = (struct stats_net_icmp6 *) a->buf[curr],
2234                 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
2235         int pt_newlin
2236                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2237
2238         render(isdb, pre, PT_NOFLAG,
2239                "-\timsg6/s", NULL, NULL,
2240                NOVAL,
2241                S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
2242                NULL);
2243
2244         render(isdb, pre, PT_NOFLAG,
2245                "-\tomsg6/s", NULL, NULL,
2246                NOVAL,
2247                S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
2248                NULL);
2249
2250         render(isdb, pre, PT_NOFLAG,
2251                "-\tiech6/s", NULL, NULL,
2252                NOVAL,
2253                S_VALUE(snip->InEchos6, snic->InEchos6, itv),
2254                NULL);
2255
2256         render(isdb, pre, PT_NOFLAG,
2257                "-\tiechr6/s", NULL, NULL,
2258                NOVAL,
2259                S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
2260                NULL);
2261
2262         render(isdb, pre, PT_NOFLAG,
2263                "-\toechr6/s", NULL, NULL,
2264                NOVAL,
2265                S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
2266                NULL);
2267
2268         render(isdb, pre, PT_NOFLAG,
2269                "-\tigmbq6/s", NULL, NULL,
2270                NOVAL,
2271                S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
2272                NULL);
2273
2274         render(isdb, pre, PT_NOFLAG,
2275                "-\tigmbr6/s", NULL, NULL,
2276                NOVAL,
2277                S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
2278                NULL);
2279
2280         render(isdb, pre, PT_NOFLAG,
2281                "-\togmbr6/s", NULL, NULL,
2282                NOVAL,
2283                S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
2284                NULL);
2285
2286         render(isdb, pre, PT_NOFLAG,
2287                "-\tigmbrd6/s", NULL, NULL,
2288                NOVAL,
2289                S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
2290                NULL);
2291
2292         render(isdb, pre, PT_NOFLAG,
2293                "-\togmbrd6/s", NULL, NULL,
2294                NOVAL,
2295                S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
2296                NULL);
2297
2298         render(isdb, pre, PT_NOFLAG,
2299                "-\tirtsol6/s", NULL, NULL,
2300                NOVAL,
2301                S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
2302                NULL);
2303
2304         render(isdb, pre, PT_NOFLAG,
2305                "-\tortsol6/s", NULL, NULL,
2306                NOVAL,
2307                S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
2308                NULL);
2309
2310         render(isdb, pre, PT_NOFLAG,
2311                "-\tirtad6/s", NULL, NULL,
2312                NOVAL,
2313                S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
2314                NULL);
2315
2316         render(isdb, pre, PT_NOFLAG,
2317                "-\tinbsol6/s", NULL, NULL,
2318                NOVAL,
2319                S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
2320                NULL);
2321
2322         render(isdb, pre, PT_NOFLAG,
2323                "-\tonbsol6/s", NULL, NULL,
2324                NOVAL,
2325                S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
2326                NULL);
2327
2328         render(isdb, pre, PT_NOFLAG,
2329                "-\tinbad6/s", NULL, NULL,
2330                NOVAL,
2331                S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
2332                NULL);
2333
2334         render(isdb, pre, pt_newlin,
2335                "-\tonbad6/s", NULL, NULL,
2336                NOVAL,
2337                S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv),
2338                NULL);
2339 }
2340
2341 /*
2342  ***************************************************************************
2343  * Display ICMPv6 error messages statistics in selected format.
2344  *
2345  * IN:
2346  * @a           Activity structure with statistics.
2347  * @isdb        Flag, true if db printing, false if ppc printing.
2348  * @pre         Prefix string for output entries
2349  * @curr        Index in array for current sample statistics.
2350  * @itv         Interval of time in jiffies.
2351  ***************************************************************************
2352  */
2353 __print_funct_t render_net_eicmp6_stats(struct activity *a, int isdb, char *pre,
2354                                         int curr, unsigned long long itv)
2355 {
2356         struct stats_net_eicmp6
2357                 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
2358                 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
2359         int pt_newlin
2360                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2361
2362         render(isdb, pre, PT_NOFLAG,
2363                "-\tierr6/s", NULL, NULL,
2364                NOVAL,
2365                S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
2366                NULL);
2367
2368         render(isdb, pre, PT_NOFLAG,
2369                "-\tidtunr6/s", NULL, NULL,
2370                NOVAL,
2371                S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
2372                NULL);
2373
2374         render(isdb, pre, PT_NOFLAG,
2375                "-\todtunr6/s", NULL, NULL,
2376                NOVAL,
2377                S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
2378                NULL);
2379
2380         render(isdb, pre, PT_NOFLAG,
2381                "-\titmex6/s", NULL, NULL,
2382                NOVAL,
2383                S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
2384                NULL);
2385
2386         render(isdb, pre, PT_NOFLAG,
2387                "-\totmex6/s", NULL, NULL,
2388                NOVAL,
2389                S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
2390                NULL);
2391
2392         render(isdb, pre, PT_NOFLAG,
2393                "-\tiprmpb6/s", NULL, NULL,
2394                NOVAL,
2395                S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
2396                NULL);
2397
2398         render(isdb, pre, PT_NOFLAG,
2399                "-\toprmpb6/s", NULL, NULL,
2400                NOVAL,
2401                S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
2402                NULL);
2403
2404         render(isdb, pre, PT_NOFLAG,
2405                "-\tiredir6/s", NULL, NULL,
2406                NOVAL,
2407                S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
2408                NULL);
2409
2410         render(isdb, pre, PT_NOFLAG,
2411                "-\toredir6/s", NULL, NULL,
2412                NOVAL,
2413                S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
2414                NULL);
2415
2416         render(isdb, pre, PT_NOFLAG,
2417                "-\tipck2b6/s", NULL, NULL,
2418                NOVAL,
2419                S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
2420                NULL);
2421
2422         render(isdb, pre, pt_newlin,
2423                "-\topck2b6/s", NULL, NULL,
2424                NOVAL,
2425                S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv),
2426                NULL);
2427 }
2428
2429 /*
2430  ***************************************************************************
2431  * Display UDP6 network statistics in selected format.
2432  *
2433  * IN:
2434  * @a           Activity structure with statistics.
2435  * @isdb        Flag, true if db printing, false if ppc printing.
2436  * @pre         Prefix string for output entries
2437  * @curr        Index in array for current sample statistics.
2438  * @itv         Interval of time in jiffies.
2439  ***************************************************************************
2440  */
2441 __print_funct_t render_net_udp6_stats(struct activity *a, int isdb, char *pre,
2442                                       int curr, unsigned long long itv)
2443 {
2444         struct stats_net_udp6
2445                 *snuc = (struct stats_net_udp6 *) a->buf[curr],
2446                 *snup = (struct stats_net_udp6 *) a->buf[!curr];
2447         int pt_newlin
2448                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2449
2450         render(isdb, pre, PT_NOFLAG,
2451                "-\tidgm6/s", NULL, NULL,
2452                NOVAL,
2453                S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
2454                NULL);
2455
2456         render(isdb, pre, PT_NOFLAG,
2457                "-\todgm6/s", NULL, NULL,
2458                NOVAL,
2459                S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
2460                NULL);
2461
2462         render(isdb, pre, PT_NOFLAG,
2463                "-\tnoport6/s", NULL, NULL,
2464                NOVAL,
2465                S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
2466                NULL);
2467
2468         render(isdb, pre, pt_newlin,
2469                "-\tidgmer6/s", NULL, NULL,
2470                NOVAL,
2471                S_VALUE(snup->InErrors6, snuc->InErrors6, itv),
2472                NULL);
2473 }
2474
2475 /*
2476  ***************************************************************************
2477  * Display CPU frequency statistics in selected format.
2478  *
2479  * IN:
2480  * @a           Activity structure with statistics.
2481  * @isdb        Flag, true if db printing, false if ppc printing.
2482  * @pre         Prefix string for output entries
2483  * @curr        Index in array for current sample statistics.
2484  * @itv         Interval of time in jiffies.
2485  ***************************************************************************
2486  */
2487 __print_funct_t render_pwr_cpufreq_stats(struct activity *a, int isdb, char *pre,
2488                                          int curr, unsigned long long itv)
2489 {
2490         int i;
2491         struct stats_pwr_cpufreq *spc;
2492         int pt_newlin
2493                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2494
2495         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2496
2497                 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
2498
2499                 /* Should current CPU (including CPU "all") be displayed? */
2500                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2501
2502                         if (!i) {
2503                                 /* This is CPU "all" */
2504                                 render(isdb, pre, pt_newlin,
2505                                        "all\tMHz",
2506                                        "-1", NULL,
2507                                        NOVAL,
2508                                        ((double) spc->cpufreq) / 100,
2509                                        NULL);
2510                         }
2511                         else {
2512                                 render(isdb, pre, pt_newlin,
2513                                        "cpu%d\tMHz",
2514                                        "%d", cons(iv, i - 1, NOVAL),
2515                                        NOVAL,
2516                                        ((double) spc->cpufreq) / 100,
2517                                        NULL);
2518                         }
2519                 }
2520         }
2521 }
2522
2523 /*
2524  ***************************************************************************
2525  * Display fan statistics in selected format.
2526  *
2527  * IN:
2528  * @a           Activity structure with statistics.
2529  * @isdb        Flag, true if db printing, false if ppc printing.
2530  * @pre         Prefix string for output entries
2531  * @curr        Index in array for current sample statistics.
2532  * @itv         Interval of time in jiffies.
2533  ***************************************************************************
2534  */
2535 __print_funct_t render_pwr_fan_stats(struct activity *a, int isdb, char *pre,
2536                                      int curr, unsigned long long itv)
2537 {
2538         int i;
2539         struct stats_pwr_fan *spc;
2540         int pt_newlin
2541                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2542
2543         for (i = 0; i < a->nr; i++) {
2544                 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
2545
2546                 render(isdb, pre, PT_USESTR,
2547                        "fan%d\tDEVICE",
2548                        "%d",
2549                        cons(iv, i + 1, NOVAL),
2550                        NOVAL,
2551                        NOVAL,
2552                        spc->device);
2553
2554                 render(isdb, pre, PT_NOFLAG,
2555                        "fan%d\trpm",
2556                        NULL,
2557                        cons(iv, i + 1, NOVAL),
2558                        NOVAL,
2559                        spc->rpm,
2560                        NULL);
2561
2562                 render(isdb, pre, pt_newlin,
2563                        "fan%d\tdrpm",
2564                        NULL,
2565                        cons(iv, i + 1, NOVAL),
2566                        NOVAL,
2567                        spc->rpm - spc->rpm_min,
2568                        NULL);
2569         }
2570 }
2571
2572 /*
2573  ***************************************************************************
2574  * Display temperature statistics in selected format.
2575  *
2576  * IN:
2577  * @a           Activity structure with statistics.
2578  * @isdb        Flag, true if db printing, false if ppc printing.
2579  * @pre         Prefix string for output entries
2580  * @curr        Index in array for current sample statistics.
2581  * @itv         Interval of time in jiffies.
2582  ***************************************************************************
2583  */
2584 __print_funct_t render_pwr_temp_stats(struct activity *a, int isdb, char *pre,
2585                                       int curr, unsigned long long itv)
2586 {
2587         int i;
2588         struct stats_pwr_temp *spc;
2589         int pt_newlin
2590                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2591
2592         for (i = 0; i < a->nr; i++) {
2593                 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
2594
2595                 render(isdb, pre, PT_USESTR,
2596                        "temp%d\tDEVICE",
2597                        "%d",
2598                        cons(iv, i + 1, NOVAL),
2599                        NOVAL,
2600                        NOVAL,
2601                        spc->device);
2602
2603                 render(isdb, pre, PT_NOFLAG,
2604                        "temp%d\tdegC",
2605                        NULL,
2606                        cons(iv, i + 1, NOVAL),
2607                        NOVAL,
2608                        spc->temp,
2609                        NULL);
2610
2611                 render(isdb, pre, pt_newlin,
2612                        "temp%d\t%%temp",
2613                        NULL,
2614                        cons(iv, i + 1, NOVAL),
2615                        NOVAL,
2616                        (spc->temp_max - spc->temp_min) ?
2617                        (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
2618                        0.0,
2619                        NULL);
2620         }
2621 }
2622
2623 /*
2624  ***************************************************************************
2625  * Display voltage inputs statistics in selected format.
2626  *
2627  * IN:
2628  * @a           Activity structure with statistics.
2629  * @isdb        Flag, true if db printing, false if ppc printing.
2630  * @pre         Prefix string for output entries
2631  * @curr        Index in array for current sample statistics.
2632  * @itv         Interval of time in jiffies.
2633  ***************************************************************************
2634  */
2635 __print_funct_t render_pwr_in_stats(struct activity *a, int isdb, char *pre,
2636                                     int curr, unsigned long long itv)
2637 {
2638         int i;
2639         struct stats_pwr_in *spc;
2640         int pt_newlin
2641                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2642
2643         for (i = 0; i < a->nr; i++) {
2644                 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
2645
2646                 render(isdb, pre, PT_USESTR,
2647                        "in%d\tDEVICE",
2648                        "%d",
2649                        cons(iv, i, NOVAL),
2650                        NOVAL,
2651                        NOVAL,
2652                        spc->device);
2653
2654                 render(isdb, pre, PT_NOFLAG,
2655                        "in%d\tinV",
2656                        NULL,
2657                        cons(iv, i, NOVAL),
2658                        NOVAL,
2659                        spc->in,
2660                        NULL);
2661
2662                 render(isdb, pre, pt_newlin,
2663                        "in%d\t%%in",
2664                        NULL,
2665                        cons(iv, i, NOVAL),
2666                        NOVAL,
2667                        (spc->in_max - spc->in_min) ?
2668                        (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
2669                        0.0,
2670                        NULL);
2671         }
2672 }
2673
2674 /*
2675  ***************************************************************************
2676  * Display huge pages statistics in selected format.
2677  *
2678  * IN:
2679  * @a           Activity structure with statistics.
2680  * @isdb        Flag, true if db printing, false if ppc printing.
2681  * @pre         Prefix string for output entries
2682  * @curr        Index in array for current sample statistics.
2683  * @itv         Interval of time in jiffies.
2684  ***************************************************************************
2685  */
2686 __print_funct_t render_huge_stats(struct activity *a, int isdb, char *pre,
2687                                   int curr, unsigned long long itv)
2688 {
2689         struct stats_huge
2690                 *smc = (struct stats_huge *) a->buf[curr];
2691         int pt_newlin
2692                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2693
2694         render(isdb, pre, PT_USEINT,
2695                "-\tkbhugfree", NULL, NULL,
2696                smc->frhkb, DNOVAL, NULL);
2697
2698         render(isdb, pre, PT_USEINT,
2699                "-\tkbhugused", NULL, NULL,
2700                smc->tlhkb - smc->frhkb, DNOVAL, NULL);
2701
2702         render(isdb, pre, pt_newlin,
2703                "-\t%%hugused", NULL, NULL, NOVAL,
2704                smc->tlhkb ?
2705                SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
2706                0.0, NULL);
2707 }
2708
2709 /*
2710  ***************************************************************************
2711  * Display weighted CPU frequency statistics in selected format.
2712  *
2713  * IN:
2714  * @a           Activity structure with statistics.
2715  * @isdb        Flag, true if db printing, false if ppc printing.
2716  * @pre         Prefix string for output entries
2717  * @curr        Index in array for current sample statistics.
2718  * @itv         Interval of time in jiffies.
2719  ***************************************************************************
2720  */
2721 __print_funct_t render_pwr_wghfreq_stats(struct activity *a, int isdb, char *pre,
2722                                          int curr, unsigned long long itv)
2723 {
2724         int i, k;
2725         struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
2726         unsigned long long tis, tisfreq;
2727         int pt_newlin
2728                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2729
2730         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2731
2732                 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr]  + i * a->msize * a->nr2);
2733                 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
2734
2735                 /* Should current CPU (including CPU "all") be displayed? */
2736                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2737
2738                         /* Yes... */
2739                         tisfreq = 0;
2740                         tis = 0;
2741
2742                         for (k = 0; k < a->nr2; k++) {
2743
2744                                 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2745                                 if (!spc_k->freq)
2746                                         break;
2747                                 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2748
2749                                 tisfreq += (spc_k->freq / 1000) *
2750                                            (spc_k->time_in_state - spp_k->time_in_state);
2751                                 tis     += (spc_k->time_in_state - spp_k->time_in_state);
2752                         }
2753
2754                         if (!i) {
2755                                 /* This is CPU "all" */
2756                                 render(isdb, pre, pt_newlin,
2757                                        "all\twghMHz",
2758                                        "-1", NULL,
2759                                        NOVAL,
2760                                        tis ? ((double) tisfreq) / tis : 0.0,
2761                                        NULL);
2762                         }
2763                         else {
2764                                 render(isdb, pre, pt_newlin,
2765                                        "cpu%d\twghMHz",
2766                                        "%d", cons(iv, i - 1, NOVAL),
2767                                        NOVAL,
2768                                        tis ? ((double) tisfreq) / tis : 0.0,
2769                                        NULL);
2770                         }
2771                 }
2772         }
2773 }
2774
2775 /*
2776  ***************************************************************************
2777  * Display USB devices statistics in selected format.
2778  *
2779  * IN:
2780  * @a           Activity structure with statistics.
2781  * @isdb        Flag, true if db printing, false if ppc printing.
2782  * @pre         Prefix string for output entries
2783  * @curr        Index in array for current sample statistics.
2784  * @itv         Interval of time in jiffies.
2785  ***************************************************************************
2786  */
2787 __print_funct_t render_pwr_usb_stats(struct activity *a, int isdb, char *pre,
2788                                      int curr, unsigned long long itv)
2789 {
2790         int i;
2791         struct stats_pwr_usb *suc;
2792         char id[9];
2793
2794         for (i = 0; i < a->nr; i++) {
2795                 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2796
2797                 if (!suc->bus_nr)
2798                         /* Bus#0 doesn't exist: We are at the end of the list */
2799                         break;
2800
2801                 sprintf(id, "%x", suc->vendor_id);
2802                 render(isdb, pre, PT_USESTR,
2803                        "bus%d\tidvendor",
2804                        "%d",
2805                        cons(iv, suc->bus_nr, NOVAL),
2806                        NOVAL,
2807                        NOVAL,
2808                        id);
2809
2810                 sprintf(id, "%x", suc->product_id);
2811                 render(isdb, pre, PT_USESTR,
2812                        "bus%d\tidprod",
2813                        NULL,
2814                        cons(iv, suc->bus_nr, NOVAL),
2815                        NOVAL,
2816                        NOVAL,
2817                        id);
2818
2819                 render(isdb, pre, PT_USEINT,
2820                        "bus%d\tmaxpower",
2821                        NULL,
2822                        cons(iv, suc->bus_nr, NOVAL),
2823                        suc->bmaxpower << 1,
2824                        NOVAL,
2825                        NULL);
2826
2827                 render(isdb, pre, PT_USESTR,
2828                        "bus%d\tmanufact",
2829                        NULL,
2830                        cons(iv, suc->bus_nr, NOVAL),
2831                        NOVAL,
2832                        NOVAL,
2833                        suc->manufacturer);
2834
2835                 render(isdb, pre,
2836                        (DISPLAY_HORIZONTALLY(flags) ? PT_USESTR : PT_USESTR | PT_NEWLIN),
2837                        "bus%d\tproduct",
2838                        NULL,
2839                        cons(iv, suc->bus_nr, NOVAL),
2840                        NOVAL,
2841                        NOVAL,
2842                        suc->product);
2843         }
2844 }
2845
2846 /*
2847  ***************************************************************************
2848  * Display filesystems statistics in selected format.
2849  *
2850  * IN:
2851  * @a           Activity structure with statistics.
2852  * @isdb        Flag, true if db printing, false if ppc printing.
2853  * @pre         Prefix string for output entries
2854  * @curr        Index in array for current sample statistics.
2855  * @itv         Interval of time in jiffies.
2856  ***************************************************************************
2857  */
2858 __print_funct_t render_filesystem_stats(struct activity *a, int isdb, char *pre,
2859                                         int curr, unsigned long long itv)
2860 {
2861         int i;
2862         struct stats_filesystem *sfc;
2863
2864         for (i = 0; i < a->nr; i++) {
2865                 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2866
2867                 if (!sfc->f_blocks)
2868                         /* Size of filesystem is zero: We are at the end of the list */
2869                         break;
2870
2871                 render(isdb, pre, PT_USERND,
2872                        "%s\tMBfsfree",
2873                        "%s",
2874                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2875                        NOVAL,
2876                        (double) sfc->f_bfree / 1024 / 1024,
2877                        NULL);
2878
2879                 render(isdb, pre, PT_USERND,
2880                        "%s\tMBfsused",
2881                        NULL,
2882                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2883                        NOVAL,
2884                        (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2885                        NULL);
2886
2887                 render(isdb, pre, PT_NOFLAG,
2888                        "%s\t%%fsused",
2889                        NULL,
2890                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2891                        NOVAL,
2892                        sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2893                                      : 0.0,
2894                        NULL);
2895
2896                 render(isdb, pre, PT_NOFLAG,
2897                        "%s\t%%ufsused",
2898                        NULL,
2899                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2900                        NOVAL,
2901                        sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2902                                      : 0.0,
2903                        NULL);
2904
2905                 render(isdb, pre, PT_USEINT,
2906                        "%s\tIfree",
2907                        NULL,
2908                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2909                        sfc->f_ffree,
2910                        NOVAL,
2911                        NULL);
2912
2913                 render(isdb, pre, PT_USEINT,
2914                        "%s\tIused",
2915                        NULL,
2916                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2917                        sfc->f_files - sfc->f_ffree,
2918                        NOVAL,
2919                        NULL);
2920
2921                 render(isdb, pre,
2922                        (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN),
2923                        "%s\t%%Iused",
2924                        NULL,
2925                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2926                        NOVAL,
2927                        sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2928                                     : 0.0,
2929                        NULL);
2930         }
2931 }
2932
2933 /*
2934  ***************************************************************************
2935  * Display Fibre Channel HBA statistics in selected format.
2936  *
2937  * IN:
2938  * @a           Activity structure with statistics.
2939  * @isdb        Flag, true if db printing, false if ppc printing.
2940  * @pre         Prefix string for output entries
2941  * @curr        Index in array for current sample statistics.
2942  * @itv         Interval of time in jiffies.
2943  ***************************************************************************
2944  */
2945 __print_funct_t render_fchost_stats(struct activity *a, int isdb, char *pre,
2946                                     int curr, unsigned long long itv)
2947 {
2948         int i;
2949         struct stats_fchost *sfcc, *sfcp;
2950
2951         for (i = 0; i < a->nr; i++) {
2952                 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2953                 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + i * a->msize);
2954
2955                 if (!sfcc->fchost_name[0])
2956                         /* We are at the end of the list */
2957                         break;
2958
2959                 render(isdb, pre, PT_NOFLAG ,
2960                        "%s\tfch_rxf/s",
2961                        "%s",
2962                        cons(sv, sfcc->fchost_name, NOVAL),
2963                        NOVAL,
2964                        S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2965                        NULL);
2966                 render(isdb, pre, PT_NOFLAG,
2967                        "%s\tfch_txf/s", NULL,
2968                        cons(sv, sfcc->fchost_name, NULL),
2969                        NOVAL,
2970                        S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2971                        NULL);
2972                 render(isdb, pre, PT_NOFLAG,
2973                        "%s\tfch_rxw/s", NULL,
2974                        cons(sv, sfcc->fchost_name, NULL),
2975                        NOVAL,
2976                        S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2977                        NULL);
2978                 render(isdb, pre,
2979                        (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN),
2980                        "%s\tfch_txw/s", NULL,
2981                        cons(sv, sfcc->fchost_name, NULL),
2982                        NOVAL,
2983                        S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv),
2984                        NULL);
2985         }
2986 }
2987
2988 /*
2989  ***************************************************************************
2990  * Display softnet statistics in selected format.
2991  *
2992  * IN:
2993  * @a           Activity structure with statistics.
2994  * @isdb        Flag, true if db printing, false if ppc printing.
2995  * @pre         Prefix string for output entries
2996  * @curr        Index in array for current sample statistics.
2997  * @itv         Interval of time in jiffies.
2998  ***************************************************************************
2999  */
3000 __print_funct_t render_softnet_stats(struct activity *a, int isdb, char *pre,
3001                                      int curr, unsigned long long itv)
3002 {
3003         int i;
3004         struct stats_softnet
3005                 *ssnc = (struct stats_softnet *) a->buf[curr],
3006                 *ssnp = (struct stats_softnet *) a->buf[!curr];
3007         int pt_newlin
3008                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
3009
3010         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
3011
3012                 /*
3013                  * The size of a->buf[...] CPU structure may be different from the default
3014                  * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
3015                  * That's why we don't use a syntax like:
3016                  * ssnc = (struct stats_softnet *) a->buf[...] + i;
3017                  */
3018                 ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
3019                 ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
3020
3021                 /*
3022                  * Note: a->nr is in [1, NR_CPUS + 1].
3023                  * Bitmap size is provided for (NR_CPUS + 1) CPUs.
3024                  * Anyway, NR_CPUS may vary between the version of sysstat
3025                  * used by sadc to create a file, and the version of sysstat
3026                  * used by sar to read it...
3027                  */
3028
3029                 /* Should current CPU (including CPU "all") be displayed? */
3030                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
3031
3032                         if (!i) {
3033                                 /* This is CPU "all" */
3034                                 render(isdb, pre, PT_NOFLAG,
3035                                        "all\ttotal/s",
3036                                        "-1", NULL,
3037                                        NOVAL,
3038                                        S_VALUE(ssnp->processed, ssnc->processed, itv),
3039                                        NULL);
3040
3041                                 render(isdb, pre, PT_NOFLAG,
3042                                        "all\tdropd/s",
3043                                        NULL, NULL,
3044                                        NOVAL,
3045                                        S_VALUE(ssnp->dropped, ssnc->dropped, itv),
3046                                        NULL);
3047
3048                                 render(isdb, pre, PT_NOFLAG,
3049                                        "all\tsqueezd/s",
3050                                        NULL, NULL,
3051                                        NOVAL,
3052                                        S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
3053                                        NULL);
3054
3055                                 render(isdb, pre, PT_NOFLAG,
3056                                        "all\trx_rps/s",
3057                                        NULL, NULL,
3058                                        NOVAL,
3059                                        S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
3060                                        NULL);
3061
3062                                 render(isdb, pre, pt_newlin,
3063                                        "all\tflw_lim/s",
3064                                        NULL, NULL,
3065                                        NOVAL,
3066                                        S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv),
3067                                        NULL);
3068                         }
3069                         else {
3070                                 render(isdb, pre, PT_NOFLAG,
3071                                        "cpu%d\ttotal/s",
3072                                        "%d", cons(iv, i - 1, NOVAL),
3073                                        NOVAL,
3074                                        S_VALUE(ssnp->processed, ssnc->processed, itv),
3075                                        NULL);
3076
3077                                 render(isdb, pre, PT_NOFLAG,
3078                                        "cpu%d\tdropd/s",
3079                                        NULL, cons(iv, i - 1, NOVAL),
3080                                        NOVAL,
3081                                        S_VALUE(ssnp->dropped, ssnc->dropped, itv),
3082                                        NULL);
3083
3084                                 render(isdb, pre, PT_NOFLAG,
3085                                        "cpu%d\tsqueezd/s",
3086                                        NULL, cons(iv, i - 1, NOVAL),
3087                                        NOVAL,
3088                                        S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),
3089                                        NULL);
3090
3091                                 render(isdb, pre, PT_NOFLAG,
3092                                        "cpu%d\trx_rps/s",
3093                                        NULL, cons(iv, i - 1, NOVAL),
3094                                        NOVAL,
3095                                        S_VALUE(ssnp->received_rps, ssnc->received_rps, itv),
3096                                        NULL);
3097
3098                                 render(isdb, pre, pt_newlin,
3099                                        "cpu%d\tflw_lim/s",
3100                                        NULL, cons(iv, i - 1, NOVAL),
3101                                        NOVAL,
3102                                        S_VALUE(ssnp->flow_limit, ssnc->flow_limit, itv),
3103                                        NULL);
3104                         }
3105                 }
3106         }
3107 }