]> granicus.if.org Git - sysstat/blob - rndr_stats.c
SVG: Fix how bar graphs are displayed for fs statistics
[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         render(isdb, pre, PT_NOFLAG,
687                "-\ttps", NULL, NULL,
688                NOVAL,
689                S_VALUE(sip->dk_drive, sic->dk_drive, itv),
690                NULL);
691
692         render(isdb, pre, PT_NOFLAG,
693                "-\trtps", NULL, NULL,
694                NOVAL,
695                S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
696                NULL);
697
698         render(isdb, pre, PT_NOFLAG,
699                "-\twtps", NULL, NULL,
700                NOVAL,
701                S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
702                NULL);
703
704         render(isdb, pre, PT_NOFLAG,
705                "-\tbread/s", NULL, NULL,
706                NOVAL,
707                S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv),
708                NULL);
709
710         render(isdb, pre, pt_newlin,
711                "-\tbwrtn/s", NULL, NULL,
712                NOVAL,
713                S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv),
714                NULL);
715 }
716
717 /*
718  ***************************************************************************
719  * Display memory and swap statistics in selected format.
720  *
721  * IN:
722  * @a           Activity structure with statistics.
723  * @isdb        Flag, true if db printing, false if ppc printing.
724  * @pre         Prefix string for output entries
725  * @curr        Index in array for current sample statistics.
726  * @itv         Interval of time in jiffies.
727  ***************************************************************************
728  */
729 __print_funct_t render_memory_stats(struct activity *a, int isdb, char *pre,
730                                     int curr, unsigned long long itv)
731 {
732         struct stats_memory
733                 *smc = (struct stats_memory *) a->buf[curr],
734                 *smp = (struct stats_memory *) a->buf[!curr];
735         int pt_newlin
736                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
737         int ptn;
738
739         if (DISPLAY_MEMORY(a->opt_flags)) {
740
741                 render(isdb, pre, PT_NOFLAG,
742                        "-\tfrmpg/s", NULL, NULL,
743                        NOVAL,
744                        S_VALUE((double) KB_TO_PG(smp->frmkb),
745                                (double) KB_TO_PG(smc->frmkb), itv),
746                        NULL);
747
748                 render(isdb, pre, PT_NOFLAG,
749                        "-\tbufpg/s", NULL, NULL,
750                        NOVAL,
751                        S_VALUE((double) KB_TO_PG(smp->bufkb),
752                                (double) KB_TO_PG(smc->bufkb), itv),
753                        NULL);
754
755                 render(isdb, pre, pt_newlin,
756                        "-\tcampg/s", NULL, NULL,
757                        NOVAL,
758                        S_VALUE((double) KB_TO_PG(smp->camkb),
759                                (double) KB_TO_PG(smc->camkb), itv),
760                        NULL);
761         }
762
763         if (DISPLAY_MEM_AMT(a->opt_flags)) {
764
765                 render(isdb, pre, PT_USEINT,
766                        "-\tkbmemfree", NULL, NULL,
767                        smc->frmkb, DNOVAL, NULL);
768
769                 render(isdb, pre, PT_USEINT,
770                        "-\tkbmemused", NULL, NULL,
771                        smc->tlmkb - smc->frmkb, DNOVAL, NULL);
772
773                 render(isdb, pre, PT_NOFLAG,
774                        "-\t%%memused", NULL, NULL, NOVAL,
775                        smc->tlmkb ?
776                        SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) :
777                        0.0, NULL);
778
779                 render(isdb, pre, PT_USEINT,
780                        "-\tkbbuffers", NULL, NULL,
781                        smc->bufkb, DNOVAL, NULL);
782
783                 render(isdb, pre, PT_USEINT,
784                        "-\tkbcached", NULL, NULL,
785                        smc->camkb, DNOVAL, NULL);
786
787                 render(isdb, pre, PT_USEINT,
788                        "-\tkbcommit", NULL, NULL,
789                        smc->comkb, DNOVAL, NULL);
790
791                 render(isdb, pre, PT_NOFLAG,
792                        "-\t%%commit", NULL, NULL, NOVAL,
793                        (smc->tlmkb + smc->tlskb) ?
794                        SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
795                        0.0, NULL);
796
797                 render(isdb, pre, PT_USEINT,
798                        "-\tkbactive", NULL, NULL,
799                        smc->activekb, DNOVAL, NULL);
800
801                 render(isdb, pre, PT_USEINT,
802                        "-\tkbinact", NULL, NULL,
803                        smc->inactkb, DNOVAL, NULL);
804
805                 ptn = DISPLAY_MEM_ALL(a->opt_flags) ? 0 : pt_newlin;
806                 render(isdb, pre, PT_USEINT | ptn,
807                        "-\tkbdirty", NULL, NULL,
808                        smc->dirtykb, DNOVAL, NULL);
809
810                 if (DISPLAY_MEM_ALL(a->opt_flags)) {
811                         render(isdb, pre, PT_USEINT,
812                                "-\tkbanonpg", NULL, NULL,
813                                smc->anonpgkb, DNOVAL, NULL);
814
815                         render(isdb, pre, PT_USEINT,
816                                "-\tkbslab", NULL, NULL,
817                                smc->slabkb, DNOVAL, NULL);
818
819                         render(isdb, pre, PT_USEINT,
820                                "-\tkbkstack", NULL, NULL,
821                                smc->kstackkb, DNOVAL, NULL);
822
823                         render(isdb, pre, PT_USEINT,
824                                "-\tkbpgtbl", NULL, NULL,
825                                smc->pgtblkb, DNOVAL, NULL);
826
827                         render(isdb, pre, PT_USEINT | pt_newlin,
828                                "-\tkbvmused", NULL, NULL,
829                                smc->vmusedkb, DNOVAL, NULL);
830                 }
831         }
832
833         if (DISPLAY_SWAP(a->opt_flags)) {
834
835                 render(isdb, pre, PT_USEINT,
836                        "-\tkbswpfree", NULL, NULL,
837                        smc->frskb, DNOVAL, NULL);
838
839                 render(isdb, pre, PT_USEINT,
840                        "-\tkbswpused", NULL, NULL,
841                        smc->tlskb - smc->frskb, DNOVAL, NULL);
842
843                 render(isdb, pre, PT_NOFLAG,
844                        "-\t%%swpused", NULL, NULL, NOVAL,
845                        smc->tlskb ?
846                        SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
847                        0.0, NULL);
848
849                 render(isdb, pre, PT_USEINT,
850                        "-\tkbswpcad", NULL, NULL,
851                        smc->caskb, DNOVAL, NULL);
852
853                 render(isdb, pre, pt_newlin,
854                        "-\t%%swpcad", NULL, NULL, NOVAL,
855                        (smc->tlskb - smc->frskb) ?
856                        SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
857                        0.0, NULL);
858         }
859 }
860
861 /*
862  ***************************************************************************
863  * Display kernel tables statistics in selected format.
864  *
865  * IN:
866  * @a           Activity structure with statistics.
867  * @isdb        Flag, true if db printing, false if ppc printing.
868  * @pre         Prefix string for output entries
869  * @curr        Index in array for current sample statistics.
870  * @itv         Interval of time in jiffies.
871  ***************************************************************************
872  */
873 __print_funct_t render_ktables_stats(struct activity *a, int isdb, char *pre,
874                                      int curr, unsigned long long itv)
875 {
876         struct stats_ktables
877                 *skc = (struct stats_ktables *) a->buf[curr];
878         int pt_newlin
879                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
880
881         render(isdb, pre, PT_USEINT,
882                "-\tdentunusd", NULL, NULL,
883                skc->dentry_stat, DNOVAL, NULL);
884
885         render(isdb, pre, PT_USEINT,
886                "-\tfile-nr", NULL, NULL,
887                skc->file_used, DNOVAL, NULL);
888
889         render(isdb, pre, PT_USEINT,
890                "-\tinode-nr", NULL, NULL,
891                skc->inode_used, DNOVAL, NULL);
892
893         render(isdb, pre, PT_USEINT | pt_newlin,
894                "-\tpty-nr", NULL, NULL,
895                skc->pty_nr, DNOVAL, NULL);
896 }
897
898 /*
899  ***************************************************************************
900  * Display queue and load statistics in selected format.
901  *
902  * IN:
903  * @a           Activity structure with statistics.
904  * @isdb        Flag, true if db printing, false if ppc printing.
905  * @pre         Prefix string for output entries
906  * @curr        Index in array for current sample statistics.
907  * @itv         Interval of time in jiffies.
908  ***************************************************************************
909  */
910 __print_funct_t render_queue_stats(struct activity *a, int isdb, char *pre,
911                                    int curr, unsigned long long itv)
912 {
913         struct stats_queue
914                 *sqc = (struct stats_queue *) a->buf[curr];
915         int pt_newlin
916                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
917
918         render(isdb, pre, PT_USEINT,
919                "-\trunq-sz", NULL, NULL,
920                sqc->nr_running, DNOVAL, NULL);
921
922         render(isdb, pre, PT_USEINT,
923                "-\tplist-sz", NULL, NULL,
924                sqc->nr_threads, DNOVAL, NULL);
925
926         render(isdb, pre, PT_NOFLAG,
927                "-\tldavg-1", NULL, NULL,
928                NOVAL,
929                (double) sqc->load_avg_1 / 100,
930                NULL);
931
932         render(isdb, pre, PT_NOFLAG,
933                "-\tldavg-5", NULL, NULL,
934                NOVAL,
935                (double) sqc->load_avg_5 / 100,
936                NULL);
937
938         render(isdb, pre, PT_NOFLAG,
939                "-\tldavg-15", NULL, NULL,
940                NOVAL,
941                (double) sqc->load_avg_15 / 100,
942                NULL);
943
944         render(isdb, pre, PT_USEINT | pt_newlin,
945                "-\tblocked", NULL, NULL,
946                sqc->procs_blocked, DNOVAL, NULL);
947 }
948
949 /*
950  ***************************************************************************
951  * Display serial lines statistics in selected format.
952  *
953  * IN:
954  * @a           Activity structure with statistics.
955  * @isdb        Flag, true if db printing, false if ppc printing.
956  * @pre         Prefix string for output entries
957  * @curr        Index in array for current sample statistics.
958  * @itv         Interval of time in jiffies.
959  ***************************************************************************
960  */
961 __print_funct_t render_serial_stats(struct activity *a, int isdb, char *pre,
962                                     int curr, unsigned long long itv)
963 {
964         int i;
965         struct stats_serial *ssc, *ssp;
966         int pt_newlin
967                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
968
969         for (i = 0; i < a->nr; i++) {
970
971                 ssc = (struct stats_serial *) ((char *) a->buf[curr]  + i * a->msize);
972                 ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
973
974                 if (ssc->line == 0)
975                         continue;
976
977                 if (ssc->line == ssp->line) {
978                         render(isdb, pre, PT_NOFLAG,
979                                "ttyS%d\trcvin/s", "%d",
980                                cons(iv, ssc->line - 1, NOVAL),
981                                NOVAL,
982                                S_VALUE(ssp->rx, ssc->rx, itv),
983                                NULL);
984
985                         render(isdb, pre, PT_NOFLAG,
986                                "ttyS%d\txmtin/s", "%d",
987                                cons(iv, ssc->line - 1, NOVAL),
988                                NOVAL,
989                                S_VALUE(ssp->tx, ssc->tx, itv),
990                                NULL);
991
992                         render(isdb, pre, PT_NOFLAG,
993                                "ttyS%d\tframerr/s", "%d",
994                                cons(iv, ssc->line - 1, NOVAL),
995                                NOVAL,
996                                S_VALUE(ssp->frame, ssc->frame, itv),
997                                NULL);
998
999                         render(isdb, pre, PT_NOFLAG,
1000                                "ttyS%d\tprtyerr/s", "%d",
1001                                cons(iv, ssc->line - 1, NOVAL),
1002                                NOVAL,
1003                                S_VALUE(ssp->parity, ssc->parity, itv),
1004                                NULL);
1005
1006                         render(isdb, pre, PT_NOFLAG,
1007                                "ttyS%d\tbrk/s", "%d",
1008                                cons(iv, ssc->line - 1, NOVAL),
1009                                NOVAL,
1010                                S_VALUE(ssp->brk, ssc->brk, itv),
1011                                NULL);
1012
1013                         render(isdb, pre, pt_newlin,
1014                                "ttyS%d\tovrun/s", "%d",
1015                                cons(iv, ssc->line - 1, NOVAL),
1016                                NOVAL,
1017                                S_VALUE(ssp->overrun, ssc->overrun, itv),
1018                                NULL);
1019                 }
1020         }
1021 }
1022
1023 /*
1024  ***************************************************************************
1025  * Display disks statistics in selected format.
1026  *
1027  * IN:
1028  * @a           Activity structure with statistics.
1029  * @isdb        Flag, true if db printing, false if ppc printing.
1030  * @pre         Prefix string for output entries
1031  * @curr        Index in array for current sample statistics.
1032  * @itv         Interval of time in jiffies.
1033  ***************************************************************************
1034  */
1035 __print_funct_t render_disk_stats(struct activity *a, int isdb, char *pre,
1036                                   int curr, unsigned long long itv)
1037 {
1038         int i, j;
1039         struct stats_disk *sdc, *sdp;
1040         struct ext_disk_stats xds;
1041         char *dev_name, *persist_dev_name;
1042         int pt_newlin
1043                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1044
1045         for (i = 0; i < a->nr; i++) {
1046
1047                 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
1048
1049                 if (!(sdc->major + sdc->minor))
1050                         continue;
1051
1052                 j = check_disk_reg(a, curr, !curr, i);
1053                 sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
1054
1055                 /* Compute extended stats (service time, etc.) */
1056                 compute_ext_disk_stats(sdc, sdp, itv, &xds);
1057
1058                 dev_name = NULL;
1059                 persist_dev_name = NULL;
1060
1061                 if (DISPLAY_PERSIST_NAME_S(flags)) {
1062                         persist_dev_name = get_persistent_name_from_pretty(get_devname(sdc->major, sdc->minor, TRUE));
1063                 }
1064
1065                 if (persist_dev_name) {
1066                         dev_name = persist_dev_name;
1067                 }
1068                 else {
1069                         if ((USE_PRETTY_OPTION(flags)) && (sdc->major == dm_major)) {
1070                                 dev_name = transform_devmapname(sdc->major, sdc->minor);
1071                         }
1072
1073                         if (!dev_name) {
1074                                 dev_name = get_devname(sdc->major, sdc->minor,
1075                                                        USE_PRETTY_OPTION(flags));
1076                         }
1077                 }
1078
1079                 render(isdb, pre, PT_NOFLAG,
1080                        "%s\ttps", "%s",
1081                        cons(sv, dev_name, NULL),
1082                        NOVAL,
1083                        S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
1084                        NULL);
1085
1086                 render(isdb, pre, PT_NOFLAG,
1087                        "%s\trd_sec/s", NULL,
1088                        cons(sv, dev_name, NULL),
1089                        NOVAL,
1090                        S_VALUE(sdp->rd_sect, sdc->rd_sect, itv),
1091                        NULL);
1092
1093                 render(isdb, pre, PT_NOFLAG,
1094                        "%s\twr_sec/s", NULL,
1095                        cons(sv, dev_name, NULL),
1096                        NOVAL,
1097                        S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
1098                        NULL);
1099
1100                 render(isdb, pre, PT_NOFLAG,
1101                        "%s\tavgrq-sz", NULL,
1102                        cons(sv, dev_name, NULL),
1103                        NOVAL,
1104                        xds.arqsz,
1105                        NULL);
1106
1107                 render(isdb, pre, PT_NOFLAG,
1108                        "%s\tavgqu-sz", NULL,
1109                        cons(sv, dev_name, NULL),
1110                        NOVAL,
1111                        S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
1112                        NULL);
1113
1114                 render(isdb, pre, PT_NOFLAG,
1115                        "%s\tawait", NULL,
1116                        cons(sv, dev_name, NULL),
1117                        NOVAL,
1118                        xds.await,
1119                        NULL);
1120
1121                 render(isdb, pre, PT_NOFLAG,
1122                        "%s\tsvctm", NULL,
1123                        cons(sv, dev_name, NULL),
1124                        NOVAL,
1125                        xds.svctm,
1126                        NULL);
1127
1128                 render(isdb, pre, pt_newlin,
1129                        "%s\t%%util", NULL,
1130                        cons(sv, dev_name, NULL),
1131                        NOVAL,
1132                        xds.util / 10.0,
1133                        NULL);
1134         }
1135 }
1136
1137 /*
1138  ***************************************************************************
1139  * Display network interfaces statistics in selected format.
1140  *
1141  * IN:
1142  * @a           Activity structure with statistics.
1143  * @isdb        Flag, true if db printing, false if ppc printing.
1144  * @pre         Prefix string for output entries
1145  * @curr        Index in array for current sample statistics.
1146  * @itv         Interval of time in jiffies.
1147  ***************************************************************************
1148  */
1149 __print_funct_t render_net_dev_stats(struct activity *a, int isdb, char *pre,
1150                                      int curr, unsigned long long itv)
1151 {
1152         int i, j;
1153         struct stats_net_dev *sndc, *sndp;
1154         double rxkb, txkb, ifutil;
1155         int pt_newlin
1156                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1157
1158         for (i = 0; i < a->nr; i++) {
1159
1160                 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
1161
1162                 if (!strcmp(sndc->interface, ""))
1163                         continue;
1164
1165                 j = check_net_dev_reg(a, curr, !curr, i);
1166                 sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
1167
1168                 render(isdb, pre, PT_NOFLAG,
1169                        "%s\trxpck/s", "%s",
1170                        cons(sv, sndc->interface, NULL), /* What if the format args are strings? */
1171                        NOVAL,
1172                        S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
1173                        NULL);
1174
1175                 render(isdb, pre, PT_NOFLAG,
1176                        "%s\ttxpck/s", NULL,
1177                        cons(sv, sndc->interface, NULL),
1178                        NOVAL,
1179                        S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
1180                        NULL);
1181
1182                 rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
1183                 render(isdb, pre, PT_NOFLAG,
1184                        "%s\trxkB/s", NULL,
1185                        cons(sv, sndc->interface, NULL),
1186                        NOVAL,
1187                        rxkb / 1024,
1188                        NULL);
1189
1190                 txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
1191                 render(isdb, pre, PT_NOFLAG,
1192                        "%s\ttxkB/s", NULL,
1193                        cons(sv, sndc->interface, NULL),
1194                        NOVAL,
1195                        txkb / 1024,
1196                        NULL);
1197
1198                 render(isdb, pre, PT_NOFLAG,
1199                        "%s\trxcmp/s", NULL,
1200                        cons(sv, sndc->interface, NULL),
1201                        NOVAL,
1202                        S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
1203                        NULL);
1204
1205                 render(isdb, pre, PT_NOFLAG,
1206                        "%s\ttxcmp/s", NULL,
1207                        cons(sv, sndc->interface, NULL),
1208                        NOVAL,
1209                        S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
1210                        NULL);
1211
1212                 render(isdb, pre, PT_NOFLAG,
1213                        "%s\trxmcst/s", NULL,
1214                        cons(sv, sndc->interface, NULL),
1215                        NOVAL,
1216                        S_VALUE(sndp->multicast, sndc->multicast, itv),
1217                        NULL);
1218
1219                 ifutil = compute_ifutil(sndc, rxkb, txkb);
1220                 render(isdb, pre, pt_newlin,
1221                        "%s\t%%ifutil", NULL,
1222                        cons(sv, sndc->interface, NULL),
1223                        NOVAL,
1224                        ifutil,
1225                        NULL);
1226         }
1227 }
1228
1229 /*
1230  ***************************************************************************
1231  * Display network interface errors statistics in selected format.
1232  *
1233  * IN:
1234  * @a           Activity structure with statistics.
1235  * @isdb        Flag, true if db printing, false if ppc printing.
1236  * @pre         Prefix string for output entries
1237  * @curr        Index in array for current sample statistics.
1238  * @itv         Interval of time in jiffies.
1239  ***************************************************************************
1240  */
1241 __print_funct_t render_net_edev_stats(struct activity *a, int isdb, char *pre,
1242                                       int curr, unsigned long long itv)
1243 {
1244         int i, j;
1245         struct stats_net_edev *snedc, *snedp;
1246         int pt_newlin
1247                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1248
1249         for (i = 0; i < a->nr; i++) {
1250
1251                 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
1252
1253                 if (!strcmp(snedc->interface, ""))
1254                         continue;
1255
1256                 j = check_net_edev_reg(a, curr, !curr, i);
1257                 snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
1258
1259                 render(isdb, pre, PT_NOFLAG,
1260                        "%s\trxerr/s", "%s",
1261                        cons(sv, snedc->interface, NULL),
1262                        NOVAL,
1263                        S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
1264                        NULL);
1265
1266                 render(isdb, pre, PT_NOFLAG,
1267                        "%s\ttxerr/s", NULL,
1268                        cons(sv, snedc->interface, NULL),
1269                        NOVAL,
1270                        S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
1271                        NULL);
1272
1273                 render(isdb, pre, PT_NOFLAG,
1274                        "%s\tcoll/s", NULL,
1275                        cons(sv, snedc->interface, NULL),
1276                        NOVAL,
1277                        S_VALUE(snedp->collisions, snedc->collisions, itv),
1278                        NULL);
1279
1280                 render(isdb, pre, PT_NOFLAG,
1281                        "%s\trxdrop/s", NULL,
1282                        cons(sv, snedc->interface, NULL),
1283                        NOVAL,
1284                        S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv),
1285                        NULL);
1286
1287                 render(isdb, pre, PT_NOFLAG,
1288                        "%s\ttxdrop/s", NULL,
1289                        cons(sv, snedc->interface, NULL),
1290                        NOVAL,
1291                        S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv),
1292                        NULL);
1293
1294                 render(isdb, pre, PT_NOFLAG,
1295                        "%s\ttxcarr/s", NULL,
1296                        cons(sv, snedc->interface, NULL),
1297                        NOVAL,
1298                        S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
1299                        NULL);
1300
1301                 render(isdb, pre, PT_NOFLAG,
1302                        "%s\trxfram/s", NULL,
1303                        cons(sv, snedc->interface, NULL),
1304                        NOVAL,
1305                        S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv),
1306                        NULL);
1307
1308                 render(isdb, pre, PT_NOFLAG,
1309                        "%s\trxfifo/s", NULL,
1310                        cons(sv, snedc->interface, NULL),
1311                        NOVAL,
1312                        S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv),
1313                        NULL);
1314
1315                 render(isdb, pre, pt_newlin,
1316                        "%s\ttxfifo/s", NULL,
1317                        cons(sv, snedc->interface, NULL),
1318                        NOVAL,
1319                        S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv),
1320                        NULL);
1321         }
1322 }
1323
1324 /*
1325  ***************************************************************************
1326  * Display NFS client statistics in selected format.
1327  *
1328  * IN:
1329  * @a           Activity structure with statistics.
1330  * @isdb        Flag, true if db printing, false if ppc printing.
1331  * @pre         Prefix string for output entries
1332  * @curr        Index in array for current sample statistics.
1333  * @itv         Interval of time in jiffies.
1334  ***************************************************************************
1335  */
1336 __print_funct_t render_net_nfs_stats(struct activity *a, int isdb, char *pre,
1337                                      int curr, unsigned long long itv)
1338 {
1339         struct stats_net_nfs
1340                 *snnc = (struct stats_net_nfs *) a->buf[curr],
1341                 *snnp = (struct stats_net_nfs *) a->buf[!curr];
1342         int pt_newlin
1343                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1344
1345         render(isdb, pre, PT_NOFLAG,
1346                "-\tcall/s", NULL, NULL,
1347                NOVAL,
1348                S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
1349                NULL);
1350
1351         render(isdb, pre, PT_NOFLAG,
1352                "-\tretrans/s", NULL, NULL,
1353                NOVAL,
1354                S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
1355                NULL);
1356
1357         render(isdb, pre, PT_NOFLAG,
1358                "-\tread/s", NULL, NULL,
1359                NOVAL,
1360                S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
1361                NULL);
1362
1363         render(isdb, pre, PT_NOFLAG,
1364                "-\twrite/s", NULL, NULL,
1365                NOVAL,
1366                S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
1367                NULL);
1368
1369         render(isdb, pre, PT_NOFLAG,
1370                "-\taccess/s", NULL, NULL,
1371                NOVAL,
1372                S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
1373                NULL);
1374
1375         render(isdb, pre, pt_newlin,
1376                "-\tgetatt/s", NULL, NULL,
1377                NOVAL,
1378                S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv),
1379                NULL);
1380 }
1381
1382 /*
1383  ***************************************************************************
1384  * Display NFS server statistics in selected format.
1385  *
1386  * IN:
1387  * @a           Activity structure with statistics.
1388  * @isdb        Flag, true if db printing, false if ppc printing.
1389  * @pre         Prefix string for output entries
1390  * @curr        Index in array for current sample statistics.
1391  * @itv         Interval of time in jiffies.
1392  ***************************************************************************
1393  */
1394 __print_funct_t render_net_nfsd_stats(struct activity *a, int isdb, char *pre,
1395                                       int curr, unsigned long long itv)
1396 {
1397         struct stats_net_nfsd
1398                 *snndc = (struct stats_net_nfsd *) a->buf[curr],
1399                 *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1400         int pt_newlin
1401                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1402
1403         render(isdb, pre, PT_NOFLAG,
1404                "-\tscall/s", NULL, NULL,
1405                NOVAL,
1406                S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
1407                NULL);
1408
1409         render(isdb, pre, PT_NOFLAG,
1410                "-\tbadcall/s", NULL, NULL,
1411                NOVAL,
1412                S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
1413                NULL);
1414
1415         render(isdb, pre, PT_NOFLAG,
1416                "-\tpacket/s", NULL, NULL,
1417                NOVAL,
1418                S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
1419                NULL);
1420
1421         render(isdb, pre, PT_NOFLAG,
1422                "-\tudp/s", NULL, NULL,
1423                NOVAL,
1424                S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1425                NULL);
1426
1427         render(isdb, pre, PT_NOFLAG,
1428                "-\ttcp/s", NULL, NULL,
1429                NOVAL,
1430                S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1431                NULL);
1432
1433         render(isdb, pre, PT_NOFLAG,
1434                "-\thit/s", NULL, NULL,
1435                NOVAL,
1436                S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv),
1437                NULL);
1438
1439         render(isdb, pre, PT_NOFLAG,
1440                "-\tmiss/s", NULL, NULL,
1441                NOVAL,
1442                S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv),
1443                NULL);
1444
1445         render(isdb, pre, PT_NOFLAG,
1446                "-\tsread/s", NULL, NULL,
1447                NOVAL,
1448                S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv),
1449                NULL);
1450
1451         render(isdb, pre, PT_NOFLAG,
1452                "-\tswrite/s", NULL, NULL,
1453                NOVAL,
1454                S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv),
1455                NULL);
1456
1457         render(isdb, pre, PT_NOFLAG,
1458                "-\tsaccess/s", NULL, NULL,
1459                NOVAL,
1460                S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1461                NULL);
1462
1463         render(isdb, pre, pt_newlin,
1464                "-\tsgetatt/s", NULL, NULL,
1465                NOVAL,
1466                S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv),
1467                NULL);
1468 }
1469
1470 /*
1471  ***************************************************************************
1472  * Display network sockets statistics in selected format.
1473  *
1474  * IN:
1475  * @a           Activity structure with statistics.
1476  * @isdb        Flag, true if db printing, false if ppc printing.
1477  * @pre         Prefix string for output entries
1478  * @curr        Index in array for current sample statistics.
1479  * @itv         Interval of time in jiffies.
1480  ***************************************************************************
1481  */
1482 __print_funct_t render_net_sock_stats(struct activity *a, int isdb, char *pre,
1483                                       int curr, unsigned long long itv)
1484 {
1485         struct stats_net_sock
1486                 *snsc = (struct stats_net_sock *) a->buf[curr];
1487         int pt_newlin
1488                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1489
1490         render(isdb, pre, PT_USEINT,
1491                "-\ttotsck", NULL, NULL,
1492                snsc->sock_inuse, DNOVAL, NULL);
1493
1494         render(isdb, pre, PT_USEINT,
1495                "-\ttcpsck", NULL, NULL,
1496                snsc->tcp_inuse, DNOVAL, NULL);
1497
1498         render(isdb, pre, PT_USEINT,
1499                "-\tudpsck",  NULL, NULL,
1500                snsc->udp_inuse, DNOVAL, NULL);
1501
1502         render(isdb, pre, PT_USEINT,
1503                "-\trawsck", NULL, NULL,
1504                snsc->raw_inuse, DNOVAL, NULL);
1505
1506         render(isdb, pre, PT_USEINT,
1507                "-\tip-frag", NULL, NULL,
1508                snsc->frag_inuse, DNOVAL, NULL);
1509
1510         render(isdb, pre, PT_USEINT | pt_newlin,
1511                "-\ttcp-tw", NULL, NULL,
1512                snsc->tcp_tw, DNOVAL, NULL);
1513 }
1514
1515 /*
1516  ***************************************************************************
1517  * Display IP network statistics in selected format.
1518  *
1519  * IN:
1520  * @a           Activity structure with statistics.
1521  * @isdb        Flag, true if db printing, false if ppc printing.
1522  * @pre         Prefix string for output entries
1523  * @curr        Index in array for current sample statistics.
1524  * @itv         Interval of time in jiffies.
1525  ***************************************************************************
1526  */
1527 __print_funct_t render_net_ip_stats(struct activity *a, int isdb, char *pre,
1528                                     int curr, unsigned long long itv)
1529 {
1530         struct stats_net_ip
1531                 *snic = (struct stats_net_ip *) a->buf[curr],
1532                 *snip = (struct stats_net_ip *) a->buf[!curr];
1533         int pt_newlin
1534                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1535
1536         render(isdb, pre, PT_NOFLAG,
1537                "-\tirec/s", NULL, NULL,
1538                NOVAL,
1539                S_VALUE(snip->InReceives, snic->InReceives, itv),
1540                NULL);
1541
1542         render(isdb, pre, PT_NOFLAG,
1543                "-\tfwddgm/s", NULL, NULL,
1544                NOVAL,
1545                S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1546                NULL);
1547
1548         render(isdb, pre, PT_NOFLAG,
1549                "-\tidel/s", NULL, NULL,
1550                NOVAL,
1551                S_VALUE(snip->InDelivers, snic->InDelivers, itv),
1552                NULL);
1553
1554         render(isdb, pre, PT_NOFLAG,
1555                "-\torq/s", NULL, NULL,
1556                NOVAL,
1557                S_VALUE(snip->OutRequests, snic->OutRequests, itv),
1558                NULL);
1559
1560         render(isdb, pre, PT_NOFLAG,
1561                "-\tasmrq/s", NULL, NULL,
1562                NOVAL,
1563                S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv),
1564                NULL);
1565
1566         render(isdb, pre, PT_NOFLAG,
1567                "-\tasmok/s", NULL, NULL,
1568                NOVAL,
1569                S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv),
1570                NULL);
1571
1572         render(isdb, pre, PT_NOFLAG,
1573                "-\tfragok/s", NULL, NULL,
1574                NOVAL,
1575                S_VALUE(snip->FragOKs, snic->FragOKs, itv),
1576                NULL);
1577
1578         render(isdb, pre, pt_newlin,
1579                "-\tfragcrt/s", NULL, NULL,
1580                NOVAL,
1581                S_VALUE(snip->FragCreates, snic->FragCreates, itv),
1582                NULL);
1583 }
1584
1585 /*
1586  ***************************************************************************
1587  * Display IP network errors statistics in selected format.
1588  *
1589  * IN:
1590  * @a           Activity structure with statistics.
1591  * @isdb        Flag, true if db printing, false if ppc printing.
1592  * @pre         Prefix string for output entries
1593  * @curr        Index in array for current sample statistics.
1594  * @itv         Interval of time in jiffies.
1595  ***************************************************************************
1596  */
1597 __print_funct_t render_net_eip_stats(struct activity *a, int isdb, char *pre,
1598                                      int curr, unsigned long long itv)
1599 {
1600         struct stats_net_eip
1601                 *sneic = (struct stats_net_eip *) a->buf[curr],
1602                 *sneip = (struct stats_net_eip *) a->buf[!curr];
1603         int pt_newlin
1604                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1605
1606         render(isdb, pre, PT_NOFLAG,
1607                "-\tihdrerr/s", NULL, NULL,
1608                NOVAL,
1609                S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
1610                NULL);
1611
1612         render(isdb, pre, PT_NOFLAG,
1613                "-\tiadrerr/s", NULL, NULL,
1614                NOVAL,
1615                S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
1616                NULL);
1617
1618         render(isdb, pre, PT_NOFLAG,
1619                "-\tiukwnpr/s", NULL, NULL,
1620                NOVAL,
1621                S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1622                NULL);
1623
1624         render(isdb, pre, PT_NOFLAG,
1625                "-\tidisc/s", NULL, NULL,
1626                NOVAL,
1627                S_VALUE(sneip->InDiscards, sneic->InDiscards, itv),
1628                NULL);
1629
1630         render(isdb, pre, PT_NOFLAG,
1631                "-\todisc/s", NULL, NULL,
1632                NOVAL,
1633                S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv),
1634                NULL);
1635
1636         render(isdb, pre, PT_NOFLAG,
1637                "-\tonort/s", NULL, NULL,
1638                NOVAL,
1639                S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv),
1640                NULL);
1641
1642         render(isdb, pre, PT_NOFLAG,
1643                "-\tasmf/s", NULL, NULL,
1644                NOVAL,
1645                S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv),
1646                NULL);
1647
1648         render(isdb, pre, pt_newlin,
1649                "-\tfragf/s", NULL, NULL,
1650                NOVAL,
1651                S_VALUE(sneip->FragFails, sneic->FragFails, itv),
1652                NULL);
1653 }
1654
1655 /*
1656  ***************************************************************************
1657  * Display ICMP network statistics in selected format.
1658  *
1659  * IN:
1660  * @a           Activity structure with statistics.
1661  * @isdb        Flag, true if db printing, false if ppc printing.
1662  * @pre         Prefix string for output entries
1663  * @curr        Index in array for current sample statistics.
1664  * @itv         Interval of time in jiffies.
1665  ***************************************************************************
1666  */
1667 __print_funct_t render_net_icmp_stats(struct activity *a, int isdb, char *pre,
1668                                       int curr, unsigned long long itv)
1669 {
1670         struct stats_net_icmp
1671                 *snic = (struct stats_net_icmp *) a->buf[curr],
1672                 *snip = (struct stats_net_icmp *) a->buf[!curr];
1673         int pt_newlin
1674                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1675
1676         render(isdb, pre, PT_NOFLAG,
1677                "-\timsg/s", NULL, NULL,
1678                NOVAL,
1679                S_VALUE(snip->InMsgs, snic->InMsgs, itv),
1680                NULL);
1681
1682         render(isdb, pre, PT_NOFLAG,
1683                "-\tomsg/s", NULL, NULL,
1684                NOVAL,
1685                S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
1686                NULL);
1687
1688         render(isdb, pre, PT_NOFLAG,
1689                "-\tiech/s", NULL, NULL,
1690                NOVAL,
1691                S_VALUE(snip->InEchos, snic->InEchos, itv),
1692                NULL);
1693
1694         render(isdb, pre, PT_NOFLAG,
1695                "-\tiechr/s", NULL, NULL,
1696                NOVAL,
1697                S_VALUE(snip->InEchoReps, snic->InEchoReps, itv),
1698                NULL);
1699
1700         render(isdb, pre, PT_NOFLAG,
1701                "-\toech/s", NULL, NULL,
1702                NOVAL,
1703                S_VALUE(snip->OutEchos, snic->OutEchos, itv),
1704                NULL);
1705
1706         render(isdb, pre, PT_NOFLAG,
1707                "-\toechr/s", NULL, NULL,
1708                NOVAL,
1709                S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv),
1710                NULL);
1711
1712         render(isdb, pre, PT_NOFLAG,
1713                "-\titm/s", NULL, NULL,
1714                NOVAL,
1715                S_VALUE(snip->InTimestamps, snic->InTimestamps, itv),
1716                NULL);
1717
1718         render(isdb, pre, PT_NOFLAG,
1719                "-\titmr/s", NULL, NULL,
1720                NOVAL,
1721                S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv),
1722                NULL);
1723
1724         render(isdb, pre, PT_NOFLAG,
1725                "-\totm/s", NULL, NULL,
1726                NOVAL,
1727                S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv),
1728                NULL);
1729
1730         render(isdb, pre, PT_NOFLAG,
1731                "-\totmr/s", NULL, NULL,
1732                NOVAL,
1733                S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1734                NULL);
1735
1736         render(isdb, pre, PT_NOFLAG,
1737                "-\tiadrmk/s", NULL, NULL,
1738                NOVAL,
1739                S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv),
1740                NULL);
1741
1742         render(isdb, pre, PT_NOFLAG,
1743                "-\tiadrmkr/s", NULL, NULL,
1744                NOVAL,
1745                S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv),
1746                NULL);
1747
1748         render(isdb, pre, PT_NOFLAG,
1749                "-\toadrmk/s", NULL, NULL,
1750                NOVAL,
1751                S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv),
1752                NULL);
1753
1754         render(isdb, pre, pt_newlin,
1755                "-\toadrmkr/s", NULL, NULL,
1756                NOVAL,
1757                S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv),
1758                NULL);
1759 }
1760
1761 /*
1762  ***************************************************************************
1763  * Display ICMP error messages statistics in selected format.
1764  *
1765  * IN:
1766  * @a           Activity structure with statistics.
1767  * @isdb        Flag, true if db printing, false if ppc printing.
1768  * @pre         Prefix string for output entries
1769  * @curr        Index in array for current sample statistics.
1770  * @itv         Interval of time in jiffies.
1771  ***************************************************************************
1772  */
1773 __print_funct_t render_net_eicmp_stats(struct activity *a, int isdb, char *pre,
1774                                        int curr, unsigned long long itv)
1775 {
1776         struct stats_net_eicmp
1777                 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1778                 *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1779         int pt_newlin
1780                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1781
1782         render(isdb, pre, PT_NOFLAG,
1783                "-\tierr/s", NULL, NULL,
1784                NOVAL,
1785                S_VALUE(sneip->InErrors, sneic->InErrors, itv),
1786                NULL);
1787
1788         render(isdb, pre, PT_NOFLAG,
1789                "-\toerr/s", NULL, NULL,
1790                NOVAL,
1791                S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
1792                NULL);
1793
1794         render(isdb, pre, PT_NOFLAG,
1795                "-\tidstunr/s", NULL, NULL,
1796                NOVAL,
1797                S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
1798                NULL);
1799
1800         render(isdb, pre, PT_NOFLAG,
1801                "-\todstunr/s", NULL, NULL,
1802                NOVAL,
1803                S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1804                NULL);
1805
1806         render(isdb, pre, PT_NOFLAG,
1807                "-\titmex/s", NULL, NULL,
1808                NOVAL,
1809                S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv),
1810                NULL);
1811
1812         render(isdb, pre, PT_NOFLAG,
1813                "-\totmex/s", NULL, NULL,
1814                NOVAL,
1815                S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv),
1816                NULL);
1817
1818         render(isdb, pre, PT_NOFLAG,
1819                "-\tiparmpb/s", NULL, NULL,
1820                NOVAL,
1821                S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv),
1822                NULL);
1823
1824         render(isdb, pre, PT_NOFLAG,
1825                "-\toparmpb/s", NULL, NULL,
1826                NOVAL,
1827                S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv),
1828                NULL);
1829
1830         render(isdb, pre, PT_NOFLAG,
1831                "-\tisrcq/s", NULL, NULL,
1832                NOVAL,
1833                S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv),
1834                NULL);
1835
1836         render(isdb, pre, PT_NOFLAG,
1837                "-\tosrcq/s", NULL, NULL,
1838                NOVAL,
1839                S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv),
1840                NULL);
1841
1842         render(isdb, pre, PT_NOFLAG,
1843                "-\tiredir/s", NULL, NULL,
1844                NOVAL,
1845                S_VALUE(sneip->InRedirects, sneic->InRedirects, itv),
1846                NULL);
1847
1848         render(isdb, pre, pt_newlin,
1849                "-\toredir/s", NULL, NULL,
1850                NOVAL,
1851                S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv),
1852                NULL);
1853 }
1854
1855 /*
1856  ***************************************************************************
1857  * Display TCP network statistics in selected format.
1858  *
1859  * IN:
1860  * @a           Activity structure with statistics.
1861  * @isdb        Flag, true if db printing, false if ppc printing.
1862  * @pre         Prefix string for output entries
1863  * @curr        Index in array for current sample statistics.
1864  * @itv         Interval of time in jiffies.
1865  ***************************************************************************
1866  */
1867 __print_funct_t render_net_tcp_stats(struct activity *a, int isdb, char *pre,
1868                                      int curr, unsigned long long itv)
1869 {
1870         struct stats_net_tcp
1871                 *sntc = (struct stats_net_tcp *) a->buf[curr],
1872                 *sntp = (struct stats_net_tcp *) a->buf[!curr];
1873         int pt_newlin
1874                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1875
1876         render(isdb, pre, PT_NOFLAG,
1877                "-\tactive/s", NULL, NULL,
1878                NOVAL,
1879                S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
1880                NULL);
1881
1882         render(isdb, pre, PT_NOFLAG,
1883                "-\tpassive/s", NULL, NULL,
1884                NOVAL,
1885                S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1886                NULL);
1887
1888         render(isdb, pre, PT_NOFLAG,
1889                "-\tiseg/s", NULL, NULL,
1890                NOVAL,
1891                S_VALUE(sntp->InSegs, sntc->InSegs, itv),
1892                NULL);
1893
1894         render(isdb, pre, pt_newlin,
1895                "-\toseg/s", NULL, NULL,
1896                NOVAL,
1897                S_VALUE(sntp->OutSegs, sntc->OutSegs, itv),
1898                NULL);
1899 }
1900
1901 /*
1902  ***************************************************************************
1903  * Display TCP network errors statistics in selected format.
1904  *
1905  * IN:
1906  * @a           Activity structure with statistics.
1907  * @isdb        Flag, true if db printing, false if ppc printing.
1908  * @pre         Prefix string for output entries
1909  * @curr        Index in array for current sample statistics.
1910  * @itv         Interval of time in jiffies.
1911  ***************************************************************************
1912  */
1913 __print_funct_t render_net_etcp_stats(struct activity *a, int isdb, char *pre,
1914                                       int curr, unsigned long long itv)
1915 {
1916         struct stats_net_etcp
1917                 *snetc = (struct stats_net_etcp *) a->buf[curr],
1918                 *snetp = (struct stats_net_etcp *) a->buf[!curr];
1919         int pt_newlin
1920                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1921
1922         render(isdb, pre, PT_NOFLAG,
1923                "-\tatmptf/s", NULL, NULL,
1924                NOVAL,
1925                S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1926                NULL);
1927
1928         render(isdb, pre, PT_NOFLAG,
1929                "-\testres/s", NULL, NULL,
1930                NOVAL,
1931                S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
1932                NULL);
1933
1934         render(isdb, pre, PT_NOFLAG,
1935                "-\tretrans/s", NULL, NULL,
1936                NOVAL,
1937                S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
1938                NULL);
1939
1940         render(isdb, pre, PT_NOFLAG,
1941                "-\tisegerr/s", NULL, NULL,
1942                NOVAL,
1943                S_VALUE(snetp->InErrs, snetc->InErrs, itv),
1944                NULL);
1945
1946         render(isdb, pre, pt_newlin,
1947                "-\torsts/s", NULL, NULL,
1948                NOVAL,
1949                S_VALUE(snetp->OutRsts, snetc->OutRsts, itv),
1950                NULL);
1951 }
1952
1953 /*
1954  ***************************************************************************
1955  * Display UDP network statistics in selected format.
1956  *
1957  * IN:
1958  * @a           Activity structure with statistics.
1959  * @isdb        Flag, true if db printing, false if ppc printing.
1960  * @pre         Prefix string for output entries
1961  * @curr        Index in array for current sample statistics.
1962  * @itv         Interval of time in jiffies.
1963  ***************************************************************************
1964  */
1965 __print_funct_t render_net_udp_stats(struct activity *a, int isdb, char *pre,
1966                                      int curr, unsigned long long itv)
1967 {
1968         struct stats_net_udp
1969                 *snuc = (struct stats_net_udp *) a->buf[curr],
1970                 *snup = (struct stats_net_udp *) a->buf[!curr];
1971         int pt_newlin
1972                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1973
1974         render(isdb, pre, PT_NOFLAG,
1975                "-\tidgm/s", NULL, NULL,
1976                NOVAL,
1977                S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
1978                NULL);
1979
1980         render(isdb, pre, PT_NOFLAG,
1981                "-\todgm/s", NULL, NULL,
1982                NOVAL,
1983                S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1984                NULL);
1985
1986         render(isdb, pre, PT_NOFLAG,
1987                "-\tnoport/s", NULL, NULL,
1988                NOVAL,
1989                S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
1990                NULL);
1991
1992         render(isdb, pre, pt_newlin,
1993                "-\tidgmerr/s", NULL, NULL,
1994                NOVAL,
1995                S_VALUE(snup->InErrors, snuc->InErrors, itv),
1996                NULL);
1997 }
1998
1999 /*
2000  ***************************************************************************
2001  * Display IPv6 network sockets statistics in selected format.
2002  *
2003  * IN:
2004  * @a           Activity structure with statistics.
2005  * @isdb        Flag, true if db printing, false if ppc printing.
2006  * @pre         Prefix string for output entries
2007  * @curr        Index in array for current sample statistics.
2008  * @itv         Interval of time in jiffies.
2009  ***************************************************************************
2010  */
2011 __print_funct_t render_net_sock6_stats(struct activity *a, int isdb, char *pre,
2012                                        int curr, unsigned long long itv)
2013 {
2014         struct stats_net_sock6
2015                 *snsc = (struct stats_net_sock6 *) a->buf[curr];
2016         int pt_newlin
2017                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2018
2019         render(isdb, pre, PT_USEINT,
2020                "-\ttcp6sck", NULL, NULL,
2021                snsc->tcp6_inuse, DNOVAL, NULL);
2022
2023         render(isdb, pre, PT_USEINT,
2024                "-\tudp6sck",  NULL, NULL,
2025                snsc->udp6_inuse, DNOVAL, NULL);
2026
2027         render(isdb, pre, PT_USEINT,
2028                "-\traw6sck", NULL, NULL,
2029                snsc->raw6_inuse, DNOVAL, NULL);
2030
2031         render(isdb, pre, PT_USEINT | pt_newlin,
2032                "-\tip6-frag", NULL, NULL,
2033                snsc->frag6_inuse, DNOVAL, NULL);
2034 }
2035
2036 /*
2037  ***************************************************************************
2038  * Display IPv6 network statistics in selected format.
2039  *
2040  * IN:
2041  * @a           Activity structure with statistics.
2042  * @isdb        Flag, true if db printing, false if ppc printing.
2043  * @pre         Prefix string for output entries
2044  * @curr        Index in array for current sample statistics.
2045  * @itv         Interval of time in jiffies.
2046  ***************************************************************************
2047  */
2048 __print_funct_t render_net_ip6_stats(struct activity *a, int isdb, char *pre,
2049                                      int curr, unsigned long long itv)
2050 {
2051         struct stats_net_ip6
2052                 *snic = (struct stats_net_ip6 *) a->buf[curr],
2053                 *snip = (struct stats_net_ip6 *) a->buf[!curr];
2054         int pt_newlin
2055                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2056
2057         render(isdb, pre, PT_NOFLAG,
2058                "-\tirec6/s", NULL, NULL,
2059                NOVAL,
2060                S_VALUE(snip->InReceives6, snic->InReceives6, itv),
2061                NULL);
2062
2063         render(isdb, pre, PT_NOFLAG,
2064                "-\tfwddgm6/s", NULL, NULL,
2065                NOVAL,
2066                S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
2067                NULL);
2068
2069         render(isdb, pre, PT_NOFLAG,
2070                "-\tidel6/s", NULL, NULL,
2071                NOVAL,
2072                S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
2073                NULL);
2074
2075         render(isdb, pre, PT_NOFLAG,
2076                "-\torq6/s", NULL, NULL,
2077                NOVAL,
2078                S_VALUE(snip->OutRequests6, snic->OutRequests6, itv),
2079                NULL);
2080
2081         render(isdb, pre, PT_NOFLAG,
2082                "-\tasmrq6/s", NULL, NULL,
2083                NOVAL,
2084                S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv),
2085                NULL);
2086
2087         render(isdb, pre, PT_NOFLAG,
2088                "-\tasmok6/s", NULL, NULL,
2089                NOVAL,
2090                S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv),
2091                NULL);
2092
2093         render(isdb, pre, PT_NOFLAG,
2094                "-\timcpck6/s", NULL, NULL,
2095                NOVAL,
2096                S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv),
2097                NULL);
2098
2099         render(isdb, pre, PT_NOFLAG,
2100                "-\tomcpck6/s", NULL, NULL,
2101                NOVAL,
2102                S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv),
2103                NULL);
2104
2105         render(isdb, pre, PT_NOFLAG,
2106                "-\tfragok6/s", NULL, NULL,
2107                NOVAL,
2108                S_VALUE(snip->FragOKs6, snic->FragOKs6, itv),
2109                NULL);
2110
2111         render(isdb, pre, pt_newlin,
2112                "-\tfragcr6/s", NULL, NULL,
2113                NOVAL,
2114                S_VALUE(snip->FragCreates6, snic->FragCreates6, itv),
2115                NULL);
2116 }
2117
2118 /*
2119  ***************************************************************************
2120  * Display IPv6 network errors statistics in selected format.
2121  *
2122  * IN:
2123  * @a           Activity structure with statistics.
2124  * @isdb        Flag, true if db printing, false if ppc printing.
2125  * @pre         Prefix string for output entries
2126  * @curr        Index in array for current sample statistics.
2127  * @itv         Interval of time in jiffies.
2128  ***************************************************************************
2129  */
2130 __print_funct_t render_net_eip6_stats(struct activity *a, int isdb, char *pre,
2131                                       int curr, unsigned long long itv)
2132 {
2133         struct stats_net_eip6
2134                 *sneic = (struct stats_net_eip6 *) a->buf[curr],
2135                 *sneip = (struct stats_net_eip6 *) a->buf[!curr];
2136         int pt_newlin
2137                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2138
2139         render(isdb, pre, PT_NOFLAG,
2140                "-\tihdrer6/s", NULL, NULL,
2141                NOVAL,
2142                S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
2143                NULL);
2144
2145         render(isdb, pre, PT_NOFLAG,
2146                "-\tiadrer6/s", NULL, NULL,
2147                NOVAL,
2148                S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
2149                NULL);
2150
2151         render(isdb, pre, PT_NOFLAG,
2152                "-\tiukwnp6/s", NULL, NULL,
2153                NOVAL,
2154                S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
2155                NULL);
2156
2157         render(isdb, pre, PT_NOFLAG,
2158                "-\ti2big6/s", NULL, NULL,
2159                NOVAL,
2160                S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv),
2161                NULL);
2162
2163         render(isdb, pre, PT_NOFLAG,
2164                "-\tidisc6/s", NULL, NULL,
2165                NOVAL,
2166                S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv),
2167                NULL);
2168
2169         render(isdb, pre, PT_NOFLAG,
2170                "-\todisc6/s", NULL, NULL,
2171                NOVAL,
2172                S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv),
2173                NULL);
2174
2175         render(isdb, pre, PT_NOFLAG,
2176                "-\tinort6/s", NULL, NULL,
2177                NOVAL,
2178                S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv),
2179                NULL);
2180
2181         render(isdb, pre, PT_NOFLAG,
2182                "-\tonort6/s", NULL, NULL,
2183                NOVAL,
2184                S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv),
2185                NULL);
2186
2187         render(isdb, pre, PT_NOFLAG,
2188                "-\tasmf6/s", NULL, NULL,
2189                NOVAL,
2190                S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv),
2191                NULL);
2192
2193         render(isdb, pre, PT_NOFLAG,
2194                "-\tfragf6/s", NULL, NULL,
2195                NOVAL,
2196                S_VALUE(sneip->FragFails6, sneic->FragFails6, itv),
2197                NULL);
2198
2199         render(isdb, pre, pt_newlin,
2200                "-\titrpck6/s", NULL, NULL,
2201                NOVAL,
2202                S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv),
2203                NULL);
2204 }
2205
2206 /*
2207  ***************************************************************************
2208  * Display ICMPv6 network statistics in selected format.
2209  *
2210  * IN:
2211  * @a           Activity structure with statistics.
2212  * @isdb        Flag, true if db printing, false if ppc printing.
2213  * @pre         Prefix string for output entries
2214  * @curr        Index in array for current sample statistics.
2215  * @itv         Interval of time in jiffies.
2216  ***************************************************************************
2217  */
2218 __print_funct_t render_net_icmp6_stats(struct activity *a, int isdb, char *pre,
2219                                        int curr, unsigned long long itv)
2220 {
2221         struct stats_net_icmp6
2222                 *snic = (struct stats_net_icmp6 *) a->buf[curr],
2223                 *snip = (struct stats_net_icmp6 *) a->buf[!curr];
2224         int pt_newlin
2225                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2226
2227         render(isdb, pre, PT_NOFLAG,
2228                "-\timsg6/s", NULL, NULL,
2229                NOVAL,
2230                S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
2231                NULL);
2232
2233         render(isdb, pre, PT_NOFLAG,
2234                "-\tomsg6/s", NULL, NULL,
2235                NOVAL,
2236                S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
2237                NULL);
2238
2239         render(isdb, pre, PT_NOFLAG,
2240                "-\tiech6/s", NULL, NULL,
2241                NOVAL,
2242                S_VALUE(snip->InEchos6, snic->InEchos6, itv),
2243                NULL);
2244
2245         render(isdb, pre, PT_NOFLAG,
2246                "-\tiechr6/s", NULL, NULL,
2247                NOVAL,
2248                S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
2249                NULL);
2250
2251         render(isdb, pre, PT_NOFLAG,
2252                "-\toechr6/s", NULL, NULL,
2253                NOVAL,
2254                S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
2255                NULL);
2256
2257         render(isdb, pre, PT_NOFLAG,
2258                "-\tigmbq6/s", NULL, NULL,
2259                NOVAL,
2260                S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
2261                NULL);
2262
2263         render(isdb, pre, PT_NOFLAG,
2264                "-\tigmbr6/s", NULL, NULL,
2265                NOVAL,
2266                S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
2267                NULL);
2268
2269         render(isdb, pre, PT_NOFLAG,
2270                "-\togmbr6/s", NULL, NULL,
2271                NOVAL,
2272                S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
2273                NULL);
2274
2275         render(isdb, pre, PT_NOFLAG,
2276                "-\tigmbrd6/s", NULL, NULL,
2277                NOVAL,
2278                S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
2279                NULL);
2280
2281         render(isdb, pre, PT_NOFLAG,
2282                "-\togmbrd6/s", NULL, NULL,
2283                NOVAL,
2284                S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
2285                NULL);
2286
2287         render(isdb, pre, PT_NOFLAG,
2288                "-\tirtsol6/s", NULL, NULL,
2289                NOVAL,
2290                S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
2291                NULL);
2292
2293         render(isdb, pre, PT_NOFLAG,
2294                "-\tortsol6/s", NULL, NULL,
2295                NOVAL,
2296                S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
2297                NULL);
2298
2299         render(isdb, pre, PT_NOFLAG,
2300                "-\tirtad6/s", NULL, NULL,
2301                NOVAL,
2302                S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
2303                NULL);
2304
2305         render(isdb, pre, PT_NOFLAG,
2306                "-\tinbsol6/s", NULL, NULL,
2307                NOVAL,
2308                S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv),
2309                NULL);
2310
2311         render(isdb, pre, PT_NOFLAG,
2312                "-\tonbsol6/s", NULL, NULL,
2313                NOVAL,
2314                S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
2315                NULL);
2316
2317         render(isdb, pre, PT_NOFLAG,
2318                "-\tinbad6/s", NULL, NULL,
2319                NOVAL,
2320                S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
2321                NULL);
2322
2323         render(isdb, pre, pt_newlin,
2324                "-\tonbad6/s", NULL, NULL,
2325                NOVAL,
2326                S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv),
2327                NULL);
2328 }
2329
2330 /*
2331  ***************************************************************************
2332  * Display ICMPv6 error messages statistics in selected format.
2333  *
2334  * IN:
2335  * @a           Activity structure with statistics.
2336  * @isdb        Flag, true if db printing, false if ppc printing.
2337  * @pre         Prefix string for output entries
2338  * @curr        Index in array for current sample statistics.
2339  * @itv         Interval of time in jiffies.
2340  ***************************************************************************
2341  */
2342 __print_funct_t render_net_eicmp6_stats(struct activity *a, int isdb, char *pre,
2343                                         int curr, unsigned long long itv)
2344 {
2345         struct stats_net_eicmp6
2346                 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
2347                 *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
2348         int pt_newlin
2349                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2350
2351         render(isdb, pre, PT_NOFLAG,
2352                "-\tierr6/s", NULL, NULL,
2353                NOVAL,
2354                S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
2355                NULL);
2356
2357         render(isdb, pre, PT_NOFLAG,
2358                "-\tidtunr6/s", NULL, NULL,
2359                NOVAL,
2360                S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
2361                NULL);
2362
2363         render(isdb, pre, PT_NOFLAG,
2364                "-\todtunr6/s", NULL, NULL,
2365                NOVAL,
2366                S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
2367                NULL);
2368
2369         render(isdb, pre, PT_NOFLAG,
2370                "-\titmex6/s", NULL, NULL,
2371                NOVAL,
2372                S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
2373                NULL);
2374
2375         render(isdb, pre, PT_NOFLAG,
2376                "-\totmex6/s", NULL, NULL,
2377                NOVAL,
2378                S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
2379                NULL);
2380
2381         render(isdb, pre, PT_NOFLAG,
2382                "-\tiprmpb6/s", NULL, NULL,
2383                NOVAL,
2384                S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
2385                NULL);
2386
2387         render(isdb, pre, PT_NOFLAG,
2388                "-\toprmpb6/s", NULL, NULL,
2389                NOVAL,
2390                S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
2391                NULL);
2392
2393         render(isdb, pre, PT_NOFLAG,
2394                "-\tiredir6/s", NULL, NULL,
2395                NOVAL,
2396                S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
2397                NULL);
2398
2399         render(isdb, pre, PT_NOFLAG,
2400                "-\toredir6/s", NULL, NULL,
2401                NOVAL,
2402                S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
2403                NULL);
2404
2405         render(isdb, pre, PT_NOFLAG,
2406                "-\tipck2b6/s", NULL, NULL,
2407                NOVAL,
2408                S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
2409                NULL);
2410
2411         render(isdb, pre, pt_newlin,
2412                "-\topck2b6/s", NULL, NULL,
2413                NOVAL,
2414                S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv),
2415                NULL);
2416 }
2417
2418 /*
2419  ***************************************************************************
2420  * Display UDP6 network statistics in selected format.
2421  *
2422  * IN:
2423  * @a           Activity structure with statistics.
2424  * @isdb        Flag, true if db printing, false if ppc printing.
2425  * @pre         Prefix string for output entries
2426  * @curr        Index in array for current sample statistics.
2427  * @itv         Interval of time in jiffies.
2428  ***************************************************************************
2429  */
2430 __print_funct_t render_net_udp6_stats(struct activity *a, int isdb, char *pre,
2431                                       int curr, unsigned long long itv)
2432 {
2433         struct stats_net_udp6
2434                 *snuc = (struct stats_net_udp6 *) a->buf[curr],
2435                 *snup = (struct stats_net_udp6 *) a->buf[!curr];
2436         int pt_newlin
2437                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2438
2439         render(isdb, pre, PT_NOFLAG,
2440                "-\tidgm6/s", NULL, NULL,
2441                NOVAL,
2442                S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
2443                NULL);
2444
2445         render(isdb, pre, PT_NOFLAG,
2446                "-\todgm6/s", NULL, NULL,
2447                NOVAL,
2448                S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
2449                NULL);
2450
2451         render(isdb, pre, PT_NOFLAG,
2452                "-\tnoport6/s", NULL, NULL,
2453                NOVAL,
2454                S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
2455                NULL);
2456
2457         render(isdb, pre, pt_newlin,
2458                "-\tidgmer6/s", NULL, NULL,
2459                NOVAL,
2460                S_VALUE(snup->InErrors6, snuc->InErrors6, itv),
2461                NULL);
2462 }
2463
2464 /*
2465  ***************************************************************************
2466  * Display CPU frequency statistics in selected format.
2467  *
2468  * IN:
2469  * @a           Activity structure with statistics.
2470  * @isdb        Flag, true if db printing, false if ppc printing.
2471  * @pre         Prefix string for output entries
2472  * @curr        Index in array for current sample statistics.
2473  * @itv         Interval of time in jiffies.
2474  ***************************************************************************
2475  */
2476 __print_funct_t render_pwr_cpufreq_stats(struct activity *a, int isdb, char *pre,
2477                                          int curr, unsigned long long itv)
2478 {
2479         int i;
2480         struct stats_pwr_cpufreq *spc;
2481         int pt_newlin
2482                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2483
2484         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2485
2486                 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
2487
2488                 /* Should current CPU (including CPU "all") be displayed? */
2489                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2490
2491                         if (!i) {
2492                                 /* This is CPU "all" */
2493                                 render(isdb, pre, pt_newlin,
2494                                        "all\tMHz",
2495                                        "-1", NULL,
2496                                        NOVAL,
2497                                        ((double) spc->cpufreq) / 100,
2498                                        NULL);
2499                         }
2500                         else {
2501                                 render(isdb, pre, pt_newlin,
2502                                        "cpu%d\tMHz",
2503                                        "%d", cons(iv, i - 1, NOVAL),
2504                                        NOVAL,
2505                                        ((double) spc->cpufreq) / 100,
2506                                        NULL);
2507                         }
2508                 }
2509         }
2510 }
2511
2512 /*
2513  ***************************************************************************
2514  * Display fan statistics in selected format.
2515  *
2516  * IN:
2517  * @a           Activity structure with statistics.
2518  * @isdb        Flag, true if db printing, false if ppc printing.
2519  * @pre         Prefix string for output entries
2520  * @curr        Index in array for current sample statistics.
2521  * @itv         Interval of time in jiffies.
2522  ***************************************************************************
2523  */
2524 __print_funct_t render_pwr_fan_stats(struct activity *a, int isdb, char *pre,
2525                                      int curr, unsigned long long itv)
2526 {
2527         int i;
2528         struct stats_pwr_fan *spc;
2529         int pt_newlin
2530                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2531
2532         for (i = 0; i < a->nr; i++) {
2533                 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
2534
2535                 render(isdb, pre, PT_USESTR,
2536                        "fan%d\tDEVICE",
2537                        "%d",
2538                        cons(iv, i + 1, NOVAL),
2539                        NOVAL,
2540                        NOVAL,
2541                        spc->device);
2542
2543                 render(isdb, pre, PT_NOFLAG,
2544                        "fan%d\trpm",
2545                        NULL,
2546                        cons(iv, i + 1, NOVAL),
2547                        NOVAL,
2548                        spc->rpm,
2549                        NULL);
2550
2551                 render(isdb, pre, pt_newlin,
2552                        "fan%d\tdrpm",
2553                        NULL,
2554                        cons(iv, i + 1, NOVAL),
2555                        NOVAL,
2556                        spc->rpm - spc->rpm_min,
2557                        NULL);
2558         }
2559 }
2560
2561 /*
2562  ***************************************************************************
2563  * Display temperature statistics in selected format.
2564  *
2565  * IN:
2566  * @a           Activity structure with statistics.
2567  * @isdb        Flag, true if db printing, false if ppc printing.
2568  * @pre         Prefix string for output entries
2569  * @curr        Index in array for current sample statistics.
2570  * @itv         Interval of time in jiffies.
2571  ***************************************************************************
2572  */
2573 __print_funct_t render_pwr_temp_stats(struct activity *a, int isdb, char *pre,
2574                                       int curr, unsigned long long itv)
2575 {
2576         int i;
2577         struct stats_pwr_temp *spc;
2578         int pt_newlin
2579                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2580
2581         for (i = 0; i < a->nr; i++) {
2582                 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
2583
2584                 render(isdb, pre, PT_USESTR,
2585                        "temp%d\tDEVICE",
2586                        "%d",
2587                        cons(iv, i + 1, NOVAL),
2588                        NOVAL,
2589                        NOVAL,
2590                        spc->device);
2591
2592                 render(isdb, pre, PT_NOFLAG,
2593                        "temp%d\tdegC",
2594                        NULL,
2595                        cons(iv, i + 1, NOVAL),
2596                        NOVAL,
2597                        spc->temp,
2598                        NULL);
2599
2600                 render(isdb, pre, pt_newlin,
2601                        "temp%d\t%%temp",
2602                        NULL,
2603                        cons(iv, i + 1, NOVAL),
2604                        NOVAL,
2605                        (spc->temp_max - spc->temp_min) ?
2606                        (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
2607                        0.0,
2608                        NULL);
2609         }
2610 }
2611
2612 /*
2613  ***************************************************************************
2614  * Display voltage inputs statistics in selected format.
2615  *
2616  * IN:
2617  * @a           Activity structure with statistics.
2618  * @isdb        Flag, true if db printing, false if ppc printing.
2619  * @pre         Prefix string for output entries
2620  * @curr        Index in array for current sample statistics.
2621  * @itv         Interval of time in jiffies.
2622  ***************************************************************************
2623  */
2624 __print_funct_t render_pwr_in_stats(struct activity *a, int isdb, char *pre,
2625                                     int curr, unsigned long long itv)
2626 {
2627         int i;
2628         struct stats_pwr_in *spc;
2629         int pt_newlin
2630                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2631
2632         for (i = 0; i < a->nr; i++) {
2633                 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
2634
2635                 render(isdb, pre, PT_USESTR,
2636                        "in%d\tDEVICE",
2637                        "%d",
2638                        cons(iv, i, NOVAL),
2639                        NOVAL,
2640                        NOVAL,
2641                        spc->device);
2642
2643                 render(isdb, pre, PT_NOFLAG,
2644                        "in%d\tinV",
2645                        NULL,
2646                        cons(iv, i, NOVAL),
2647                        NOVAL,
2648                        spc->in,
2649                        NULL);
2650
2651                 render(isdb, pre, pt_newlin,
2652                        "in%d\t%%in",
2653                        NULL,
2654                        cons(iv, i, NOVAL),
2655                        NOVAL,
2656                        (spc->in_max - spc->in_min) ?
2657                        (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
2658                        0.0,
2659                        NULL);
2660         }
2661 }
2662
2663 /*
2664  ***************************************************************************
2665  * Display huge pages statistics in selected format.
2666  *
2667  * IN:
2668  * @a           Activity structure with statistics.
2669  * @isdb        Flag, true if db printing, false if ppc printing.
2670  * @pre         Prefix string for output entries
2671  * @curr        Index in array for current sample statistics.
2672  * @itv         Interval of time in jiffies.
2673  ***************************************************************************
2674  */
2675 __print_funct_t render_huge_stats(struct activity *a, int isdb, char *pre,
2676                                   int curr, unsigned long long itv)
2677 {
2678         struct stats_huge
2679                 *smc = (struct stats_huge *) a->buf[curr];
2680         int pt_newlin
2681                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2682
2683         render(isdb, pre, PT_USEINT,
2684                "-\tkbhugfree", NULL, NULL,
2685                smc->frhkb, DNOVAL, NULL);
2686
2687         render(isdb, pre, PT_USEINT,
2688                "-\tkbhugused", NULL, NULL,
2689                smc->tlhkb - smc->frhkb, DNOVAL, NULL);
2690
2691         render(isdb, pre, pt_newlin,
2692                "-\t%%hugused", NULL, NULL, NOVAL,
2693                smc->tlhkb ?
2694                SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) :
2695                0.0, NULL);
2696 }
2697
2698 /*
2699  ***************************************************************************
2700  * Display weighted CPU frequency statistics in selected format.
2701  *
2702  * IN:
2703  * @a           Activity structure with statistics.
2704  * @isdb        Flag, true if db printing, false if ppc printing.
2705  * @pre         Prefix string for output entries
2706  * @curr        Index in array for current sample statistics.
2707  * @itv         Interval of time in jiffies.
2708  ***************************************************************************
2709  */
2710 __print_funct_t render_pwr_wghfreq_stats(struct activity *a, int isdb, char *pre,
2711                                          int curr, unsigned long long itv)
2712 {
2713         int i, k;
2714         struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
2715         unsigned long long tis, tisfreq;
2716         int pt_newlin
2717                 = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2718
2719         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2720
2721                 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr]  + i * a->msize * a->nr2);
2722                 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
2723
2724                 /* Should current CPU (including CPU "all") be displayed? */
2725                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2726
2727                         /* Yes... */
2728                         tisfreq = 0;
2729                         tis = 0;
2730
2731                         for (k = 0; k < a->nr2; k++) {
2732
2733                                 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2734                                 if (!spc_k->freq)
2735                                         break;
2736                                 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2737
2738                                 tisfreq += (spc_k->freq / 1000) *
2739                                            (spc_k->time_in_state - spp_k->time_in_state);
2740                                 tis     += (spc_k->time_in_state - spp_k->time_in_state);
2741                         }
2742
2743                         if (!i) {
2744                                 /* This is CPU "all" */
2745                                 render(isdb, pre, pt_newlin,
2746                                        "all\twghMHz",
2747                                        "-1", NULL,
2748                                        NOVAL,
2749                                        tis ? ((double) tisfreq) / tis : 0.0,
2750                                        NULL);
2751                         }
2752                         else {
2753                                 render(isdb, pre, pt_newlin,
2754                                        "cpu%d\twghMHz",
2755                                        "%d", cons(iv, i - 1, NOVAL),
2756                                        NOVAL,
2757                                        tis ? ((double) tisfreq) / tis : 0.0,
2758                                        NULL);
2759                         }
2760                 }
2761         }
2762 }
2763
2764 /*
2765  ***************************************************************************
2766  * Display USB devices statistics in selected format.
2767  *
2768  * IN:
2769  * @a           Activity structure with statistics.
2770  * @isdb        Flag, true if db printing, false if ppc printing.
2771  * @pre         Prefix string for output entries
2772  * @curr        Index in array for current sample statistics.
2773  * @itv         Interval of time in jiffies.
2774  ***************************************************************************
2775  */
2776 __print_funct_t render_pwr_usb_stats(struct activity *a, int isdb, char *pre,
2777                                      int curr, unsigned long long itv)
2778 {
2779         int i;
2780         struct stats_pwr_usb *suc;
2781         char id[9];
2782
2783         for (i = 0; i < a->nr; i++) {
2784                 suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
2785
2786                 if (!suc->bus_nr)
2787                         /* Bus#0 doesn't exist: We are at the end of the list */
2788                         break;
2789
2790                 sprintf(id, "%x", suc->vendor_id);
2791                 render(isdb, pre, PT_USESTR,
2792                        "bus%d\tidvendor",
2793                        "%d",
2794                        cons(iv, suc->bus_nr, NOVAL),
2795                        NOVAL,
2796                        NOVAL,
2797                        id);
2798
2799                 sprintf(id, "%x", suc->product_id);
2800                 render(isdb, pre, PT_USESTR,
2801                        "bus%d\tidprod",
2802                        NULL,
2803                        cons(iv, suc->bus_nr, NOVAL),
2804                        NOVAL,
2805                        NOVAL,
2806                        id);
2807
2808                 render(isdb, pre, PT_USEINT,
2809                        "bus%d\tmaxpower",
2810                        NULL,
2811                        cons(iv, suc->bus_nr, NOVAL),
2812                        suc->bmaxpower << 1,
2813                        NOVAL,
2814                        NULL);
2815
2816                 render(isdb, pre, PT_USESTR,
2817                        "bus%d\tmanufact",
2818                        NULL,
2819                        cons(iv, suc->bus_nr, NOVAL),
2820                        NOVAL,
2821                        NOVAL,
2822                        suc->manufacturer);
2823
2824                 render(isdb, pre,
2825                        (DISPLAY_HORIZONTALLY(flags) ? PT_USESTR : PT_USESTR | PT_NEWLIN),
2826                        "bus%d\tproduct",
2827                        NULL,
2828                        cons(iv, suc->bus_nr, NOVAL),
2829                        NOVAL,
2830                        NOVAL,
2831                        suc->product);
2832         }
2833 }
2834
2835 /*
2836  ***************************************************************************
2837  * Display filesystems statistics in selected format.
2838  *
2839  * IN:
2840  * @a           Activity structure with statistics.
2841  * @isdb        Flag, true if db printing, false if ppc printing.
2842  * @pre         Prefix string for output entries
2843  * @curr        Index in array for current sample statistics.
2844  * @itv         Interval of time in jiffies.
2845  ***************************************************************************
2846  */
2847 __print_funct_t render_filesystem_stats(struct activity *a, int isdb, char *pre,
2848                                         int curr, unsigned long long itv)
2849 {
2850         int i;
2851         struct stats_filesystem *sfc;
2852
2853         for (i = 0; i < a->nr; i++) {
2854                 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
2855
2856                 if (!sfc->f_blocks)
2857                         /* Size of filesystem is zero: We are at the end of the list */
2858                         break;
2859
2860                 render(isdb, pre, PT_USERND,
2861                        "%s\tMBfsfree",
2862                        "%s",
2863                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2864                        NOVAL,
2865                        (double) sfc->f_bfree / 1024 / 1024,
2866                        NULL);
2867
2868                 render(isdb, pre, PT_USERND,
2869                        "%s\tMBfsused",
2870                        NULL,
2871                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2872                        NOVAL,
2873                        (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
2874                        NULL);
2875
2876                 render(isdb, pre, PT_NOFLAG,
2877                        "%s\t%%fsused",
2878                        NULL,
2879                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2880                        NOVAL,
2881                        sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
2882                                      : 0.0,
2883                        NULL);
2884
2885                 render(isdb, pre, PT_NOFLAG,
2886                        "%s\t%%ufsused",
2887                        NULL,
2888                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2889                        NOVAL,
2890                        sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
2891                                      : 0.0,
2892                        NULL);
2893
2894                 render(isdb, pre, PT_USEINT,
2895                        "%s\tIfree",
2896                        NULL,
2897                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2898                        sfc->f_ffree,
2899                        NOVAL,
2900                        NULL);
2901
2902                 render(isdb, pre, PT_USEINT,
2903                        "%s\tIused",
2904                        NULL,
2905                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2906                        sfc->f_files - sfc->f_ffree,
2907                        NOVAL,
2908                        NULL);
2909
2910                 render(isdb, pre,
2911                        (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN),
2912                        "%s\t%%Iused",
2913                        NULL,
2914                        cons(sv, DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name, NOVAL),
2915                        NOVAL,
2916                        sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
2917                                     : 0.0,
2918                        NULL);
2919         }
2920 }
2921
2922 /*
2923  ***************************************************************************
2924  * Display Fibre Channel HBA statistics in selected format.
2925  *
2926  * IN:
2927  * @a           Activity structure with statistics.
2928  * @isdb        Flag, true if db printing, false if ppc printing.
2929  * @pre         Prefix string for output entries
2930  * @curr        Index in array for current sample statistics.
2931  * @itv         Interval of time in jiffies.
2932  ***************************************************************************
2933  */
2934 __print_funct_t render_fchost_stats(struct activity *a, int isdb, char *pre,
2935                                     int curr, unsigned long long itv)
2936 {
2937         int i;
2938         struct stats_fchost *sfcc, *sfcp;
2939
2940         for (i = 0; i < a->nr; i++) {
2941                 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
2942                 sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + i * a->msize);
2943
2944                 if (!sfcc->fchost_name[0])
2945                         /* We are at the end of the list */
2946                         break;
2947
2948                 render(isdb, pre, PT_NOFLAG ,
2949                        "%s\tfch_rxf/s",
2950                        "%s",
2951                        cons(sv, sfcc->fchost_name, NOVAL),
2952                        NOVAL,
2953                        S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
2954                        NULL);
2955                 render(isdb, pre, PT_NOFLAG,
2956                        "%s\tfch_txf/s", NULL,
2957                        cons(sv, sfcc->fchost_name, NULL),
2958                        NOVAL,
2959                        S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
2960                        NULL);
2961                 render(isdb, pre, PT_NOFLAG,
2962                        "%s\tfch_rxw/s", NULL,
2963                        cons(sv, sfcc->fchost_name, NULL),
2964                        NOVAL,
2965                        S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
2966                        NULL);
2967                 render(isdb, pre,
2968                        (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN),
2969                        "%s\tfch_txw/s", NULL,
2970                        cons(sv, sfcc->fchost_name, NULL),
2971                        NOVAL,
2972                        S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv),
2973                        NULL);
2974         }
2975 }