~ubuntu-branches/ubuntu/vivid/sysstat/vivid-proposed

« back to all changes in this revision

Viewing changes to prf_stats.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2011-02-07 20:57:05 UTC
  • mfrom: (12.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110207205705-6rbilpmalr1gkfra
Tags: 9.1.7-2
* Upload to unstable.
* debian/rules:
  + call dpkg-buildflags for initial values of CFLAGS & LDFLAGS;
  + use dh_auto_{configure,install,clean} debhelper commands;
  + provide build-arch and build-indep targets.
* Updated 00-Makefile.patch to make it possible to install isag only.
* 09-format-warning.patch: Fix a warning given by gcc -Wformat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * prf_stats.c: Funtions used by sadf to display statistics
3
 
 * (C) 1999-2009 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
 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 "prf_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
 
static char *seps[] =  {"\t", ";"};
39
 
 
40
 
extern unsigned int flags;
41
 
 
42
 
/*
43
 
 ***************************************************************************
44
 
 * cons() -
45
 
 *   encapsulate a pair of ints or pair of char * into a static Cons and
46
 
 *   return a pointer to it.
47
 
 *
48
 
 * given:   t - type of Cons {iv, sv}
49
 
 *          arg1 - unsigned long int (if iv), char * (if sv) to become
50
 
 *                 element 'a'
51
 
 *          arg2 - unsigned long int (if iv), char * (if sv) to become
52
 
 *                 element 'b'
53
 
 *
54
 
 * does:    load a static Cons with values using the t parameter to
55
 
 *          guide pulling values from the arglist
56
 
 *
57
 
 * return:  the address of it's static Cons.  If you need to keep
58
 
 *          the contents of this Cons, copy it somewhere before calling
59
 
 *          cons() against to avoid overwrite.
60
 
 *          ie. don't do this:  f( cons( iv, i, j ), cons( iv, a, b ) );
61
 
 ***************************************************************************
62
 
 */
63
 
static Cons *cons(tcons t, ...)
64
 
{
65
 
        va_list ap;
66
 
        static Cons c;
67
 
 
68
 
        c.t = t;
69
 
 
70
 
        va_start(ap, t);
71
 
        if (t == iv) {
72
 
                c.a.i = va_arg(ap, unsigned long int);
73
 
                c.b.i = va_arg(ap, unsigned long int);
74
 
        }
75
 
        else {
76
 
                c.a.s = va_arg(ap, char *);
77
 
                c.b.s = va_arg(ap, char *);
78
 
        }
79
 
        va_end(ap);
80
 
        return(&c);
81
 
}
82
 
 
83
 
/*
84
 
 ***************************************************************************
85
 
 * render():
86
 
 *
87
 
 * given:    isdb - flag, true if db printing, false if ppc printing
88
 
 *           pre  - prefix string for output entries
89
 
 *           rflags - PT_.... rendering flags
90
 
 *           pptxt - printf-format text required for ppc output (may be null)
91
 
 *           dbtxt - printf-format text required for db output (may be null)
92
 
 *           mid - pptxt/dbtxt format args as a Cons.
93
 
 *           luval - %lu printable arg (PT_USEINT must be set)
94
 
 *           dval  - %.2f printable arg (used unless PT_USEINT is set)
95
 
 *
96
 
 * does:     print [pre<sep>]([dbtxt,arg,arg<sep>]|[pptxt,arg,arg<sep>]) \
97
 
 *                     (luval|dval)(<sep>|\n)
98
 
 *
99
 
 * return:   void.
100
 
 ***************************************************************************
101
 
 */
102
 
static void render(int isdb, char *pre, int rflags, const char *pptxt,
103
 
                   const char *dbtxt, Cons *mid, unsigned long int luval,
104
 
                   double dval)
105
 
{
106
 
        static int newline = 1;
107
 
        const char *txt[]  = {pptxt, dbtxt};
108
 
 
109
 
        /* Start a new line? */
110
 
        if (newline && !DISPLAY_HORIZONTALLY(flags)) {
111
 
                printf("%s", pre);
112
 
        }
113
 
 
114
 
        /* Terminate this one ? ppc always gets a newline */
115
 
        newline = ((rflags & PT_NEWLIN) || !isdb);
116
 
 
117
 
        if (txt[isdb]) {
118
 
                /* pp/dbtxt? */
119
 
 
120
 
                printf("%s", seps[isdb]);       /* Only if something actually gets printed */
121
 
 
122
 
                if (mid) {
123
 
                        /* Got format args? */
124
 
                        switch(mid->t) {
125
 
                        case iv:
126
 
                                printf(txt[isdb], mid->a.i, mid->b.i);
127
 
                                break;
128
 
                        case sv:
129
 
                                printf(txt[isdb], mid->a.s, mid->b.s);
130
 
                                break;
131
 
                        }
132
 
                }
133
 
                else {
134
 
                        printf(txt[isdb]);      /* No args */
135
 
                }
136
 
        }
137
 
 
138
 
        if (rflags & PT_USEINT) {
139
 
                printf("%s%lu", seps[isdb], luval);
140
 
        }
141
 
        else {
142
 
                printf("%s%.2f", seps[isdb], dval);
143
 
        }
144
 
        if (newline) {
145
 
                printf("\n");
146
 
        }
147
 
}
148
 
 
149
 
/*
150
 
 ***************************************************************************
151
 
 * Display CPU statistics in selected format.
152
 
 *
153
 
 * IN:
154
 
 * @a           Activity structure with statistics.
155
 
 * @isdb        Flag, true if db printing, false if ppc printing.
156
 
 * @pre         Prefix string for output entries
157
 
 * @curr        Index in array for current sample statistics.
158
 
 * @g_itv       Interval of time in jiffies multiplied by the number
159
 
 *              of processors.
160
 
 ***************************************************************************
161
 
 */
162
 
__print_funct_t render_cpu_stats(struct activity *a, int isdb, char *pre,
163
 
                                 int curr, unsigned long long g_itv)
164
 
{
165
 
        int i;
166
 
        struct stats_cpu *scc, *scp;
167
 
        int pt_newlin
168
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
169
 
 
170
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
171
 
                
172
 
                scc = (struct stats_cpu *) ((char *) a->buf[curr]  + i * a->msize);
173
 
                scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
174
 
 
175
 
                /* Should current CPU (including CPU "all") be displayed? */
176
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
177
 
                        
178
 
                        if (!i) {
179
 
                                /* This is CPU "all" */
180
 
                                if (DISPLAY_CPU_DEF(a->opt_flags)) {
181
 
                                        render(isdb, pre,
182
 
                                               PT_NOFLAG,       /* that's zero but you know what it means */
183
 
                                               "all\t%%user",   /* all ppctext is used as format, thus '%%' */
184
 
                                               "-1",            /* look! dbtext */
185
 
                                               NULL,            /* no args */
186
 
                                               NOVAL,           /* another 0, named for readability */
187
 
                                               ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv));
188
 
                                }
189
 
                                else if (DISPLAY_CPU_ALL(a->opt_flags)) {
190
 
                                        render(isdb, pre, PT_NOFLAG,
191
 
                                               "all\t%%usr", "-1", NULL,
192
 
                                               NOVAL,
193
 
                                               ll_sp_value(scp->cpu_user - scp->cpu_guest,
194
 
                                                           scc->cpu_user - scc->cpu_guest,
195
 
                                                           g_itv));
196
 
                                }
197
 
                                
198
 
                                render(isdb, pre, PT_NOFLAG,
199
 
                                       "all\t%%nice", NULL, NULL,
200
 
                                       NOVAL,
201
 
                                       ll_sp_value(scp->cpu_nice, scc->cpu_nice, g_itv));
202
 
 
203
 
                                if (DISPLAY_CPU_DEF(a->opt_flags)) {
204
 
                                        render(isdb, pre, PT_NOFLAG,
205
 
                                               "all\t%%system", NULL, NULL,
206
 
                                               NOVAL,
207
 
                                               ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
208
 
                                                           scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
209
 
                                                           g_itv));
210
 
                                }
211
 
                                else if (DISPLAY_CPU_ALL(a->opt_flags)) {
212
 
                                        render(isdb, pre, PT_NOFLAG,
213
 
                                               "all\t%%sys", NULL, NULL,
214
 
                                               NOVAL,
215
 
                                               ll_sp_value(scp->cpu_sys, scc->cpu_sys, g_itv));
216
 
                                }
217
 
                                
218
 
                                render(isdb, pre, PT_NOFLAG,
219
 
                                       "all\t%%iowait", NULL, NULL,
220
 
                                       NOVAL,
221
 
                                       ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv));
222
 
 
223
 
                                render(isdb, pre, PT_NOFLAG,
224
 
                                       "all\t%%steal", NULL, NULL,
225
 
                                       NOVAL,
226
 
                                       ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv));
227
 
 
228
 
                                if (DISPLAY_CPU_ALL(a->opt_flags)) {
229
 
                                        render(isdb, pre, PT_NOFLAG,
230
 
                                               "all\t%%irq", NULL, NULL,
231
 
                                               NOVAL,
232
 
                                               ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv));
233
 
 
234
 
                                        render(isdb, pre, PT_NOFLAG,
235
 
                                               "all\t%%soft", NULL, NULL,
236
 
                                               NOVAL,
237
 
                                               ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv));
238
 
 
239
 
                                        render(isdb, pre, PT_NOFLAG,
240
 
                                               "all\t%%guest", NULL, NULL,
241
 
                                               NOVAL,
242
 
                                               ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv));
243
 
                                }
244
 
 
245
 
                                render(isdb, pre, pt_newlin,
246
 
                                       "all\t%%idle", NULL, NULL,
247
 
                                       NOVAL,
248
 
                                       (scc->cpu_idle < scp->cpu_idle) ?
249
 
                                       0.0 :
250
 
                                       ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv));
251
 
                        }
252
 
                        else {
253
 
                                /* Recalculate itv for current proc */
254
 
                                g_itv = get_per_cpu_interval(scc, scp);
255
 
 
256
 
                                if (DISPLAY_CPU_DEF(a->opt_flags)) {
257
 
                                        render(isdb, pre, PT_NOFLAG,
258
 
                                               "cpu%d\t%%user",         /* ppc text with formatting */
259
 
                                               "%d",                    /* db text with format char */
260
 
                                               cons(iv, i - 1, NOVAL),  /* how we pass format args  */
261
 
                                               NOVAL,
262
 
                                               !g_itv ?
263
 
                                               0.0 :                    /* CPU is offline */
264
 
                                               ll_sp_value(scp->cpu_user, scc->cpu_user, g_itv));
265
 
                                }
266
 
                                else if (DISPLAY_CPU_ALL(a->opt_flags)) {
267
 
                                        render(isdb, pre, PT_NOFLAG,
268
 
                                               "cpu%d\t%%usr", "%d", cons(iv, i - 1, NOVAL),
269
 
                                               NOVAL,
270
 
                                               !g_itv ?
271
 
                                               0.0 :                    /* CPU is offline */
272
 
                                               ll_sp_value(scp->cpu_user - scp->cpu_guest,
273
 
                                                           scc->cpu_user - scc->cpu_guest, g_itv));
274
 
                                }
275
 
                                
276
 
                                render(isdb, pre, PT_NOFLAG,
277
 
                                       "cpu%d\t%%nice", NULL, cons(iv, i - 1, NOVAL),
278
 
                                       NOVAL,
279
 
                                       !g_itv ?
280
 
                                       0.0 :
281
 
                                       ll_sp_value(scp->cpu_nice, scc->cpu_nice, g_itv));
282
 
 
283
 
                                if (DISPLAY_CPU_DEF(a->opt_flags)) {
284
 
                                        render(isdb, pre, PT_NOFLAG,
285
 
                                               "cpu%d\t%%system", NULL, cons(iv, i - 1, NOVAL),
286
 
                                               NOVAL,
287
 
                                               !g_itv ?
288
 
                                               0.0 :
289
 
                                               ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
290
 
                                                           scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
291
 
                                                           g_itv));
292
 
                                }
293
 
                                else if (DISPLAY_CPU_ALL(a->opt_flags)) {
294
 
                                        render(isdb, pre, PT_NOFLAG,
295
 
                                               "cpu%d\t%%sys", NULL, cons(iv, i - 1, NOVAL),
296
 
                                               NOVAL,
297
 
                                               !g_itv ?
298
 
                                               0.0 :
299
 
                                               ll_sp_value(scp->cpu_sys, scc->cpu_sys, g_itv));
300
 
                                }
301
 
                                
302
 
                                render(isdb, pre, PT_NOFLAG,
303
 
                                       "cpu%d\t%%iowait", NULL, cons(iv, i - 1, NOVAL),
304
 
                                       NOVAL,
305
 
                                       !g_itv ?
306
 
                                       0.0 :
307
 
                                       ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv));
308
 
 
309
 
                                render(isdb, pre, PT_NOFLAG,
310
 
                                       "cpu%d\t%%steal", NULL, cons(iv, i - 1, NOVAL),
311
 
                                       NOVAL,
312
 
                                       !g_itv ?
313
 
                                       0.0 :
314
 
                                       ll_sp_value(scp->cpu_steal, scc->cpu_steal, g_itv));
315
 
 
316
 
                                if (DISPLAY_CPU_ALL(a->opt_flags)) {
317
 
                                        render(isdb, pre, PT_NOFLAG,
318
 
                                               "cpu%d\t%%irq", NULL, cons(iv, i - 1, NOVAL),
319
 
                                               NOVAL,
320
 
                                               !g_itv ?
321
 
                                               0.0 :
322
 
                                               ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv));
323
 
 
324
 
                                        render(isdb, pre, PT_NOFLAG,
325
 
                                               "cpu%d\t%%soft", NULL, cons(iv, i - 1, NOVAL),
326
 
                                               NOVAL,
327
 
                                               !g_itv ?
328
 
                                               0.0 :
329
 
                                               ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv));
330
 
                                        
331
 
                                        render(isdb, pre, PT_NOFLAG,
332
 
                                               "cpu%d\t%%guest", NULL, cons(iv, i - 1, NOVAL),
333
 
                                               NOVAL,
334
 
                                               !g_itv ?
335
 
                                               0.0 :
336
 
                                               ll_sp_value(scp->cpu_guest, scc->cpu_guest, g_itv));
337
 
                                }
338
 
                                
339
 
                                if (!g_itv) {
340
 
                                        /* CPU is offline */
341
 
                                        render(isdb, pre, pt_newlin,
342
 
                                               "cpu%d\t%%idle", NULL, cons(iv, i - 1, NOVAL),
343
 
                                               NOVAL,
344
 
                                               0.0);
345
 
                                }
346
 
                                else {
347
 
                                        render(isdb, pre, pt_newlin,
348
 
                                               "cpu%d\t%%idle", NULL, cons(iv, i - 1, NOVAL),
349
 
                                               NOVAL,
350
 
                                               (scc->cpu_idle < scp->cpu_idle) ?
351
 
                                               0.0 :
352
 
                                               ll_sp_value(scp->cpu_idle, scc->cpu_idle, g_itv));
353
 
                                }
354
 
                        }
355
 
                }
356
 
        }
357
 
}
358
 
 
359
 
/*
360
 
 ***************************************************************************
361
 
 * Display task creation and context switch statistics in selected format.
362
 
 *
363
 
 * IN:
364
 
 * @a           Activity structure with statistics.
365
 
 * @isdb        Flag, true if db printing, false if ppc printing.
366
 
 * @pre         Prefix string for output entries
367
 
 * @curr        Index in array for current sample statistics.
368
 
 * @itv         Interval of time in jiffies.
369
 
 ***************************************************************************
370
 
 */
371
 
__print_funct_t render_pcsw_stats(struct activity *a, int isdb, char *pre,
372
 
                                  int curr, unsigned long long itv)
373
 
{
374
 
        struct stats_pcsw
375
 
                *spc = (struct stats_pcsw *) a->buf[curr],
376
 
                *spp = (struct stats_pcsw *) a->buf[!curr];
377
 
        int pt_newlin
378
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
379
 
        
380
 
        /* The first one as an example */
381
 
        render(isdb,            /* db/ppc flag */
382
 
               pre,             /* the preformatted line leader */
383
 
               PT_NOFLAG,       /* is this the end of a db line? */
384
 
               "-\tproc/s",     /* ppc text */
385
 
               NULL,            /* db text */
386
 
               NULL,            /* db/ppc text format args (Cons *) */
387
 
               NOVAL,           /* %lu value (unused unless PT_USEINT) */
388
 
               /* and %.2f value, used unless PT_USEINT */
389
 
               S_VALUE(spp->processes, spc->processes, itv));
390
 
 
391
 
        render(isdb, pre, pt_newlin,
392
 
               "-\tcswch/s", NULL, NULL,
393
 
               NOVAL,
394
 
               ll_s_value(spp->context_switch, spc->context_switch, itv));
395
 
}
396
 
 
397
 
/*
398
 
 ***************************************************************************
399
 
 * Display interrupts statistics in selected format.
400
 
 *
401
 
 * IN:
402
 
 * @a           Activity structure with statistics.
403
 
 * @isdb        Flag, true if db printing, false if ppc printing.
404
 
 * @pre         Prefix string for output entries
405
 
 * @curr        Index in array for current sample statistics.
406
 
 * @itv         Interval of time in jiffies.
407
 
 ***************************************************************************
408
 
 */
409
 
__print_funct_t render_irq_stats(struct activity *a, int isdb, char *pre,
410
 
                                 int curr, unsigned long long itv)
411
 
{
412
 
        int i;
413
 
        struct stats_irq *sic, *sip;
414
 
        int pt_newlin
415
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
416
 
        
417
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
418
 
 
419
 
                sic = (struct stats_irq *) ((char *) a->buf[curr]  + i * a->msize);
420
 
                sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
421
 
                
422
 
                /* Should current interrupt (including int "sum") be displayed? */
423
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
424
 
                        
425
 
                        /* Yes: Display it */
426
 
                        if (!i) {
427
 
                                /* This is interrupt "sum" */
428
 
                                render(isdb, pre, pt_newlin,
429
 
                                       "sum\tintr/s", "-1", NULL,
430
 
                                       NOVAL,
431
 
                                       ll_s_value(sip->irq_nr, sic->irq_nr, itv));
432
 
                        }
433
 
                        else {
434
 
                                render(isdb, pre, pt_newlin,
435
 
                                       "i%03d\tintr/s", "%d", cons(iv, i - 1, NOVAL),
436
 
                                       NOVAL,
437
 
                                       ll_s_value(sip->irq_nr, sic->irq_nr, itv));
438
 
                        }
439
 
                }
440
 
        }
441
 
}
442
 
 
443
 
/*
444
 
 ***************************************************************************
445
 
 * Display swapping statistics in selected format.
446
 
 *
447
 
 * IN:
448
 
 * @a           Activity structure with statistics.
449
 
 * @isdb        Flag, true if db printing, false if ppc printing.
450
 
 * @pre         Prefix string for output entries
451
 
 * @curr        Index in array for current sample statistics.
452
 
 * @itv         Interval of time in jiffies.
453
 
 ***************************************************************************
454
 
 */
455
 
__print_funct_t render_swap_stats(struct activity *a, int isdb, char *pre,
456
 
                                  int curr, unsigned long long itv)
457
 
{
458
 
        struct stats_swap
459
 
                *ssc = (struct stats_swap *) a->buf[curr],
460
 
                *ssp = (struct stats_swap *) a->buf[!curr];
461
 
        int pt_newlin
462
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
463
 
        
464
 
        render(isdb, pre, PT_NOFLAG,
465
 
               "-\tpswpin/s", NULL, NULL,
466
 
               NOVAL,
467
 
               S_VALUE(ssp->pswpin, ssc->pswpin, itv));
468
 
        render(isdb, pre, pt_newlin,
469
 
               "-\tpswpout/s", NULL, NULL,
470
 
               NOVAL,
471
 
               S_VALUE(ssp->pswpout, ssc->pswpout, itv));
472
 
}
473
 
 
474
 
/*
475
 
 ***************************************************************************
476
 
 * Display paging statistics in selected format.
477
 
 *
478
 
 * IN:
479
 
 * @a           Activity structure with statistics.
480
 
 * @isdb        Flag, true if db printing, false if ppc printing.
481
 
 * @pre         Prefix string for output entries
482
 
 * @curr        Index in array for current sample statistics.
483
 
 * @itv         Interval of time in jiffies.
484
 
 ***************************************************************************
485
 
 */
486
 
__print_funct_t render_paging_stats(struct activity *a, int isdb, char *pre,
487
 
                                    int curr, unsigned long long itv)
488
 
{
489
 
        struct stats_paging
490
 
                *spc = (struct stats_paging *) a->buf[curr],
491
 
                *spp = (struct stats_paging *) a->buf[!curr];
492
 
        int pt_newlin
493
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
494
 
 
495
 
        render(isdb, pre, PT_NOFLAG,
496
 
               "-\tpgpgin/s", NULL, NULL,
497
 
               NOVAL,
498
 
               S_VALUE(spp->pgpgin, spc->pgpgin, itv));
499
 
 
500
 
        render(isdb, pre, PT_NOFLAG,
501
 
               "-\tpgpgout/s", NULL, NULL,
502
 
               NOVAL,
503
 
               S_VALUE(spp->pgpgout, spc->pgpgout, itv));
504
 
 
505
 
        render(isdb, pre, PT_NOFLAG,
506
 
               "-\tfault/s", NULL, NULL,
507
 
               NOVAL,
508
 
               S_VALUE(spp->pgfault, spc->pgfault, itv));
509
 
 
510
 
        render(isdb, pre, PT_NOFLAG,
511
 
               "-\tmajflt/s", NULL, NULL,
512
 
               NOVAL,
513
 
               S_VALUE(spp->pgmajfault, spc->pgmajfault, itv));
514
 
 
515
 
        render(isdb, pre, PT_NOFLAG,
516
 
               "-\tpgfree/s", NULL, NULL,
517
 
               NOVAL,
518
 
               S_VALUE(spp->pgfree, spc->pgfree, itv));
519
 
 
520
 
        render(isdb, pre, PT_NOFLAG,
521
 
               "-\tpgscank/s", NULL, NULL,
522
 
               NOVAL,
523
 
               S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv));
524
 
 
525
 
        render(isdb, pre, PT_NOFLAG,
526
 
               "-\tpgscand/s", NULL, NULL,
527
 
               NOVAL,
528
 
               S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv));
529
 
 
530
 
        render(isdb, pre, PT_NOFLAG,
531
 
               "-\tpgsteal/s", NULL, NULL,
532
 
               NOVAL,
533
 
               S_VALUE(spp->pgsteal, spc->pgsteal, itv));
534
 
 
535
 
        render(isdb, pre, pt_newlin,
536
 
               "-\t%%vmeff", NULL, NULL,
537
 
               NOVAL,
538
 
               (spc->pgscan_kswapd + spc->pgscan_direct -
539
 
                spp->pgscan_kswapd - spp->pgscan_direct) ?
540
 
               SP_VALUE(spp->pgsteal, spc->pgsteal,
541
 
                        spc->pgscan_kswapd + spc->pgscan_direct -
542
 
                        spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
543
 
}
544
 
 
545
 
/*
546
 
 ***************************************************************************
547
 
 * Display I/O and transfer rate statistics in selected format.
548
 
 *
549
 
 * IN:
550
 
 * @a           Activity structure with statistics.
551
 
 * @isdb        Flag, true if db printing, false if ppc printing.
552
 
 * @pre         Prefix string for output entries
553
 
 * @curr        Index in array for current sample statistics.
554
 
 * @itv         Interval of time in jiffies.
555
 
 ***************************************************************************
556
 
 */
557
 
__print_funct_t render_io_stats(struct activity *a, int isdb, char *pre,
558
 
                                int curr, unsigned long long itv)
559
 
{
560
 
        struct stats_io
561
 
                *sic = (struct stats_io *) a->buf[curr],
562
 
                *sip = (struct stats_io *) a->buf[!curr];
563
 
        int pt_newlin
564
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
565
 
 
566
 
        render(isdb, pre, PT_NOFLAG,
567
 
               "-\ttps", NULL, NULL,
568
 
               NOVAL,
569
 
               S_VALUE(sip->dk_drive, sic->dk_drive, itv));
570
 
 
571
 
        render(isdb, pre, PT_NOFLAG,
572
 
               "-\trtps", NULL, NULL,
573
 
               NOVAL,
574
 
               S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv));
575
 
 
576
 
        render(isdb, pre, PT_NOFLAG,
577
 
               "-\twtps", NULL, NULL,
578
 
               NOVAL,
579
 
               S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv));
580
 
 
581
 
        render(isdb, pre, PT_NOFLAG,
582
 
               "-\tbread/s", NULL, NULL,
583
 
               NOVAL,
584
 
               S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv));
585
 
 
586
 
        render(isdb, pre, pt_newlin,
587
 
               "-\tbwrtn/s", NULL, NULL,
588
 
               NOVAL,
589
 
               S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
590
 
}
591
 
 
592
 
/*
593
 
 ***************************************************************************
594
 
 * Display memory and swap statistics in selected format.
595
 
 *
596
 
 * IN:
597
 
 * @a           Activity structure with statistics.
598
 
 * @isdb        Flag, true if db printing, false if ppc printing.
599
 
 * @pre         Prefix string for output entries
600
 
 * @curr        Index in array for current sample statistics.
601
 
 * @itv         Interval of time in jiffies.
602
 
 ***************************************************************************
603
 
 */
604
 
__print_funct_t render_memory_stats(struct activity *a, int isdb, char *pre,
605
 
                                    int curr, unsigned long long itv)
606
 
{
607
 
        struct stats_memory
608
 
                *smc = (struct stats_memory *) a->buf[curr],
609
 
                *smp = (struct stats_memory *) a->buf[!curr];
610
 
        int pt_newlin
611
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
612
 
                
613
 
        if (DISPLAY_MEMORY(a->opt_flags)) {
614
 
 
615
 
                render(isdb, pre, PT_NOFLAG,
616
 
                       "-\tfrmpg/s", NULL, NULL,
617
 
                       NOVAL,
618
 
                       S_VALUE((double) KB_TO_PG(smp->frmkb),
619
 
                               (double) KB_TO_PG(smc->frmkb), itv));
620
 
 
621
 
                render(isdb, pre, PT_NOFLAG,
622
 
                       "-\tbufpg/s", NULL, NULL,
623
 
                       NOVAL,
624
 
                       S_VALUE((double) KB_TO_PG(smp->bufkb),
625
 
                               (double) KB_TO_PG(smc->bufkb), itv));
626
 
 
627
 
                render(isdb, pre, pt_newlin,
628
 
                       "-\tcampg/s", NULL, NULL,
629
 
                       NOVAL,
630
 
                       S_VALUE((double) KB_TO_PG(smp->camkb),
631
 
                               (double) KB_TO_PG(smc->camkb), itv));
632
 
        }
633
 
 
634
 
        if (DISPLAY_MEM_AMT(a->opt_flags)) {
635
 
 
636
 
                render(isdb, pre, PT_USEINT,
637
 
                       "-\tkbmemfree", NULL, NULL,
638
 
                       smc->frmkb, DNOVAL);
639
 
 
640
 
                render(isdb, pre, PT_USEINT,
641
 
                       "-\tkbmemused", NULL, NULL,
642
 
                       smc->tlmkb - smc->frmkb, DNOVAL);
643
 
 
644
 
                render(isdb, pre, PT_NOFLAG,
645
 
                       "-\t%%memused", NULL, NULL, NOVAL,
646
 
                       smc->tlmkb ?
647
 
                       SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) :
648
 
                       0.0);
649
 
 
650
 
                render(isdb, pre, PT_USEINT,
651
 
                       "-\tkbbuffers", NULL, NULL,
652
 
                       smc->bufkb, DNOVAL);
653
 
 
654
 
                render(isdb, pre, PT_USEINT,
655
 
                       "-\tkbcached", NULL, NULL,
656
 
                       smc->camkb, DNOVAL);
657
 
 
658
 
                render(isdb, pre, PT_USEINT,
659
 
                       "-\tkbcommit", NULL, NULL,
660
 
                       smc->comkb, DNOVAL);
661
 
 
662
 
                render(isdb, pre, pt_newlin,
663
 
                       "-\t%%commit", NULL, NULL, NOVAL,
664
 
                       (smc->tlmkb + smc->tlskb) ?
665
 
                       SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
666
 
                       0.0);
667
 
        }
668
 
        
669
 
        if (DISPLAY_SWAP(a->opt_flags)) {
670
 
 
671
 
                render(isdb, pre, PT_USEINT,
672
 
                       "-\tkbswpfree", NULL, NULL,
673
 
                       smc->frskb, DNOVAL);
674
 
 
675
 
                render(isdb, pre, PT_USEINT,
676
 
                       "-\tkbswpused", NULL, NULL,
677
 
                       smc->tlskb - smc->frskb, DNOVAL);
678
 
 
679
 
                render(isdb, pre, PT_NOFLAG,
680
 
                       "-\t%%swpused", NULL, NULL, NOVAL,
681
 
                       smc->tlskb ?
682
 
                       SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
683
 
                       0.0);
684
 
 
685
 
                render(isdb, pre, PT_USEINT,
686
 
                       "-\tkbswpcad", NULL, NULL,
687
 
                       smc->caskb, DNOVAL);
688
 
 
689
 
                render(isdb, pre, pt_newlin,
690
 
                       "-\t%%swpcad", NULL, NULL, NOVAL,
691
 
                       (smc->tlskb - smc->frskb) ?
692
 
                       SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
693
 
                       0.0);
694
 
        }
695
 
}
696
 
 
697
 
/*
698
 
 ***************************************************************************
699
 
 * Display kernel tables statistics in selected format.
700
 
 *
701
 
 * IN:
702
 
 * @a           Activity structure with statistics.
703
 
 * @isdb        Flag, true if db printing, false if ppc printing.
704
 
 * @pre         Prefix string for output entries
705
 
 * @curr        Index in array for current sample statistics.
706
 
 * @itv         Interval of time in jiffies.
707
 
 ***************************************************************************
708
 
 */
709
 
__print_funct_t render_ktables_stats(struct activity *a, int isdb, char *pre,
710
 
                                     int curr, unsigned long long itv)
711
 
{
712
 
        struct stats_ktables
713
 
                *skc = (struct stats_ktables *) a->buf[curr];
714
 
        int pt_newlin
715
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
716
 
        
717
 
        render(isdb, pre, PT_USEINT,
718
 
               "-\tdentunusd", NULL, NULL,
719
 
               skc->dentry_stat, DNOVAL);
720
 
 
721
 
        render(isdb, pre, PT_USEINT,
722
 
               "-\tfile-nr", NULL, NULL,
723
 
               skc->file_used, DNOVAL);
724
 
 
725
 
        render(isdb, pre, PT_USEINT,
726
 
               "-\tinode-nr", NULL, NULL,
727
 
               skc->inode_used, DNOVAL);
728
 
 
729
 
        render(isdb, pre, PT_USEINT | pt_newlin,
730
 
               "-\tpty-nr", NULL, NULL,
731
 
               skc->pty_nr, DNOVAL);
732
 
}
733
 
 
734
 
/*
735
 
 ***************************************************************************
736
 
 * Display queue and load statistics in selected format.
737
 
 *
738
 
 * IN:
739
 
 * @a           Activity structure with statistics.
740
 
 * @isdb        Flag, true if db printing, false if ppc printing.
741
 
 * @pre         Prefix string for output entries
742
 
 * @curr        Index in array for current sample statistics.
743
 
 * @itv         Interval of time in jiffies.
744
 
 ***************************************************************************
745
 
 */
746
 
__print_funct_t render_queue_stats(struct activity *a, int isdb, char *pre,
747
 
                                   int curr, unsigned long long itv)
748
 
{
749
 
        struct stats_queue
750
 
                *sqc = (struct stats_queue *) a->buf[curr];
751
 
        int pt_newlin
752
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
753
 
        
754
 
        render(isdb, pre, PT_USEINT,
755
 
               "-\trunq-sz", NULL, NULL,
756
 
               sqc->nr_running, DNOVAL);
757
 
 
758
 
        render(isdb, pre, PT_USEINT,
759
 
               "-\tplist-sz", NULL, NULL,
760
 
               sqc->nr_threads, DNOVAL);
761
 
 
762
 
        render(isdb, pre, PT_NOFLAG,
763
 
               "-\tldavg-1", NULL, NULL,
764
 
               NOVAL,
765
 
               (double) sqc->load_avg_1 / 100);
766
 
 
767
 
        render(isdb, pre, PT_NOFLAG,
768
 
               "-\tldavg-5", NULL, NULL,
769
 
               NOVAL,
770
 
               (double) sqc->load_avg_5 / 100);
771
 
 
772
 
        render(isdb, pre, pt_newlin,
773
 
               "-\tldavg-15", NULL, NULL,
774
 
               NOVAL,
775
 
               (double) sqc->load_avg_15 / 100);
776
 
}
777
 
 
778
 
/*
779
 
 ***************************************************************************
780
 
 * Display serial lines statistics in selected format.
781
 
 *
782
 
 * IN:
783
 
 * @a           Activity structure with statistics.
784
 
 * @isdb        Flag, true if db printing, false if ppc printing.
785
 
 * @pre         Prefix string for output entries
786
 
 * @curr        Index in array for current sample statistics.
787
 
 * @itv         Interval of time in jiffies.
788
 
 ***************************************************************************
789
 
 */
790
 
__print_funct_t render_serial_stats(struct activity *a, int isdb, char *pre,
791
 
                                    int curr, unsigned long long itv)
792
 
{
793
 
        int i;
794
 
        struct stats_serial *ssc, *ssp;
795
 
        int pt_newlin
796
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
797
 
 
798
 
        for (i = 0; i < a->nr; i++) {
799
 
 
800
 
                ssc = (struct stats_serial *) ((char *) a->buf[curr]  + i * a->msize);
801
 
                ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
802
 
 
803
 
                if (ssc->line == 0)
804
 
                        continue;
805
 
 
806
 
                if (ssc->line == ssp->line) {
807
 
                        render(isdb, pre, PT_NOFLAG,
808
 
                               "ttyS%d\trcvin/s", "%d",
809
 
                               cons(iv, ssc->line - 1, NOVAL),
810
 
                               NOVAL,
811
 
                               S_VALUE(ssp->rx, ssc->rx, itv));
812
 
 
813
 
                        render(isdb, pre, PT_NOFLAG,
814
 
                               "ttyS%d\txmtin/s", "%d",
815
 
                               cons(iv, ssc->line - 1, NOVAL),
816
 
                               NOVAL,
817
 
                               S_VALUE(ssp->tx, ssc->tx, itv));
818
 
 
819
 
                        render(isdb, pre, PT_NOFLAG,
820
 
                               "ttyS%d\tframerr/s", "%d",
821
 
                               cons(iv, ssc->line - 1, NOVAL),
822
 
                               NOVAL,
823
 
                               S_VALUE(ssp->frame, ssc->frame, itv));
824
 
 
825
 
                        render(isdb, pre, PT_NOFLAG,
826
 
                               "ttyS%d\tprtyerr/s", "%d",
827
 
                               cons(iv, ssc->line - 1, NOVAL),
828
 
                               NOVAL,
829
 
                               S_VALUE(ssp->parity, ssc->parity, itv));
830
 
 
831
 
                        render(isdb, pre, PT_NOFLAG,
832
 
                               "ttyS%d\tbrk/s", "%d",
833
 
                               cons(iv, ssc->line - 1, NOVAL),
834
 
                               NOVAL,
835
 
                               S_VALUE(ssp->brk, ssc->brk, itv));
836
 
 
837
 
                        render(isdb, pre, pt_newlin,
838
 
                               "ttyS%d\tovrun/s", "%d",
839
 
                               cons(iv, ssc->line - 1, NOVAL),
840
 
                               NOVAL,
841
 
                               S_VALUE(ssp->overrun, ssc->overrun, itv));
842
 
                }
843
 
        }
844
 
 
845
 
}
846
 
 
847
 
/*
848
 
 ***************************************************************************
849
 
 * Display disks statistics in selected format.
850
 
 *
851
 
 * IN:
852
 
 * @a           Activity structure with statistics.
853
 
 * @isdb        Flag, true if db printing, false if ppc printing.
854
 
 * @pre         Prefix string for output entries
855
 
 * @curr        Index in array for current sample statistics.
856
 
 * @itv         Interval of time in jiffies.
857
 
 ***************************************************************************
858
 
 */
859
 
__print_funct_t render_disk_stats(struct activity *a, int isdb, char *pre,
860
 
                                  int curr, unsigned long long itv)
861
 
{
862
 
        int i, j;
863
 
        struct stats_disk *sdc, *sdp;
864
 
        struct ext_disk_stats xds;
865
 
        char *dev_name;
866
 
        int pt_newlin
867
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
868
 
 
869
 
        for (i = 0; i < a->nr; i++) {
870
 
 
871
 
                sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
872
 
 
873
 
                if (!(sdc->major + sdc->minor))
874
 
                        continue;
875
 
 
876
 
                j = check_disk_reg(a, curr, !curr, i);
877
 
                sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
878
 
                
879
 
                /* Compute extended stats (service time, etc.) */
880
 
                compute_ext_disk_stats(sdc, sdp, itv, &xds);
881
 
 
882
 
                dev_name = NULL;
883
 
 
884
 
                if ((USE_PRETTY_OPTION(flags)) && (sdc->major == DEVMAP_MAJOR)) {
885
 
                        dev_name = transform_devmapname(sdc->major, sdc->minor);
886
 
                }
887
 
 
888
 
                if (!dev_name) {
889
 
                        dev_name = get_devname(sdc->major, sdc->minor,
890
 
                                               USE_PRETTY_OPTION(flags));
891
 
                }
892
 
 
893
 
                render(isdb, pre, PT_NOFLAG,
894
 
                       "%s\ttps", "%s",
895
 
                       cons(sv, dev_name, NULL),
896
 
                       NOVAL,
897
 
                       S_VALUE(sdp->nr_ios, sdc->nr_ios, itv));
898
 
 
899
 
                render(isdb, pre, PT_NOFLAG,
900
 
                       "%s\trd_sec/s", NULL,
901
 
                       cons(sv, dev_name, NULL),
902
 
                       NOVAL,
903
 
                       ll_s_value(sdp->rd_sect, sdc->rd_sect, itv));
904
 
 
905
 
                render(isdb, pre, PT_NOFLAG,
906
 
                       "%s\twr_sec/s", NULL,
907
 
                       cons(sv, dev_name, NULL),
908
 
                       NOVAL,
909
 
                       ll_s_value(sdp->wr_sect, sdc->wr_sect, itv));
910
 
 
911
 
                render(isdb, pre, PT_NOFLAG,
912
 
                       "%s\tavgrq-sz", NULL,
913
 
                       cons(sv, dev_name, NULL),
914
 
                       NOVAL,
915
 
                       xds.arqsz);
916
 
 
917
 
                render(isdb, pre, PT_NOFLAG,
918
 
                       "%s\tavgqu-sz", NULL,
919
 
                       cons(sv, dev_name, NULL),
920
 
                       NOVAL,
921
 
                       S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0);
922
 
 
923
 
                render(isdb, pre, PT_NOFLAG,
924
 
                       "%s\tawait", NULL,
925
 
                       cons(sv, dev_name, NULL),
926
 
                       NOVAL,
927
 
                       xds.await);
928
 
 
929
 
                render(isdb, pre, PT_NOFLAG,
930
 
                       "%s\tsvctm", NULL,
931
 
                       cons(sv, dev_name, NULL),
932
 
                       NOVAL,
933
 
                       xds.svctm);
934
 
 
935
 
                render(isdb, pre, pt_newlin,
936
 
                       "%s\t%%util", NULL,
937
 
                       cons(sv, dev_name, NULL),
938
 
                       NOVAL,
939
 
                       xds.util / 10.0);
940
 
        }
941
 
}
942
 
 
943
 
/*
944
 
 ***************************************************************************
945
 
 * Display network interfaces statistics in selected format.
946
 
 *
947
 
 * IN:
948
 
 * @a           Activity structure with statistics.
949
 
 * @isdb        Flag, true if db printing, false if ppc printing.
950
 
 * @pre         Prefix string for output entries
951
 
 * @curr        Index in array for current sample statistics.
952
 
 * @itv         Interval of time in jiffies.
953
 
 ***************************************************************************
954
 
 */
955
 
__print_funct_t render_net_dev_stats(struct activity *a, int isdb, char *pre,
956
 
                                     int curr, unsigned long long itv)
957
 
{
958
 
        int i, j;
959
 
        struct stats_net_dev *sndc, *sndp;
960
 
        int pt_newlin
961
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
962
 
 
963
 
        for (i = 0; i < a->nr; i++) {
964
 
 
965
 
                sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
966
 
 
967
 
                if (!strcmp(sndc->interface, ""))
968
 
                        continue;
969
 
                
970
 
                j = check_net_dev_reg(a, curr, !curr, i);
971
 
                sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
972
 
 
973
 
                render(isdb, pre, PT_NOFLAG,
974
 
                       "%s\trxpck/s", "%s",
975
 
                       cons(sv, sndc->interface, NULL), /* What if the format args are strings? */
976
 
                       NOVAL,
977
 
                       S_VALUE(sndp->rx_packets, sndc->rx_packets, itv));
978
 
 
979
 
                render(isdb, pre, PT_NOFLAG,
980
 
                       "%s\ttxpck/s", NULL,
981
 
                       cons(sv, sndc->interface, NULL),
982
 
                       NOVAL,
983
 
                       S_VALUE(sndp->tx_packets, sndc->tx_packets, itv));
984
 
 
985
 
                render(isdb, pre, PT_NOFLAG,
986
 
                       "%s\trxkB/s", NULL,
987
 
                       cons(sv, sndc->interface, NULL),
988
 
                       NOVAL,
989
 
                       S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv) / 1024);
990
 
 
991
 
                render(isdb, pre, PT_NOFLAG,
992
 
                       "%s\ttxkB/s", NULL,
993
 
                       cons(sv, sndc->interface, NULL),
994
 
                       NOVAL,
995
 
                       S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv) / 1024);
996
 
 
997
 
                render(isdb, pre, PT_NOFLAG,
998
 
                       "%s\trxcmp/s", NULL,
999
 
                       cons(sv, sndc->interface, NULL),
1000
 
                       NOVAL,
1001
 
                       S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv));
1002
 
 
1003
 
                render(isdb, pre, PT_NOFLAG,
1004
 
                       "%s\ttxcmp/s", NULL,
1005
 
                       cons(sv, sndc->interface, NULL),
1006
 
                       NOVAL,
1007
 
                       S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv));
1008
 
 
1009
 
                render(isdb, pre, pt_newlin,
1010
 
                       "%s\trxmcst/s", NULL,
1011
 
                       cons(sv, sndc->interface, NULL),
1012
 
                       NOVAL,
1013
 
                       S_VALUE(sndp->multicast, sndc->multicast, itv));
1014
 
        }
1015
 
}
1016
 
 
1017
 
/*
1018
 
 ***************************************************************************
1019
 
 * Display network interface errors statistics in selected format.
1020
 
 *
1021
 
 * IN:
1022
 
 * @a           Activity structure with statistics.
1023
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1024
 
 * @pre         Prefix string for output entries
1025
 
 * @curr        Index in array for current sample statistics.
1026
 
 * @itv         Interval of time in jiffies.
1027
 
 ***************************************************************************
1028
 
 */
1029
 
__print_funct_t render_net_edev_stats(struct activity *a, int isdb, char *pre,
1030
 
                                      int curr, unsigned long long itv)
1031
 
{
1032
 
        int i, j;
1033
 
        struct stats_net_edev *snedc, *snedp;
1034
 
        int pt_newlin
1035
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1036
 
 
1037
 
        for (i = 0; i < a->nr; i++) {
1038
 
 
1039
 
                snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
1040
 
 
1041
 
                if (!strcmp(snedc->interface, ""))
1042
 
                        continue;
1043
 
                
1044
 
                j = check_net_edev_reg(a, curr, !curr, i);
1045
 
                snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
1046
 
 
1047
 
                render(isdb, pre, PT_NOFLAG,
1048
 
                       "%s\trxerr/s", "%s",
1049
 
                       cons(sv, snedc->interface, NULL),
1050
 
                       NOVAL,
1051
 
                       S_VALUE(snedp->rx_errors, snedc->rx_errors, itv));
1052
 
 
1053
 
                render(isdb, pre, PT_NOFLAG,
1054
 
                       "%s\ttxerr/s", NULL,
1055
 
                       cons(sv, snedc->interface, NULL),
1056
 
                       NOVAL,
1057
 
                       S_VALUE(snedp->tx_errors, snedc->tx_errors, itv));
1058
 
 
1059
 
                render(isdb, pre, PT_NOFLAG,
1060
 
                       "%s\tcoll/s", NULL,
1061
 
                       cons(sv, snedc->interface, NULL),
1062
 
                       NOVAL,
1063
 
                       S_VALUE(snedp->collisions, snedc->collisions, itv));
1064
 
 
1065
 
                render(isdb, pre, PT_NOFLAG,
1066
 
                       "%s\trxdrop/s", NULL,
1067
 
                       cons(sv, snedc->interface, NULL),
1068
 
                       NOVAL,
1069
 
                       S_VALUE(snedp->rx_dropped, snedc->rx_dropped, itv));
1070
 
 
1071
 
                render(isdb, pre, PT_NOFLAG,
1072
 
                       "%s\ttxdrop/s", NULL,
1073
 
                       cons(sv, snedc->interface, NULL),
1074
 
                       NOVAL,
1075
 
                       S_VALUE(snedp->tx_dropped, snedc->tx_dropped, itv));
1076
 
 
1077
 
                render(isdb, pre, PT_NOFLAG,
1078
 
                       "%s\ttxcarr/s", NULL,
1079
 
                       cons(sv, snedc->interface, NULL),
1080
 
                       NOVAL,
1081
 
                       S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv));
1082
 
 
1083
 
                render(isdb, pre, PT_NOFLAG,
1084
 
                       "%s\trxfram/s", NULL,
1085
 
                       cons(sv, snedc->interface, NULL),
1086
 
                       NOVAL,
1087
 
                       S_VALUE(snedp->rx_frame_errors, snedc->rx_frame_errors, itv));
1088
 
 
1089
 
                render(isdb, pre, PT_NOFLAG,
1090
 
                       "%s\trxfifo/s", NULL,
1091
 
                       cons(sv, snedc->interface, NULL),
1092
 
                       NOVAL,
1093
 
                       S_VALUE(snedp->rx_fifo_errors, snedc->rx_fifo_errors, itv));
1094
 
 
1095
 
                render(isdb, pre, pt_newlin,
1096
 
                       "%s\ttxfifo/s", NULL,
1097
 
                       cons(sv, snedc->interface, NULL),
1098
 
                       NOVAL,
1099
 
                       S_VALUE(snedp->tx_fifo_errors, snedc->tx_fifo_errors, itv));
1100
 
        }
1101
 
}
1102
 
 
1103
 
/*
1104
 
 ***************************************************************************
1105
 
 * Display NFS client statistics in selected format.
1106
 
 *
1107
 
 * IN:
1108
 
 * @a           Activity structure with statistics.
1109
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1110
 
 * @pre         Prefix string for output entries
1111
 
 * @curr        Index in array for current sample statistics.
1112
 
 * @itv         Interval of time in jiffies.
1113
 
 ***************************************************************************
1114
 
 */
1115
 
__print_funct_t render_net_nfs_stats(struct activity *a, int isdb, char *pre,
1116
 
                                     int curr, unsigned long long itv)
1117
 
{
1118
 
        struct stats_net_nfs
1119
 
                *snnc = (struct stats_net_nfs *) a->buf[curr],
1120
 
                *snnp = (struct stats_net_nfs *) a->buf[!curr];
1121
 
        int pt_newlin
1122
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1123
 
        
1124
 
        render(isdb, pre, PT_NOFLAG,
1125
 
               "-\tcall/s", NULL, NULL,
1126
 
               NOVAL,
1127
 
               S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv));
1128
 
 
1129
 
        render(isdb, pre, PT_NOFLAG,
1130
 
               "-\tretrans/s", NULL, NULL,
1131
 
               NOVAL,
1132
 
               S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv));
1133
 
 
1134
 
        render(isdb, pre, PT_NOFLAG,
1135
 
               "-\tread/s", NULL, NULL,
1136
 
               NOVAL,
1137
 
               S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv));
1138
 
 
1139
 
        render(isdb, pre, PT_NOFLAG,
1140
 
               "-\twrite/s", NULL, NULL,
1141
 
               NOVAL,
1142
 
               S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv));
1143
 
 
1144
 
        render(isdb, pre, PT_NOFLAG,
1145
 
               "-\taccess/s", NULL, NULL,
1146
 
               NOVAL,
1147
 
               S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv));
1148
 
 
1149
 
        render(isdb, pre, pt_newlin,
1150
 
               "-\tgetatt/s", NULL, NULL,
1151
 
               NOVAL,
1152
 
               S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv));
1153
 
}
1154
 
 
1155
 
/*
1156
 
 ***************************************************************************
1157
 
 * Display NFS server statistics in selected format.
1158
 
 *
1159
 
 * IN:
1160
 
 * @a           Activity structure with statistics.
1161
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1162
 
 * @pre         Prefix string for output entries
1163
 
 * @curr        Index in array for current sample statistics.
1164
 
 * @itv         Interval of time in jiffies.
1165
 
 ***************************************************************************
1166
 
 */
1167
 
__print_funct_t render_net_nfsd_stats(struct activity *a, int isdb, char *pre,
1168
 
                                      int curr, unsigned long long itv)
1169
 
{
1170
 
        struct stats_net_nfsd
1171
 
                *snndc = (struct stats_net_nfsd *) a->buf[curr],
1172
 
                *snndp = (struct stats_net_nfsd *) a->buf[!curr];
1173
 
        int pt_newlin
1174
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1175
 
 
1176
 
        render(isdb, pre, PT_NOFLAG,
1177
 
               "-\tscall/s", NULL, NULL,
1178
 
               NOVAL,
1179
 
               S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv));
1180
 
 
1181
 
        render(isdb, pre, PT_NOFLAG,
1182
 
               "-\tbadcall/s", NULL, NULL,
1183
 
               NOVAL,
1184
 
               S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv));
1185
 
 
1186
 
        render(isdb, pre, PT_NOFLAG,
1187
 
               "-\tpacket/s", NULL, NULL,
1188
 
               NOVAL,
1189
 
               S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv));
1190
 
 
1191
 
        render(isdb, pre, PT_NOFLAG,
1192
 
               "-\tudp/s", NULL, NULL,
1193
 
               NOVAL,
1194
 
               S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv));
1195
 
 
1196
 
        render(isdb, pre, PT_NOFLAG,
1197
 
               "-\ttcp/s", NULL, NULL,
1198
 
               NOVAL,
1199
 
               S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv));
1200
 
 
1201
 
        render(isdb, pre, PT_NOFLAG,
1202
 
               "-\thit/s", NULL, NULL,
1203
 
               NOVAL,
1204
 
               S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv));
1205
 
 
1206
 
        render(isdb, pre, PT_NOFLAG,
1207
 
               "-\tmiss/s", NULL, NULL,
1208
 
               NOVAL,
1209
 
               S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv));
1210
 
 
1211
 
        render(isdb, pre, PT_NOFLAG,
1212
 
               "-\tsread/s", NULL, NULL,
1213
 
               NOVAL,
1214
 
               S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv));
1215
 
 
1216
 
        render(isdb, pre, PT_NOFLAG,
1217
 
               "-\tswrite/s", NULL, NULL,
1218
 
               NOVAL,
1219
 
               S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv));
1220
 
 
1221
 
        render(isdb, pre, PT_NOFLAG,
1222
 
               "-\tsaccess/s", NULL, NULL,
1223
 
               NOVAL,
1224
 
               S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv));
1225
 
 
1226
 
        render(isdb, pre, pt_newlin,
1227
 
               "-\tsgetatt/s", NULL, NULL,
1228
 
               NOVAL,
1229
 
               S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1230
 
}
1231
 
 
1232
 
/*
1233
 
 ***************************************************************************
1234
 
 * Display network sockets statistics in selected format.
1235
 
 *
1236
 
 * IN:
1237
 
 * @a           Activity structure with statistics.
1238
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1239
 
 * @pre         Prefix string for output entries
1240
 
 * @curr        Index in array for current sample statistics.
1241
 
 * @itv         Interval of time in jiffies.
1242
 
 ***************************************************************************
1243
 
 */
1244
 
__print_funct_t render_net_sock_stats(struct activity *a, int isdb, char *pre,
1245
 
                                      int curr, unsigned long long itv)
1246
 
{
1247
 
        struct stats_net_sock
1248
 
                *snsc = (struct stats_net_sock *) a->buf[curr];
1249
 
        int pt_newlin
1250
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1251
 
 
1252
 
        render(isdb, pre, PT_USEINT,
1253
 
               "-\ttotsck", NULL, NULL,
1254
 
               snsc->sock_inuse, DNOVAL);
1255
 
 
1256
 
        render(isdb, pre, PT_USEINT,
1257
 
               "-\ttcpsck", NULL, NULL,
1258
 
               snsc->tcp_inuse, DNOVAL);
1259
 
 
1260
 
        render(isdb, pre, PT_USEINT,
1261
 
               "-\tudpsck",  NULL, NULL,
1262
 
               snsc->udp_inuse, DNOVAL);
1263
 
 
1264
 
        render(isdb, pre, PT_USEINT,
1265
 
               "-\trawsck", NULL, NULL,
1266
 
               snsc->raw_inuse, DNOVAL);
1267
 
 
1268
 
        render(isdb, pre, PT_USEINT,
1269
 
               "-\tip-frag", NULL, NULL,
1270
 
               snsc->frag_inuse, DNOVAL);
1271
 
 
1272
 
        render(isdb, pre, PT_USEINT | pt_newlin,
1273
 
               "-\ttcp-tw", NULL, NULL,
1274
 
               snsc->tcp_tw, DNOVAL);
1275
 
}
1276
 
 
1277
 
/*
1278
 
 ***************************************************************************
1279
 
 * Display IP network statistics in selected format.
1280
 
 *
1281
 
 * IN:
1282
 
 * @a           Activity structure with statistics.
1283
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1284
 
 * @pre         Prefix string for output entries
1285
 
 * @curr        Index in array for current sample statistics.
1286
 
 * @itv         Interval of time in jiffies.
1287
 
 ***************************************************************************
1288
 
 */
1289
 
__print_funct_t render_net_ip_stats(struct activity *a, int isdb, char *pre,
1290
 
                                    int curr, unsigned long long itv)
1291
 
{
1292
 
        struct stats_net_ip
1293
 
                *snic = (struct stats_net_ip *) a->buf[curr],
1294
 
                *snip = (struct stats_net_ip *) a->buf[!curr];
1295
 
        int pt_newlin
1296
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1297
 
        
1298
 
        render(isdb, pre, PT_NOFLAG,
1299
 
               "-\tirec/s", NULL, NULL,
1300
 
               NOVAL,
1301
 
               S_VALUE(snip->InReceives, snic->InReceives, itv));
1302
 
 
1303
 
        render(isdb, pre, PT_NOFLAG,
1304
 
               "-\tfwddgm/s", NULL, NULL,
1305
 
               NOVAL,
1306
 
               S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv));
1307
 
 
1308
 
        render(isdb, pre, PT_NOFLAG,
1309
 
               "-\tidel/s", NULL, NULL,
1310
 
               NOVAL,
1311
 
               S_VALUE(snip->InDelivers, snic->InDelivers, itv));
1312
 
 
1313
 
        render(isdb, pre, PT_NOFLAG,
1314
 
               "-\torq/s", NULL, NULL,
1315
 
               NOVAL,
1316
 
               S_VALUE(snip->OutRequests, snic->OutRequests, itv));
1317
 
 
1318
 
        render(isdb, pre, PT_NOFLAG,
1319
 
               "-\tasmrq/s", NULL, NULL,
1320
 
               NOVAL,
1321
 
               S_VALUE(snip->ReasmReqds, snic->ReasmReqds, itv));
1322
 
 
1323
 
        render(isdb, pre, PT_NOFLAG,
1324
 
               "-\tasmok/s", NULL, NULL,
1325
 
               NOVAL,
1326
 
               S_VALUE(snip->ReasmOKs, snic->ReasmOKs, itv));
1327
 
        
1328
 
        render(isdb, pre, PT_NOFLAG,
1329
 
               "-\tfragok/s", NULL, NULL,
1330
 
               NOVAL,
1331
 
               S_VALUE(snip->FragOKs, snic->FragOKs, itv));
1332
 
 
1333
 
        render(isdb, pre, pt_newlin,
1334
 
               "-\tfragcrt/s", NULL, NULL,
1335
 
               NOVAL,
1336
 
               S_VALUE(snip->FragCreates, snic->FragCreates, itv));
1337
 
}
1338
 
 
1339
 
/*
1340
 
 ***************************************************************************
1341
 
 * Display IP network error statistics in selected format.
1342
 
 *
1343
 
 * IN:
1344
 
 * @a           Activity structure with statistics.
1345
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1346
 
 * @pre         Prefix string for output entries
1347
 
 * @curr        Index in array for current sample statistics.
1348
 
 * @itv         Interval of time in jiffies.
1349
 
 ***************************************************************************
1350
 
 */
1351
 
__print_funct_t render_net_eip_stats(struct activity *a, int isdb, char *pre,
1352
 
                                     int curr, unsigned long long itv)
1353
 
{
1354
 
        struct stats_net_eip
1355
 
                *sneic = (struct stats_net_eip *) a->buf[curr],
1356
 
                *sneip = (struct stats_net_eip *) a->buf[!curr];
1357
 
        int pt_newlin
1358
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1359
 
        
1360
 
        render(isdb, pre, PT_NOFLAG,
1361
 
               "-\tihdrerr/s", NULL, NULL,
1362
 
               NOVAL,
1363
 
               S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv));
1364
 
 
1365
 
        render(isdb, pre, PT_NOFLAG,
1366
 
               "-\tiadrerr/s", NULL, NULL,
1367
 
               NOVAL,
1368
 
               S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv));
1369
 
 
1370
 
        render(isdb, pre, PT_NOFLAG,
1371
 
               "-\tiukwnpr/s", NULL, NULL,
1372
 
               NOVAL,
1373
 
               S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv));
1374
 
 
1375
 
        render(isdb, pre, PT_NOFLAG,
1376
 
               "-\tidisc/s", NULL, NULL,
1377
 
               NOVAL,
1378
 
               S_VALUE(sneip->InDiscards, sneic->InDiscards, itv));
1379
 
 
1380
 
        render(isdb, pre, PT_NOFLAG,
1381
 
               "-\todisc/s", NULL, NULL,
1382
 
               NOVAL,
1383
 
               S_VALUE(sneip->OutDiscards, sneic->OutDiscards, itv));
1384
 
 
1385
 
        render(isdb, pre, PT_NOFLAG,
1386
 
               "-\tonort/s", NULL, NULL,
1387
 
               NOVAL,
1388
 
               S_VALUE(sneip->OutNoRoutes, sneic->OutNoRoutes, itv));
1389
 
        
1390
 
        render(isdb, pre, PT_NOFLAG,
1391
 
               "-\tasmf/s", NULL, NULL,
1392
 
               NOVAL,
1393
 
               S_VALUE(sneip->ReasmFails, sneic->ReasmFails, itv));
1394
 
 
1395
 
        render(isdb, pre, pt_newlin,
1396
 
               "-\tfragf/s", NULL, NULL,
1397
 
               NOVAL,
1398
 
               S_VALUE(sneip->FragFails, sneic->FragFails, itv));
1399
 
}
1400
 
 
1401
 
/*
1402
 
 ***************************************************************************
1403
 
 * Display ICMP network statistics in selected format.
1404
 
 *
1405
 
 * IN:
1406
 
 * @a           Activity structure with statistics.
1407
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1408
 
 * @pre         Prefix string for output entries
1409
 
 * @curr        Index in array for current sample statistics.
1410
 
 * @itv         Interval of time in jiffies.
1411
 
 ***************************************************************************
1412
 
 */
1413
 
__print_funct_t render_net_icmp_stats(struct activity *a, int isdb, char *pre,
1414
 
                                      int curr, unsigned long long itv)
1415
 
{
1416
 
        struct stats_net_icmp
1417
 
                *snic = (struct stats_net_icmp *) a->buf[curr],
1418
 
                *snip = (struct stats_net_icmp *) a->buf[!curr];
1419
 
        int pt_newlin
1420
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1421
 
        
1422
 
        render(isdb, pre, PT_NOFLAG,
1423
 
               "-\timsg/s", NULL, NULL,
1424
 
               NOVAL,
1425
 
               S_VALUE(snip->InMsgs, snic->InMsgs, itv));
1426
 
 
1427
 
        render(isdb, pre, PT_NOFLAG,
1428
 
               "-\tomsg/s", NULL, NULL,
1429
 
               NOVAL,
1430
 
               S_VALUE(snip->OutMsgs, snic->OutMsgs, itv));
1431
 
        
1432
 
        render(isdb, pre, PT_NOFLAG,
1433
 
               "-\tiech/s", NULL, NULL,
1434
 
               NOVAL,
1435
 
               S_VALUE(snip->InEchos, snic->InEchos, itv));
1436
 
 
1437
 
        render(isdb, pre, PT_NOFLAG,
1438
 
               "-\tiechr/s", NULL, NULL,
1439
 
               NOVAL,
1440
 
               S_VALUE(snip->InEchoReps, snic->InEchoReps, itv));
1441
 
 
1442
 
        render(isdb, pre, PT_NOFLAG,
1443
 
               "-\toech/s", NULL, NULL,
1444
 
               NOVAL,
1445
 
               S_VALUE(snip->OutEchos, snic->OutEchos, itv));
1446
 
 
1447
 
        render(isdb, pre, PT_NOFLAG,
1448
 
               "-\toechr/s", NULL, NULL,
1449
 
               NOVAL,
1450
 
               S_VALUE(snip->OutEchoReps, snic->OutEchoReps, itv));
1451
 
 
1452
 
        render(isdb, pre, PT_NOFLAG,
1453
 
               "-\titm/s", NULL, NULL,
1454
 
               NOVAL,
1455
 
               S_VALUE(snip->InTimestamps, snic->InTimestamps, itv));
1456
 
        
1457
 
        render(isdb, pre, PT_NOFLAG,
1458
 
               "-\titmr/s", NULL, NULL,
1459
 
               NOVAL,
1460
 
               S_VALUE(snip->InTimestampReps, snic->InTimestampReps, itv));
1461
 
 
1462
 
        render(isdb, pre, PT_NOFLAG,
1463
 
               "-\totm/s", NULL, NULL,
1464
 
               NOVAL,
1465
 
               S_VALUE(snip->OutTimestamps, snic->OutTimestamps, itv));
1466
 
        
1467
 
        render(isdb, pre, PT_NOFLAG,
1468
 
               "-\totmr/s", NULL, NULL,
1469
 
               NOVAL,
1470
 
               S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv));
1471
 
 
1472
 
        render(isdb, pre, PT_NOFLAG,
1473
 
               "-\tiadrmk/s", NULL, NULL,
1474
 
               NOVAL,
1475
 
               S_VALUE(snip->InAddrMasks, snic->InAddrMasks, itv));
1476
 
        
1477
 
        render(isdb, pre, PT_NOFLAG,
1478
 
               "-\tiadrmkr/s", NULL, NULL,
1479
 
               NOVAL,
1480
 
               S_VALUE(snip->InAddrMaskReps, snic->InAddrMaskReps, itv));
1481
 
        
1482
 
        render(isdb, pre, PT_NOFLAG,
1483
 
               "-\toadrmk/s", NULL, NULL,
1484
 
               NOVAL,
1485
 
               S_VALUE(snip->OutAddrMasks, snic->OutAddrMasks, itv));
1486
 
        
1487
 
        render(isdb, pre, pt_newlin,
1488
 
               "-\toadrmkr/s", NULL, NULL,
1489
 
               NOVAL,
1490
 
               S_VALUE(snip->OutAddrMaskReps, snic->OutAddrMaskReps, itv));
1491
 
}
1492
 
 
1493
 
/*
1494
 
 ***************************************************************************
1495
 
 * Display ICMP error message statistics in selected format.
1496
 
 *
1497
 
 * IN:
1498
 
 * @a           Activity structure with statistics.
1499
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1500
 
 * @pre         Prefix string for output entries
1501
 
 * @curr        Index in array for current sample statistics.
1502
 
 * @itv         Interval of time in jiffies.
1503
 
 ***************************************************************************
1504
 
 */
1505
 
__print_funct_t render_net_eicmp_stats(struct activity *a, int isdb, char *pre,
1506
 
                                       int curr, unsigned long long itv)
1507
 
{
1508
 
        struct stats_net_eicmp
1509
 
                *sneic = (struct stats_net_eicmp *) a->buf[curr],
1510
 
                *sneip = (struct stats_net_eicmp *) a->buf[!curr];
1511
 
        int pt_newlin
1512
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1513
 
        
1514
 
        render(isdb, pre, PT_NOFLAG,
1515
 
               "-\tierr/s", NULL, NULL,
1516
 
               NOVAL,
1517
 
               S_VALUE(sneip->InErrors, sneic->InErrors, itv));
1518
 
 
1519
 
        render(isdb, pre, PT_NOFLAG,
1520
 
               "-\toerr/s", NULL, NULL,
1521
 
               NOVAL,
1522
 
               S_VALUE(sneip->OutErrors, sneic->OutErrors, itv));
1523
 
        
1524
 
        render(isdb, pre, PT_NOFLAG,
1525
 
               "-\tidstunr/s", NULL, NULL,
1526
 
               NOVAL,
1527
 
               S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv));
1528
 
 
1529
 
        render(isdb, pre, PT_NOFLAG,
1530
 
               "-\todstunr/s", NULL, NULL,
1531
 
               NOVAL,
1532
 
               S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv));
1533
 
 
1534
 
        render(isdb, pre, PT_NOFLAG,
1535
 
               "-\titmex/s", NULL, NULL,
1536
 
               NOVAL,
1537
 
               S_VALUE(sneip->InTimeExcds, sneic->InTimeExcds, itv));
1538
 
 
1539
 
        render(isdb, pre, PT_NOFLAG,
1540
 
               "-\totmex/s", NULL, NULL,
1541
 
               NOVAL,
1542
 
               S_VALUE(sneip->OutTimeExcds, sneic->OutTimeExcds, itv));
1543
 
 
1544
 
        render(isdb, pre, PT_NOFLAG,
1545
 
               "-\tiparmpb/s", NULL, NULL,
1546
 
               NOVAL,
1547
 
               S_VALUE(sneip->InParmProbs, sneic->InParmProbs, itv));
1548
 
        
1549
 
        render(isdb, pre, PT_NOFLAG,
1550
 
               "-\toparmpb/s", NULL, NULL,
1551
 
               NOVAL,
1552
 
               S_VALUE(sneip->OutParmProbs, sneic->OutParmProbs, itv));
1553
 
 
1554
 
        render(isdb, pre, PT_NOFLAG,
1555
 
               "-\tisrcq/s", NULL, NULL,
1556
 
               NOVAL,
1557
 
               S_VALUE(sneip->InSrcQuenchs, sneic->InSrcQuenchs, itv));
1558
 
 
1559
 
        render(isdb, pre, PT_NOFLAG,
1560
 
               "-\tosrcq/s", NULL, NULL,
1561
 
               NOVAL,
1562
 
               S_VALUE(sneip->OutSrcQuenchs, sneic->OutSrcQuenchs, itv));
1563
 
 
1564
 
        render(isdb, pre, PT_NOFLAG,
1565
 
               "-\tiredir/s", NULL, NULL,
1566
 
               NOVAL,
1567
 
               S_VALUE(sneip->InRedirects, sneic->InRedirects, itv));
1568
 
 
1569
 
        render(isdb, pre, pt_newlin,
1570
 
               "-\toredir/s", NULL, NULL,
1571
 
               NOVAL,
1572
 
               S_VALUE(sneip->OutRedirects, sneic->OutRedirects, itv));
1573
 
}
1574
 
 
1575
 
/*
1576
 
 ***************************************************************************
1577
 
 * Display TCP network statistics in selected format.
1578
 
 *
1579
 
 * IN:
1580
 
 * @a           Activity structure with statistics.
1581
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1582
 
 * @pre         Prefix string for output entries
1583
 
 * @curr        Index in array for current sample statistics.
1584
 
 * @itv         Interval of time in jiffies.
1585
 
 ***************************************************************************
1586
 
 */
1587
 
__print_funct_t render_net_tcp_stats(struct activity *a, int isdb, char *pre,
1588
 
                                     int curr, unsigned long long itv)
1589
 
{
1590
 
        struct stats_net_tcp
1591
 
                *sntc = (struct stats_net_tcp *) a->buf[curr],
1592
 
                *sntp = (struct stats_net_tcp *) a->buf[!curr];
1593
 
        int pt_newlin
1594
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1595
 
        
1596
 
        render(isdb, pre, PT_NOFLAG,
1597
 
               "-\tactive/s", NULL, NULL,
1598
 
               NOVAL,
1599
 
               S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv));
1600
 
 
1601
 
        render(isdb, pre, PT_NOFLAG,
1602
 
               "-\tpassive/s", NULL, NULL,
1603
 
               NOVAL,
1604
 
               S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv));
1605
 
 
1606
 
        render(isdb, pre, PT_NOFLAG,
1607
 
               "-\tiseg/s", NULL, NULL,
1608
 
               NOVAL,
1609
 
               S_VALUE(sntp->InSegs, sntc->InSegs, itv));
1610
 
 
1611
 
        render(isdb, pre, pt_newlin,
1612
 
               "-\toseg/s", NULL, NULL,
1613
 
               NOVAL,
1614
 
               S_VALUE(sntp->OutSegs, sntc->OutSegs, itv));
1615
 
}
1616
 
 
1617
 
/*
1618
 
 ***************************************************************************
1619
 
 * Display TCP network error statistics in selected format.
1620
 
 *
1621
 
 * IN:
1622
 
 * @a           Activity structure with statistics.
1623
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1624
 
 * @pre         Prefix string for output entries
1625
 
 * @curr        Index in array for current sample statistics.
1626
 
 * @itv         Interval of time in jiffies.
1627
 
 ***************************************************************************
1628
 
 */
1629
 
__print_funct_t render_net_etcp_stats(struct activity *a, int isdb, char *pre,
1630
 
                                      int curr, unsigned long long itv)
1631
 
{
1632
 
        struct stats_net_etcp
1633
 
                *snetc = (struct stats_net_etcp *) a->buf[curr],
1634
 
                *snetp = (struct stats_net_etcp *) a->buf[!curr];
1635
 
        int pt_newlin
1636
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1637
 
        
1638
 
        render(isdb, pre, PT_NOFLAG,
1639
 
               "-\tatmptf/s", NULL, NULL,
1640
 
               NOVAL,
1641
 
               S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv));
1642
 
        
1643
 
        render(isdb, pre, PT_NOFLAG,
1644
 
               "-\testres/s", NULL, NULL,
1645
 
               NOVAL,
1646
 
               S_VALUE(snetp->EstabResets, snetc->EstabResets, itv));
1647
 
        
1648
 
        render(isdb, pre, PT_NOFLAG,
1649
 
               "-\tretrans/s", NULL, NULL,
1650
 
               NOVAL,
1651
 
               S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv));
1652
 
 
1653
 
        render(isdb, pre, PT_NOFLAG,
1654
 
               "-\tisegerr/s", NULL, NULL,
1655
 
               NOVAL,
1656
 
               S_VALUE(snetp->InErrs, snetc->InErrs, itv));
1657
 
 
1658
 
        render(isdb, pre, pt_newlin,
1659
 
               "-\torsts/s", NULL, NULL,
1660
 
               NOVAL,
1661
 
               S_VALUE(snetp->OutRsts, snetc->OutRsts, itv));
1662
 
}
1663
 
 
1664
 
/*
1665
 
 ***************************************************************************
1666
 
 * Display UDP network statistics in selected format.
1667
 
 *
1668
 
 * IN:
1669
 
 * @a           Activity structure with statistics.
1670
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1671
 
 * @pre         Prefix string for output entries
1672
 
 * @curr        Index in array for current sample statistics.
1673
 
 * @itv         Interval of time in jiffies.
1674
 
 ***************************************************************************
1675
 
 */
1676
 
__print_funct_t render_net_udp_stats(struct activity *a, int isdb, char *pre,
1677
 
                                     int curr, unsigned long long itv)
1678
 
{
1679
 
        struct stats_net_udp
1680
 
                *snuc = (struct stats_net_udp *) a->buf[curr],
1681
 
                *snup = (struct stats_net_udp *) a->buf[!curr];
1682
 
        int pt_newlin
1683
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1684
 
        
1685
 
        render(isdb, pre, PT_NOFLAG,
1686
 
               "-\tidgm/s", NULL, NULL,
1687
 
               NOVAL,
1688
 
               S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv));
1689
 
 
1690
 
        render(isdb, pre, PT_NOFLAG,
1691
 
               "-\todgm/s", NULL, NULL,
1692
 
               NOVAL,
1693
 
               S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv));
1694
 
 
1695
 
        render(isdb, pre, PT_NOFLAG,
1696
 
               "-\tnoport/s", NULL, NULL,
1697
 
               NOVAL,
1698
 
               S_VALUE(snup->NoPorts, snuc->NoPorts, itv));
1699
 
 
1700
 
        render(isdb, pre, pt_newlin,
1701
 
               "-\tidgmerr/s", NULL, NULL,
1702
 
               NOVAL,
1703
 
               S_VALUE(snup->InErrors, snuc->InErrors, itv));
1704
 
}
1705
 
 
1706
 
/*
1707
 
 ***************************************************************************
1708
 
 * Display IPv6 network sockets statistics in selected format.
1709
 
 *
1710
 
 * IN:
1711
 
 * @a           Activity structure with statistics.
1712
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1713
 
 * @pre         Prefix string for output entries
1714
 
 * @curr        Index in array for current sample statistics.
1715
 
 * @itv         Interval of time in jiffies.
1716
 
 ***************************************************************************
1717
 
 */
1718
 
__print_funct_t render_net_sock6_stats(struct activity *a, int isdb, char *pre,
1719
 
                                       int curr, unsigned long long itv)
1720
 
{
1721
 
        struct stats_net_sock6
1722
 
                *snsc = (struct stats_net_sock6 *) a->buf[curr];
1723
 
        int pt_newlin
1724
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1725
 
 
1726
 
        render(isdb, pre, PT_USEINT,
1727
 
               "-\ttcp6sck", NULL, NULL,
1728
 
               snsc->tcp6_inuse, DNOVAL);
1729
 
 
1730
 
        render(isdb, pre, PT_USEINT,
1731
 
               "-\tudp6sck",  NULL, NULL,
1732
 
               snsc->udp6_inuse, DNOVAL);
1733
 
 
1734
 
        render(isdb, pre, PT_USEINT,
1735
 
               "-\traw6sck", NULL, NULL,
1736
 
               snsc->raw6_inuse, DNOVAL);
1737
 
 
1738
 
        render(isdb, pre, PT_USEINT | pt_newlin,
1739
 
               "-\tip6-frag", NULL, NULL,
1740
 
               snsc->frag6_inuse, DNOVAL);
1741
 
}
1742
 
 
1743
 
/*
1744
 
 ***************************************************************************
1745
 
 * Display IPv6 network statistics in selected format.
1746
 
 *
1747
 
 * IN:
1748
 
 * @a           Activity structure with statistics.
1749
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1750
 
 * @pre         Prefix string for output entries
1751
 
 * @curr        Index in array for current sample statistics.
1752
 
 * @itv         Interval of time in jiffies.
1753
 
 ***************************************************************************
1754
 
 */
1755
 
__print_funct_t render_net_ip6_stats(struct activity *a, int isdb, char *pre,
1756
 
                                     int curr, unsigned long long itv)
1757
 
{
1758
 
        struct stats_net_ip6
1759
 
                *snic = (struct stats_net_ip6 *) a->buf[curr],
1760
 
                *snip = (struct stats_net_ip6 *) a->buf[!curr];
1761
 
        int pt_newlin
1762
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1763
 
        
1764
 
        render(isdb, pre, PT_NOFLAG,
1765
 
               "-\tirec6/s", NULL, NULL,
1766
 
               NOVAL,
1767
 
               S_VALUE(snip->InReceives6, snic->InReceives6, itv));
1768
 
 
1769
 
        render(isdb, pre, PT_NOFLAG,
1770
 
               "-\tfwddgm6/s", NULL, NULL,
1771
 
               NOVAL,
1772
 
               S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv));
1773
 
 
1774
 
        render(isdb, pre, PT_NOFLAG,
1775
 
               "-\tidel6/s", NULL, NULL,
1776
 
               NOVAL,
1777
 
               S_VALUE(snip->InDelivers6, snic->InDelivers6, itv));
1778
 
 
1779
 
        render(isdb, pre, PT_NOFLAG,
1780
 
               "-\torq6/s", NULL, NULL,
1781
 
               NOVAL,
1782
 
               S_VALUE(snip->OutRequests6, snic->OutRequests6, itv));
1783
 
 
1784
 
        render(isdb, pre, PT_NOFLAG,
1785
 
               "-\tasmrq6/s", NULL, NULL,
1786
 
               NOVAL,
1787
 
               S_VALUE(snip->ReasmReqds6, snic->ReasmReqds6, itv));
1788
 
 
1789
 
        render(isdb, pre, PT_NOFLAG,
1790
 
               "-\tasmok6/s", NULL, NULL,
1791
 
               NOVAL,
1792
 
               S_VALUE(snip->ReasmOKs6, snic->ReasmOKs6, itv));
1793
 
 
1794
 
        render(isdb, pre, PT_NOFLAG,
1795
 
               "-\timcpck6/s", NULL, NULL,
1796
 
               NOVAL,
1797
 
               S_VALUE(snip->InMcastPkts6, snic->InMcastPkts6, itv));
1798
 
 
1799
 
        render(isdb, pre, PT_NOFLAG,
1800
 
               "-\tomcpck6/s", NULL, NULL,
1801
 
               NOVAL,
1802
 
               S_VALUE(snip->OutMcastPkts6, snic->OutMcastPkts6, itv));
1803
 
        
1804
 
        render(isdb, pre, PT_NOFLAG,
1805
 
               "-\tfragok6/s", NULL, NULL,
1806
 
               NOVAL,
1807
 
               S_VALUE(snip->FragOKs6, snic->FragOKs6, itv));
1808
 
 
1809
 
        render(isdb, pre, pt_newlin,
1810
 
               "-\tfragcr6/s", NULL, NULL,
1811
 
               NOVAL,
1812
 
               S_VALUE(snip->FragCreates6, snic->FragCreates6, itv));
1813
 
}
1814
 
 
1815
 
/*
1816
 
 ***************************************************************************
1817
 
 * Display IPv6 network error statistics in selected format.
1818
 
 *
1819
 
 * IN:
1820
 
 * @a           Activity structure with statistics.
1821
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1822
 
 * @pre         Prefix string for output entries
1823
 
 * @curr        Index in array for current sample statistics.
1824
 
 * @itv         Interval of time in jiffies.
1825
 
 ***************************************************************************
1826
 
 */
1827
 
__print_funct_t render_net_eip6_stats(struct activity *a, int isdb, char *pre,
1828
 
                                      int curr, unsigned long long itv)
1829
 
{
1830
 
        struct stats_net_eip6
1831
 
                *sneic = (struct stats_net_eip6 *) a->buf[curr],
1832
 
                *sneip = (struct stats_net_eip6 *) a->buf[!curr];
1833
 
        int pt_newlin
1834
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1835
 
        
1836
 
        render(isdb, pre, PT_NOFLAG,
1837
 
               "-\tihdrer6/s", NULL, NULL,
1838
 
               NOVAL,
1839
 
               S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv));
1840
 
 
1841
 
        render(isdb, pre, PT_NOFLAG,
1842
 
               "-\tiadrer6/s", NULL, NULL,
1843
 
               NOVAL,
1844
 
               S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv));
1845
 
 
1846
 
        render(isdb, pre, PT_NOFLAG,
1847
 
               "-\tiukwnp6/s", NULL, NULL,
1848
 
               NOVAL,
1849
 
               S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv));
1850
 
 
1851
 
        render(isdb, pre, PT_NOFLAG,
1852
 
               "-\ti2big6/s", NULL, NULL,
1853
 
               NOVAL,
1854
 
               S_VALUE(sneip->InTooBigErrors6, sneic->InTooBigErrors6, itv));
1855
 
 
1856
 
        render(isdb, pre, PT_NOFLAG,
1857
 
               "-\tidisc6/s", NULL, NULL,
1858
 
               NOVAL,
1859
 
               S_VALUE(sneip->InDiscards6, sneic->InDiscards6, itv));
1860
 
 
1861
 
        render(isdb, pre, PT_NOFLAG,
1862
 
               "-\todisc6/s", NULL, NULL,
1863
 
               NOVAL,
1864
 
               S_VALUE(sneip->OutDiscards6, sneic->OutDiscards6, itv));
1865
 
 
1866
 
        render(isdb, pre, PT_NOFLAG,
1867
 
               "-\tinort6/s", NULL, NULL,
1868
 
               NOVAL,
1869
 
               S_VALUE(sneip->InNoRoutes6, sneic->InNoRoutes6, itv));
1870
 
 
1871
 
        render(isdb, pre, PT_NOFLAG,
1872
 
               "-\tonort6/s", NULL, NULL,
1873
 
               NOVAL,
1874
 
               S_VALUE(sneip->OutNoRoutes6, sneic->OutNoRoutes6, itv));
1875
 
        
1876
 
        render(isdb, pre, PT_NOFLAG,
1877
 
               "-\tasmf6/s", NULL, NULL,
1878
 
               NOVAL,
1879
 
               S_VALUE(sneip->ReasmFails6, sneic->ReasmFails6, itv));
1880
 
 
1881
 
        render(isdb, pre, PT_NOFLAG,
1882
 
               "-\tfragf6/s", NULL, NULL,
1883
 
               NOVAL,
1884
 
               S_VALUE(sneip->FragFails6, sneic->FragFails6, itv));
1885
 
        
1886
 
        render(isdb, pre, pt_newlin,
1887
 
               "-\titrpck6/s", NULL, NULL,
1888
 
               NOVAL,
1889
 
               S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1890
 
}
1891
 
 
1892
 
/*
1893
 
 ***************************************************************************
1894
 
 * Display ICMPv6 network statistics in selected format.
1895
 
 *
1896
 
 * IN:
1897
 
 * @a           Activity structure with statistics.
1898
 
 * @isdb        Flag, true if db printing, false if ppc printing.
1899
 
 * @pre         Prefix string for output entries
1900
 
 * @curr        Index in array for current sample statistics.
1901
 
 * @itv         Interval of time in jiffies.
1902
 
 ***************************************************************************
1903
 
 */
1904
 
__print_funct_t render_net_icmp6_stats(struct activity *a, int isdb, char *pre,
1905
 
                                       int curr, unsigned long long itv)
1906
 
{
1907
 
        struct stats_net_icmp6
1908
 
                *snic = (struct stats_net_icmp6 *) a->buf[curr],
1909
 
                *snip = (struct stats_net_icmp6 *) a->buf[!curr];
1910
 
        int pt_newlin
1911
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
1912
 
        
1913
 
        render(isdb, pre, PT_NOFLAG,
1914
 
               "-\timsg6/s", NULL, NULL,
1915
 
               NOVAL,
1916
 
               S_VALUE(snip->InMsgs6, snic->InMsgs6, itv));
1917
 
 
1918
 
        render(isdb, pre, PT_NOFLAG,
1919
 
               "-\tomsg6/s", NULL, NULL,
1920
 
               NOVAL,
1921
 
               S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv));
1922
 
        
1923
 
        render(isdb, pre, PT_NOFLAG,
1924
 
               "-\tiech6/s", NULL, NULL,
1925
 
               NOVAL,
1926
 
               S_VALUE(snip->InEchos6, snic->InEchos6, itv));
1927
 
 
1928
 
        render(isdb, pre, PT_NOFLAG,
1929
 
               "-\tiechr6/s", NULL, NULL,
1930
 
               NOVAL,
1931
 
               S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv));
1932
 
 
1933
 
        render(isdb, pre, PT_NOFLAG,
1934
 
               "-\toechr6/s", NULL, NULL,
1935
 
               NOVAL,
1936
 
               S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv));
1937
 
 
1938
 
        render(isdb, pre, PT_NOFLAG,
1939
 
               "-\tigmbq6/s", NULL, NULL,
1940
 
               NOVAL,
1941
 
               S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv));
1942
 
 
1943
 
        render(isdb, pre, PT_NOFLAG,
1944
 
               "-\tigmbr6/s", NULL, NULL,
1945
 
               NOVAL,
1946
 
               S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv));
1947
 
 
1948
 
        render(isdb, pre, PT_NOFLAG,
1949
 
               "-\togmbr6/s", NULL, NULL,
1950
 
               NOVAL,
1951
 
               S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv));
1952
 
 
1953
 
        render(isdb, pre, PT_NOFLAG,
1954
 
               "-\tigmbrd6/s", NULL, NULL,
1955
 
               NOVAL,
1956
 
               S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv));
1957
 
 
1958
 
        render(isdb, pre, PT_NOFLAG,
1959
 
               "-\togmbrd6/s", NULL, NULL,
1960
 
               NOVAL,
1961
 
               S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv));
1962
 
 
1963
 
        render(isdb, pre, PT_NOFLAG,
1964
 
               "-\tirtsol6/s", NULL, NULL,
1965
 
               NOVAL,
1966
 
               S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv));
1967
 
 
1968
 
        render(isdb, pre, PT_NOFLAG,
1969
 
               "-\tortsol6/s", NULL, NULL,
1970
 
               NOVAL,
1971
 
               S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv));
1972
 
        
1973
 
        render(isdb, pre, PT_NOFLAG,
1974
 
               "-\tirtad6/s", NULL, NULL,
1975
 
               NOVAL,
1976
 
               S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv));
1977
 
 
1978
 
        render(isdb, pre, PT_NOFLAG,
1979
 
               "-\tinbsol6/s", NULL, NULL,
1980
 
               NOVAL,
1981
 
               S_VALUE(snip->InNeighborSolicits6, snic->InNeighborSolicits6, itv));
1982
 
 
1983
 
        render(isdb, pre, PT_NOFLAG,
1984
 
               "-\tonbsol6/s", NULL, NULL,
1985
 
               NOVAL,
1986
 
               S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv));
1987
 
        
1988
 
        render(isdb, pre, PT_NOFLAG,
1989
 
               "-\tinbad6/s", NULL, NULL,
1990
 
               NOVAL,
1991
 
               S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv));
1992
 
 
1993
 
        render(isdb, pre, pt_newlin,
1994
 
               "-\tonbad6/s", NULL, NULL,
1995
 
               NOVAL,
1996
 
               S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1997
 
}
1998
 
 
1999
 
/*
2000
 
 ***************************************************************************
2001
 
 * Display ICMPv6 error message 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_eicmp6_stats(struct activity *a, int isdb, char *pre,
2012
 
                                        int curr, unsigned long long itv)
2013
 
{
2014
 
        struct stats_net_eicmp6
2015
 
                *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
2016
 
                *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
2017
 
        int pt_newlin
2018
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2019
 
        
2020
 
        render(isdb, pre, PT_NOFLAG,
2021
 
               "-\tierr6/s", NULL, NULL,
2022
 
               NOVAL,
2023
 
               S_VALUE(sneip->InErrors6, sneic->InErrors6, itv));
2024
 
 
2025
 
        render(isdb, pre, PT_NOFLAG,
2026
 
               "-\tidtunr6/s", NULL, NULL,
2027
 
               NOVAL,
2028
 
               S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv));
2029
 
 
2030
 
        render(isdb, pre, PT_NOFLAG,
2031
 
               "-\todtunr6/s", NULL, NULL,
2032
 
               NOVAL,
2033
 
               S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv));
2034
 
 
2035
 
        render(isdb, pre, PT_NOFLAG,
2036
 
               "-\titmex6/s", NULL, NULL,
2037
 
               NOVAL,
2038
 
               S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv));
2039
 
 
2040
 
        render(isdb, pre, PT_NOFLAG,
2041
 
               "-\totmex6/s", NULL, NULL,
2042
 
               NOVAL,
2043
 
               S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv));
2044
 
 
2045
 
        render(isdb, pre, PT_NOFLAG,
2046
 
               "-\tiprmpb6/s", NULL, NULL,
2047
 
               NOVAL,
2048
 
               S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv));
2049
 
        
2050
 
        render(isdb, pre, PT_NOFLAG,
2051
 
               "-\toprmpb6/s", NULL, NULL,
2052
 
               NOVAL,
2053
 
               S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv));
2054
 
 
2055
 
        render(isdb, pre, PT_NOFLAG,
2056
 
               "-\tiredir6/s", NULL, NULL,
2057
 
               NOVAL,
2058
 
               S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv));
2059
 
 
2060
 
        render(isdb, pre, PT_NOFLAG,
2061
 
               "-\toredir6/s", NULL, NULL,
2062
 
               NOVAL,
2063
 
               S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv));
2064
 
 
2065
 
        render(isdb, pre, PT_NOFLAG,
2066
 
               "-\tipck2b6/s", NULL, NULL,
2067
 
               NOVAL,
2068
 
               S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv));
2069
 
 
2070
 
        render(isdb, pre, pt_newlin,
2071
 
               "-\topck2b6/s", NULL, NULL,
2072
 
               NOVAL,
2073
 
               S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv));
2074
 
}
2075
 
 
2076
 
/*
2077
 
 ***************************************************************************
2078
 
 * Display UDP6 network statistics in selected format.
2079
 
 *
2080
 
 * IN:
2081
 
 * @a           Activity structure with statistics.
2082
 
 * @isdb        Flag, true if db printing, false if ppc printing.
2083
 
 * @pre         Prefix string for output entries
2084
 
 * @curr        Index in array for current sample statistics.
2085
 
 * @itv         Interval of time in jiffies.
2086
 
 ***************************************************************************
2087
 
 */
2088
 
__print_funct_t render_net_udp6_stats(struct activity *a, int isdb, char *pre,
2089
 
                                      int curr, unsigned long long itv)
2090
 
{
2091
 
        struct stats_net_udp6
2092
 
                *snuc = (struct stats_net_udp6 *) a->buf[curr],
2093
 
                *snup = (struct stats_net_udp6 *) a->buf[!curr];
2094
 
        int pt_newlin
2095
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2096
 
        
2097
 
        render(isdb, pre, PT_NOFLAG,
2098
 
               "-\tidgm6/s", NULL, NULL,
2099
 
               NOVAL,
2100
 
               S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv));
2101
 
 
2102
 
        render(isdb, pre, PT_NOFLAG,
2103
 
               "-\todgm6/s", NULL, NULL,
2104
 
               NOVAL,
2105
 
               S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv));
2106
 
 
2107
 
        render(isdb, pre, PT_NOFLAG,
2108
 
               "-\tnoport6/s", NULL, NULL,
2109
 
               NOVAL,
2110
 
               S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv));
2111
 
 
2112
 
        render(isdb, pre, pt_newlin,
2113
 
               "-\tidgmer6/s", NULL, NULL,
2114
 
               NOVAL,
2115
 
               S_VALUE(snup->InErrors6, snuc->InErrors6, itv));
2116
 
}
2117
 
 
2118
 
/*
2119
 
 ***************************************************************************
2120
 
 * Display CPU frequency 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_pwr_cpufreq_stats(struct activity *a, int isdb, char *pre,
2131
 
                                         int curr, unsigned long long itv)
2132
 
{
2133
 
        int i;
2134
 
        struct stats_pwr_cpufreq *spc;
2135
 
        int pt_newlin
2136
 
                = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
2137
 
 
2138
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2139
 
                
2140
 
                spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
2141
 
 
2142
 
                /* Should current CPU (including CPU "all") be displayed? */
2143
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2144
 
                        
2145
 
                        if (!i) {
2146
 
                                /* This is CPU "all" */
2147
 
                                render(isdb, pre, pt_newlin,
2148
 
                                       "all\tMHz",
2149
 
                                       "-1", NULL,
2150
 
                                       NOVAL,
2151
 
                                       ((double) spc->cpufreq) / 100);
2152
 
                        }
2153
 
                        else {
2154
 
                                render(isdb, pre, pt_newlin,
2155
 
                                       "cpu%d\tMHz",
2156
 
                                       "%d", cons(iv, i - 1, NOVAL),
2157
 
                                       NOVAL,
2158
 
                                       ((double) spc->cpufreq) / 100);
2159
 
                        }
2160
 
                }
2161
 
        }
2162
 
}
2163
 
 
2164
 
/*
2165
 
 ***************************************************************************
2166
 
 * Print tabulations
2167
 
 *
2168
 
 * IN:
2169
 
 * @nr_tab      Number of tabs to print.
2170
 
 ***************************************************************************
2171
 
 */
2172
 
void prtab(int nr_tab)
2173
 
{
2174
 
        int i;
2175
 
 
2176
 
        for (i = 0; i < nr_tab; i++) {
2177
 
                printf("\t");
2178
 
        }
2179
 
}
2180
 
 
2181
 
/*
2182
 
 ***************************************************************************
2183
 
 * printf() function modified for XML display
2184
 
 *
2185
 
 * IN:
2186
 
 * @nr_tab      Number of tabs to print.
2187
 
 * @fmt         printf() format.
2188
 
 ***************************************************************************
2189
 
 */
2190
 
void xprintf(int nr_tab, const char *fmt, ...)
2191
 
{
2192
 
        static char buf[1024];
2193
 
        va_list args;
2194
 
 
2195
 
        va_start(args, fmt);
2196
 
        vsnprintf(buf, sizeof(buf), fmt, args);
2197
 
        va_end(args);
2198
 
 
2199
 
        prtab(nr_tab);
2200
 
        printf("%s\n", buf);
2201
 
}
2202
 
 
2203
 
/*
2204
 
 ***************************************************************************
2205
 
 * Open or close <network> markup.
2206
 
 *
2207
 
 * IN:
2208
 
 * @tab         Number of tabulations.
2209
 
 * @action      Open or close action.
2210
 
 ***************************************************************************
2211
 
 */
2212
 
void xml_markup_network(int tab, int action)
2213
 
{
2214
 
        static int markup_state = CLOSE_XML_MARKUP;
2215
 
 
2216
 
        if (action == markup_state)
2217
 
                return;
2218
 
        markup_state = action;
2219
 
 
2220
 
        if (action == OPEN_XML_MARKUP) {
2221
 
                /* Open markup */
2222
 
                xprintf(tab, "<network per=\"second\">");
2223
 
        }
2224
 
        else {
2225
 
                /* Close markup */
2226
 
                xprintf(tab, "</network>");
2227
 
        }
2228
 
}
2229
 
 
2230
 
/*
2231
 
 ***************************************************************************
2232
 
 * Open or close <power-management> markup.
2233
 
 *
2234
 
 * IN:
2235
 
 * @tab         Number of tabulations.
2236
 
 * @action      Open or close action.
2237
 
 ***************************************************************************
2238
 
 */
2239
 
void xml_markup_power_management(int tab, int action)
2240
 
{
2241
 
        static int markup_state = CLOSE_XML_MARKUP;
2242
 
 
2243
 
        if (action == markup_state)
2244
 
                return;
2245
 
        markup_state = action;
2246
 
 
2247
 
        if (action == OPEN_XML_MARKUP) {
2248
 
                /* Open markup */
2249
 
                xprintf(tab, "<power-management>");
2250
 
        }
2251
 
        else {
2252
 
                /* Close markup */
2253
 
                xprintf(tab, "</power-management>");
2254
 
        }
2255
 
}
2256
 
 
2257
 
/*
2258
 
 ***************************************************************************
2259
 
 * Display CPU statistics in XML.
2260
 
 *
2261
 
 * IN:
2262
 
 * @a           Activity structure with statistics.
2263
 
 * @curr        Index in array for current sample statistics.
2264
 
 * @tab         Indentation in XML output.
2265
 
 * @g_itv       Interval of time in jiffies mutliplied by the number of
2266
 
 *              processors.
2267
 
 ***************************************************************************
2268
 
 */
2269
 
__print_funct_t xml_print_cpu_stats(struct activity *a, int curr, int tab,
2270
 
                                    unsigned long long g_itv)
2271
 
{
2272
 
        int i;
2273
 
        struct stats_cpu *scc, *scp;
2274
 
        char cpuno[8];
2275
 
 
2276
 
        if (DISPLAY_CPU_DEF(a->opt_flags)) {
2277
 
                xprintf(tab++, "<cpu-load>");
2278
 
        }
2279
 
        else if (DISPLAY_CPU_ALL(a->opt_flags)) {
2280
 
                xprintf(tab++, "<cpu-load-all>");
2281
 
        }
2282
 
 
2283
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2284
 
                
2285
 
                scc = (struct stats_cpu *) ((char *) a->buf[curr]  + i * a->msize);
2286
 
                scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
2287
 
 
2288
 
                /* Should current CPU (including CPU "all") be displayed? */
2289
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2290
 
                        
2291
 
                        /* Yes: Display it */
2292
 
                        if (!i) {
2293
 
                                /* This is CPU "all" */
2294
 
                                strcpy(cpuno, "all");
2295
 
                        }
2296
 
                        else {
2297
 
                                sprintf(cpuno, "%d", i - 1);
2298
 
 
2299
 
                                /* Recalculate interval for current proc */
2300
 
                                g_itv = get_per_cpu_interval(scc, scp);
2301
 
                                
2302
 
                                if (!g_itv) {
2303
 
                                        /* Current CPU is offline */
2304
 
                                        if (DISPLAY_CPU_DEF(a->opt_flags)) {
2305
 
                                                xprintf(tab, "<cpu number=\"%d\" "
2306
 
                                                        "user=\"0.00\" "
2307
 
                                                        "nice=\"0.00\" "
2308
 
                                                        "system=\"0.00\" "
2309
 
                                                        "iowait=\"0.00\" "
2310
 
                                                        "steal=\"0.00\" "
2311
 
                                                        "idle=\"0.00\"/>",
2312
 
                                                        i - 1);
2313
 
                                        }
2314
 
                                        else if (DISPLAY_CPU_ALL(a->opt_flags)) {
2315
 
                                                xprintf(tab, "<cpu number=\"%d\" "
2316
 
                                                        "usr=\"0.00\" "
2317
 
                                                        "nice=\"0.00\" "
2318
 
                                                        "sys=\"0.00\" "
2319
 
                                                        "iowait=\"0.00\" "
2320
 
                                                        "steal=\"0.00\" "
2321
 
                                                        "irq=\"0.00\" "
2322
 
                                                        "soft=\"0.00\" "
2323
 
                                                        "guest=\"0.00\" "
2324
 
                                                        "idle=\"0.00\"/>",
2325
 
                                                        i - 1);
2326
 
                                        }
2327
 
                                        continue;
2328
 
                                }
2329
 
                        }
2330
 
 
2331
 
                        if (DISPLAY_CPU_DEF(a->opt_flags)) {
2332
 
                                xprintf(tab, "<cpu number=\"%s\" "
2333
 
                                        "user=\"%.2f\" "
2334
 
                                        "nice=\"%.2f\" "
2335
 
                                        "system=\"%.2f\" "
2336
 
                                        "iowait=\"%.2f\" "
2337
 
                                        "steal=\"%.2f\" "
2338
 
                                        "idle=\"%.2f\"/>",
2339
 
                                        cpuno,
2340
 
                                        ll_sp_value(scp->cpu_user,   scc->cpu_user,   g_itv),
2341
 
                                        ll_sp_value(scp->cpu_nice,   scc->cpu_nice,   g_itv),
2342
 
                                        ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
2343
 
                                                    scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
2344
 
                                                    g_itv),
2345
 
                                        ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
2346
 
                                        ll_sp_value(scp->cpu_steal,  scc->cpu_steal,  g_itv),
2347
 
                                        scc->cpu_idle < scp->cpu_idle ?
2348
 
                                        0.0 :
2349
 
                                        ll_sp_value(scp->cpu_idle,   scc->cpu_idle,   g_itv));
2350
 
                        }
2351
 
                        else if (DISPLAY_CPU_ALL(a->opt_flags)) {
2352
 
                                xprintf(tab, "<cpu number=\"%s\" "
2353
 
                                        "usr=\"%.2f\" "
2354
 
                                        "nice=\"%.2f\" "
2355
 
                                        "sys=\"%.2f\" "
2356
 
                                        "iowait=\"%.2f\" "
2357
 
                                        "steal=\"%.2f\" "
2358
 
                                        "irq=\"%.2f\" "
2359
 
                                        "soft=\"%.2f\" "
2360
 
                                        "guest=\"%.2f\" "
2361
 
                                        "idle=\"%.2f\"/>",
2362
 
                                        cpuno,
2363
 
                                        ll_sp_value(scp->cpu_user - scp->cpu_guest,
2364
 
                                                    scc->cpu_user - scc->cpu_guest,     g_itv),
2365
 
                                        ll_sp_value(scp->cpu_nice,    scc->cpu_nice,    g_itv),
2366
 
                                        ll_sp_value(scp->cpu_sys,     scc->cpu_sys,     g_itv),
2367
 
                                        ll_sp_value(scp->cpu_iowait,  scc->cpu_iowait,  g_itv),
2368
 
                                        ll_sp_value(scp->cpu_steal,   scc->cpu_steal,   g_itv),
2369
 
                                        ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
2370
 
                                        ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
2371
 
                                        ll_sp_value(scp->cpu_guest,   scc->cpu_guest,   g_itv),
2372
 
                                        scc->cpu_idle < scp->cpu_idle ?
2373
 
                                        0.0 :
2374
 
                                        ll_sp_value(scp->cpu_idle,   scc->cpu_idle,   g_itv));
2375
 
                        }
2376
 
                }
2377
 
        }
2378
 
 
2379
 
        if (DISPLAY_CPU_DEF(a->opt_flags)) {
2380
 
                xprintf(--tab, "</cpu-load>");
2381
 
        }
2382
 
        else if (DISPLAY_CPU_ALL(a->opt_flags)) {
2383
 
                xprintf(--tab, "</cpu-load-all>");
2384
 
        }
2385
 
}
2386
 
 
2387
 
/*
2388
 
 ***************************************************************************
2389
 
 * Display task creation and context switch statistics in XML.
2390
 
 *
2391
 
 * IN:
2392
 
 * @a           Activity structure with statistics.
2393
 
 * @curr        Index in array for current sample statistics.
2394
 
 * @tab         Indentation in XML output.
2395
 
 * @itv         Interval of time in jiffies.
2396
 
 ***************************************************************************
2397
 
 */
2398
 
__print_funct_t xml_print_pcsw_stats(struct activity *a, int curr, int tab,
2399
 
                                     unsigned long long itv)
2400
 
{
2401
 
        struct stats_pcsw
2402
 
                *spc = (struct stats_pcsw *) a->buf[curr],
2403
 
                *spp = (struct stats_pcsw *) a->buf[!curr];
2404
 
 
2405
 
        /* proc/s and cswch/s */
2406
 
        xprintf(tab, "<process-and-context-switch per=\"second\" "
2407
 
                "proc=\"%.2f\" "
2408
 
                "cswch=\"%.2f\"/>",
2409
 
                S_VALUE(spp->processes, spc->processes, itv),
2410
 
                ll_s_value(spp->context_switch, spc->context_switch, itv));
2411
 
}
2412
 
 
2413
 
/*
2414
 
 ***************************************************************************
2415
 
 * Display interrupts statistics in XML.
2416
 
 *
2417
 
 * IN:
2418
 
 * @a           Activity structure with statistics.
2419
 
 * @curr        Index in array for current sample statistics.
2420
 
 * @tab         Indentation in XML output.
2421
 
 * @itv         Interval of time in jiffies.
2422
 
 ***************************************************************************
2423
 
 */
2424
 
__print_funct_t xml_print_irq_stats(struct activity *a, int curr, int tab,
2425
 
                                    unsigned long long itv)
2426
 
{
2427
 
        int i;
2428
 
        struct stats_irq *sic, *sip;
2429
 
        char irqno[8];
2430
 
        
2431
 
        xprintf(tab++, "<interrupts>");
2432
 
        xprintf(tab++, "<int-global per=\"second\">");
2433
 
 
2434
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2435
 
 
2436
 
                sic = (struct stats_irq *) ((char *) a->buf[curr]  + i * a->msize);
2437
 
                sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
2438
 
                
2439
 
                /* Should current interrupt (including int "sum") be displayed? */
2440
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2441
 
                        
2442
 
                        /* Yes: Display it */
2443
 
                        if (!i) {
2444
 
                                /* This is interrupt "sum" */
2445
 
                                strcpy(irqno, "sum");
2446
 
                        }
2447
 
                        else {
2448
 
                                sprintf(irqno, "%d", i - 1);
2449
 
                        }
2450
 
 
2451
 
                        xprintf(tab, "<irq intr=\"%s\" value=\"%.2f\"/>", irqno,
2452
 
                                ll_s_value(sip->irq_nr, sic->irq_nr, itv));
2453
 
                }
2454
 
        }
2455
 
 
2456
 
        xprintf(--tab, "</int-global>");
2457
 
        xprintf(--tab, "</interrupts>");
2458
 
}
2459
 
 
2460
 
/*
2461
 
 ***************************************************************************
2462
 
 * Display swapping statistics in XML.
2463
 
 *
2464
 
 * IN:
2465
 
 * @a           Activity structure with statistics.
2466
 
 * @curr        Index in array for current sample statistics.
2467
 
 * @tab         Indentation in XML output.
2468
 
 * @itv         Interval of time in jiffies.
2469
 
 ***************************************************************************
2470
 
 */
2471
 
__print_funct_t xml_print_swap_stats(struct activity *a, int curr, int tab,
2472
 
                                     unsigned long long itv)
2473
 
{
2474
 
        struct stats_swap
2475
 
                *ssc = (struct stats_swap *) a->buf[curr],
2476
 
                *ssp = (struct stats_swap *) a->buf[!curr];
2477
 
        
2478
 
        xprintf(tab, "<swap-pages per=\"second\" "
2479
 
                "pswpin=\"%.2f\" "
2480
 
                "pswpout=\"%.2f\"/>",
2481
 
                S_VALUE(ssp->pswpin,  ssc->pswpin,  itv),
2482
 
                S_VALUE(ssp->pswpout, ssc->pswpout, itv));
2483
 
}
2484
 
 
2485
 
/*
2486
 
 ***************************************************************************
2487
 
 * Display paging statistics in XML.
2488
 
 *
2489
 
 * IN:
2490
 
 * @a           Activity structure with statistics.
2491
 
 * @curr        Index in array for current sample statistics.
2492
 
 * @tab         Indentation in XML output.
2493
 
 * @itv         Interval of time in jiffies.
2494
 
 ***************************************************************************
2495
 
 */
2496
 
__print_funct_t xml_print_paging_stats(struct activity *a, int curr, int tab,
2497
 
                                       unsigned long long itv)
2498
 
{
2499
 
        struct stats_paging
2500
 
                *spc = (struct stats_paging *) a->buf[curr],
2501
 
                *spp = (struct stats_paging *) a->buf[!curr];
2502
 
 
2503
 
        xprintf(tab, "<paging per=\"second\" "
2504
 
                "pgpgin=\"%.2f\" "
2505
 
                "pgpgout=\"%.2f\" "
2506
 
                "fault=\"%.2f\" "
2507
 
                "majflt=\"%.2f\" "
2508
 
                "pgfree=\"%.2f\" "
2509
 
                "pgscank=\"%.2f\" "
2510
 
                "pgscand=\"%.2f\" "
2511
 
                "pgsteal=\"%.2f\" "
2512
 
                "vmeff-percent=\"%.2f\"/>",
2513
 
               S_VALUE(spp->pgpgin,        spc->pgpgin,        itv),
2514
 
               S_VALUE(spp->pgpgout,       spc->pgpgout,       itv),
2515
 
               S_VALUE(spp->pgfault,       spc->pgfault,       itv),
2516
 
               S_VALUE(spp->pgmajfault,    spc->pgmajfault,    itv),
2517
 
               S_VALUE(spp->pgfree,        spc->pgfree,        itv),
2518
 
               S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
2519
 
               S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
2520
 
               S_VALUE(spp->pgsteal,       spc->pgsteal,       itv),
2521
 
               (spc->pgscan_kswapd + spc->pgscan_direct -
2522
 
                spp->pgscan_kswapd - spp->pgscan_direct) ?
2523
 
               SP_VALUE(spp->pgsteal, spc->pgsteal,
2524
 
                        spc->pgscan_kswapd + spc->pgscan_direct -
2525
 
                        spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
2526
 
}
2527
 
 
2528
 
/*
2529
 
 ***************************************************************************
2530
 
 * Display I/O and transfer rate statistics in XML.
2531
 
 *
2532
 
 * IN:
2533
 
 * @a           Activity structure with statistics.
2534
 
 * @curr        Index in array for current sample statistics.
2535
 
 * @tab         Indentation in XML output.
2536
 
 * @itv         Interval of time in jiffies.
2537
 
 ***************************************************************************
2538
 
 */
2539
 
__print_funct_t xml_print_io_stats(struct activity *a, int curr, int tab,
2540
 
                                   unsigned long long itv)
2541
 
{
2542
 
        struct stats_io
2543
 
                *sic = (struct stats_io *) a->buf[curr],
2544
 
                *sip = (struct stats_io *) a->buf[!curr];
2545
 
 
2546
 
        xprintf(tab, "<io per=\"second\">");
2547
 
 
2548
 
        xprintf(++tab, "<tps>%.2f</tps>",
2549
 
                S_VALUE(sip->dk_drive, sic->dk_drive, itv));
2550
 
        
2551
 
        xprintf(tab, "<io-reads rtps=\"%.2f\" bread=\"%.2f\"/>",
2552
 
                S_VALUE(sip->dk_drive_rio,  sic->dk_drive_rio,  itv),
2553
 
                S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv));
2554
 
        
2555
 
        xprintf(tab, "<io-writes wtps=\"%.2f\" bwrtn=\"%.2f\"/>",
2556
 
                S_VALUE(sip->dk_drive_wio,  sic->dk_drive_wio,  itv),
2557
 
                S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
2558
 
        
2559
 
        xprintf(--tab, "</io>");
2560
 
}
2561
 
 
2562
 
/*
2563
 
 ***************************************************************************
2564
 
 * Display memory statistics in XML.
2565
 
 *
2566
 
 * IN:
2567
 
 * @a           Activity structure with statistics.
2568
 
 * @curr        Index in array for current sample statistics.
2569
 
 * @tab         Indentation in XML output.
2570
 
 * @itv         Interval of time in jiffies.
2571
 
 ***************************************************************************
2572
 
 */
2573
 
__print_funct_t xml_print_memory_stats(struct activity *a, int curr, int tab,
2574
 
                                       unsigned long long itv)
2575
 
{
2576
 
        struct stats_memory
2577
 
                *smc = (struct stats_memory *) a->buf[curr],
2578
 
                *smp = (struct stats_memory *) a->buf[!curr];
2579
 
 
2580
 
        xprintf(tab, "<memory per=\"second\" unit=\"kB\">");
2581
 
        
2582
 
        if (DISPLAY_MEM_AMT(a->opt_flags)) {
2583
 
 
2584
 
                xprintf(++tab, "<memfree>%lu</memfree>",
2585
 
                        smc->frmkb);
2586
 
        
2587
 
                xprintf(tab, "<memused>%lu</memused>",
2588
 
                        smc->tlmkb - smc->frmkb);
2589
 
 
2590
 
                xprintf(tab, "<memused-percent>%.2f</memused-percent>",
2591
 
                        smc->tlmkb ?
2592
 
                        SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) :
2593
 
                        0.0);
2594
 
        
2595
 
                xprintf(tab, "<buffers>%lu</buffers>",
2596
 
                        smc->bufkb);
2597
 
        
2598
 
                xprintf(tab, "<cached>%lu</cached>",
2599
 
                        smc->camkb);
2600
 
 
2601
 
                xprintf(tab, "<commit>%lu</commit>",
2602
 
                        smc->comkb);
2603
 
 
2604
 
                xprintf(tab--, "<commit-percent>%.2f</commit-percent>",
2605
 
                        (smc->tlmkb + smc->tlskb) ?
2606
 
                        SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) :
2607
 
                        0.0);
2608
 
        }
2609
 
                
2610
 
        if (DISPLAY_SWAP(a->opt_flags)) {
2611
 
 
2612
 
                xprintf(++tab, "<swpfree>%lu</swpfree>",
2613
 
                        smc->frskb);
2614
 
        
2615
 
                xprintf(tab, "<swpused>%lu</swpused>",
2616
 
                        smc->tlskb - smc->frskb);
2617
 
        
2618
 
                xprintf(tab, "<swpused-percent>%.2f</swpused-percent>",
2619
 
                        smc->tlskb ?
2620
 
                        SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) :
2621
 
                        0.0);
2622
 
 
2623
 
                xprintf(tab, "<swpcad>%lu</swpcad>",
2624
 
                        smc->caskb);
2625
 
 
2626
 
                xprintf(tab--, "<swpcad-percent>%.2f</swpcad-percent>",
2627
 
                        (smc->tlskb - smc->frskb) ?
2628
 
                        SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) :
2629
 
                        0.0);
2630
 
        }
2631
 
 
2632
 
        if (DISPLAY_MEMORY(a->opt_flags)) {
2633
 
 
2634
 
                xprintf(++tab, "<frmpg>%.2f</frmpg>",
2635
 
                        S_VALUE((double) KB_TO_PG(smp->frmkb),
2636
 
                                (double) KB_TO_PG(smc->frmkb), itv));
2637
 
        
2638
 
                xprintf(tab, "<bufpg>%.2f</bufpg>",
2639
 
                        S_VALUE((double) KB_TO_PG(smp->bufkb),
2640
 
                                (double) KB_TO_PG(smc->bufkb), itv));
2641
 
        
2642
 
                xprintf(tab--, "<campg>%.2f</campg>",
2643
 
                        S_VALUE((double) KB_TO_PG(smp->camkb),
2644
 
                                (double) KB_TO_PG(smc->camkb), itv));
2645
 
        }
2646
 
 
2647
 
        xprintf(tab, "</memory>");
2648
 
}
2649
 
 
2650
 
/*
2651
 
 ***************************************************************************
2652
 
 * Display kernel tables statistics in XML.
2653
 
 *
2654
 
 * IN:
2655
 
 * @a           Activity structure with statistics.
2656
 
 * @curr        Index in array for current sample statistics.
2657
 
 * @tab         Indentation in XML output.
2658
 
 * @itv         Interval of time in jiffies.
2659
 
 ***************************************************************************
2660
 
 */
2661
 
__print_funct_t xml_print_ktables_stats(struct activity *a, int curr, int tab,
2662
 
                                        unsigned long long itv)
2663
 
{
2664
 
        struct stats_ktables
2665
 
                *skc = (struct stats_ktables *) a->buf[curr];
2666
 
        
2667
 
        xprintf(tab, "<kernel "
2668
 
                "dentunusd=\"%u\" "
2669
 
                "file-nr=\"%u\" "
2670
 
                "inode-nr=\"%u\" "
2671
 
                "pty-nr=\"%u\"/>",
2672
 
                skc->dentry_stat,
2673
 
                skc->file_used,
2674
 
                skc->inode_used,
2675
 
                skc->pty_nr);
2676
 
}
2677
 
 
2678
 
/*
2679
 
 ***************************************************************************
2680
 
 * Display queue and load statistics in XML.
2681
 
 *
2682
 
 * IN:
2683
 
 * @a           Activity structure with statistics.
2684
 
 * @curr        Index in array for current sample statistics.
2685
 
 * @tab         Indentation in XML output.
2686
 
 * @itv         Interval of time in jiffies.
2687
 
 ***************************************************************************
2688
 
 */
2689
 
__print_funct_t xml_print_queue_stats(struct activity *a, int curr, int tab,
2690
 
                                      unsigned long long itv)
2691
 
{
2692
 
        struct stats_queue
2693
 
                *sqc = (struct stats_queue *) a->buf[curr];
2694
 
        
2695
 
        xprintf(tab, "<queue "
2696
 
                "runq-sz=\"%lu\" "
2697
 
                "plist-sz=\"%u\" "
2698
 
                "ldavg-1=\"%.2f\" "
2699
 
                "ldavg-5=\"%.2f\" "
2700
 
                "ldavg-15=\"%.2f\"/>",
2701
 
                sqc->nr_running,
2702
 
                sqc->nr_threads,
2703
 
                (double) sqc->load_avg_1 / 100,
2704
 
                (double) sqc->load_avg_5 / 100,
2705
 
                (double) sqc->load_avg_15 / 100);
2706
 
}
2707
 
 
2708
 
/*
2709
 
 ***************************************************************************
2710
 
 * Display serial lines statistics in XML.
2711
 
 *
2712
 
 * IN:
2713
 
 * @a           Activity structure with statistics.
2714
 
 * @curr        Index in array for current sample statistics.
2715
 
 * @tab         Indentation in XML output.
2716
 
 * @itv         Interval of time in jiffies.
2717
 
 ***************************************************************************
2718
 
 */
2719
 
__print_funct_t xml_print_serial_stats(struct activity *a, int curr, int tab,
2720
 
                                       unsigned long long itv)
2721
 
{
2722
 
        int i;
2723
 
        struct stats_serial *ssc, *ssp;
2724
 
 
2725
 
        xprintf(tab, "<serial per=\"second\">");
2726
 
        tab++;
2727
 
 
2728
 
        for (i = 0; i < a->nr; i++) {
2729
 
 
2730
 
                ssc = (struct stats_serial *) ((char *) a->buf[curr]  + i * a->msize);
2731
 
                ssp = (struct stats_serial *) ((char *) a->buf[!curr] + i * a->msize);
2732
 
 
2733
 
                if (ssc->line == 0)
2734
 
                        continue;
2735
 
 
2736
 
                if (ssc->line == ssp->line) {
2737
 
 
2738
 
                        xprintf(tab, "<tty line=\"%d\" "
2739
 
                                "rcvin=\"%.2f\" "
2740
 
                                "xmtin=\"%.2f\" "
2741
 
                                "framerr=\"%.2f\" "
2742
 
                                "prtyerr=\"%.2f\" "
2743
 
                                "brk=\"%.2f\" "
2744
 
                                "ovrun=\"%.2f\"/>",
2745
 
                                ssc->line - 1,
2746
 
                                S_VALUE(ssp->rx,      ssc->rx,      itv),
2747
 
                                S_VALUE(ssp->tx,      ssc->tx,      itv),
2748
 
                                S_VALUE(ssp->frame,   ssc->frame,   itv),
2749
 
                                S_VALUE(ssp->parity,  ssc->parity,  itv),
2750
 
                                S_VALUE(ssp->brk,     ssc->brk,     itv),
2751
 
                                S_VALUE(ssp->overrun, ssc->overrun, itv));
2752
 
                }
2753
 
        }
2754
 
 
2755
 
        xprintf(--tab, "</serial>");
2756
 
}
2757
 
 
2758
 
/*
2759
 
 ***************************************************************************
2760
 
 * Display disks statistics in XML.
2761
 
 *
2762
 
 * IN:
2763
 
 * @a           Activity structure with statistics.
2764
 
 * @curr        Index in array for current sample statistics.
2765
 
 * @tab         Indentation in XML output.
2766
 
 * @itv         Interval of time in jiffies.
2767
 
 ***************************************************************************
2768
 
 */
2769
 
__print_funct_t xml_print_disk_stats(struct activity *a, int curr, int tab,
2770
 
                                     unsigned long long itv)
2771
 
{
2772
 
        int i, j;
2773
 
        struct stats_disk *sdc, *sdp;
2774
 
        struct ext_disk_stats xds;
2775
 
        char *dev_name;
2776
 
 
2777
 
        xprintf(tab, "<disk per=\"second\">");
2778
 
        tab++;
2779
 
 
2780
 
        for (i = 0; i < a->nr; i++) {
2781
 
 
2782
 
                sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
2783
 
 
2784
 
                if (!(sdc->major + sdc->minor))
2785
 
                        continue;
2786
 
 
2787
 
                j = check_disk_reg(a, curr, !curr, i);
2788
 
                sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
2789
 
 
2790
 
                /* Compute extended statistics values */
2791
 
                compute_ext_disk_stats(sdc, sdp, itv, &xds);
2792
 
                
2793
 
                dev_name = NULL;
2794
 
 
2795
 
                if ((USE_PRETTY_OPTION(flags)) && (sdc->major == DEVMAP_MAJOR)) {
2796
 
                        dev_name = transform_devmapname(sdc->major, sdc->minor);
2797
 
                }
2798
 
 
2799
 
                if (!dev_name) {
2800
 
                        dev_name = get_devname(sdc->major, sdc->minor,
2801
 
                                               USE_PRETTY_OPTION(flags));
2802
 
                }
2803
 
 
2804
 
                xprintf(tab, "<disk-device dev=\"%s\" "
2805
 
                        "tps=\"%.2f\" "
2806
 
                        "rd_sec=\"%.2f\" "
2807
 
                        "wr_sec=\"%.2f\" "
2808
 
                        "avgrq-sz=\"%.2f\" "
2809
 
                        "avgqu-sz=\"%.2f\" "
2810
 
                        "await=\"%.2f\" "
2811
 
                        "svctm=\"%.2f\" "
2812
 
                        "util-percent=\"%.2f\"/>",
2813
 
                        /* Confusion possible here between index and minor numbers */
2814
 
                        dev_name,
2815
 
                        S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
2816
 
                        ll_s_value(sdp->rd_sect, sdc->rd_sect, itv),
2817
 
                        ll_s_value(sdp->wr_sect, sdc->wr_sect, itv),
2818
 
                        /* See iostat for explanations */
2819
 
                        xds.arqsz,
2820
 
                        S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
2821
 
                        xds.await,
2822
 
                        xds.svctm,
2823
 
                        xds.util / 10.0);
2824
 
        }
2825
 
 
2826
 
        xprintf(--tab, "</disk>");
2827
 
}
2828
 
 
2829
 
/*
2830
 
 ***************************************************************************
2831
 
 * Display network interfaces statistics in XML.
2832
 
 *
2833
 
 * IN:
2834
 
 * @a           Activity structure with statistics.
2835
 
 * @curr        Index in array for current sample statistics.
2836
 
 * @tab         Indentation in XML output.
2837
 
 * @itv         Interval of time in jiffies.
2838
 
 ***************************************************************************
2839
 
 */
2840
 
__print_funct_t xml_print_net_dev_stats(struct activity *a, int curr, int tab,
2841
 
                                        unsigned long long itv)
2842
 
{
2843
 
        int i, j;
2844
 
        struct stats_net_dev *sndc, *sndp;
2845
 
 
2846
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
2847
 
                goto close_xml_markup;
2848
 
 
2849
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
2850
 
        tab++;
2851
 
 
2852
 
        for (i = 0; i < a->nr; i++) {
2853
 
 
2854
 
                sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
2855
 
 
2856
 
                if (!strcmp(sndc->interface, ""))
2857
 
                        continue;
2858
 
                
2859
 
                j = check_net_dev_reg(a, curr, !curr, i);
2860
 
                sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
2861
 
 
2862
 
                xprintf(tab, "<net-dev iface=\"%s\" "
2863
 
                        "rxpck=\"%.2f\" "
2864
 
                        "txpck=\"%.2f\" "
2865
 
                        "rxkB=\"%.2f\" "
2866
 
                        "txkB=\"%.2f\" "
2867
 
                        "rxcmp=\"%.2f\" "
2868
 
                        "txcmp=\"%.2f\" "
2869
 
                        "rxmcst=\"%.2f\"/>",
2870
 
                        sndc->interface,
2871
 
                        S_VALUE(sndp->rx_packets,    sndc->rx_packets,    itv),
2872
 
                        S_VALUE(sndp->tx_packets,    sndc->tx_packets,    itv),
2873
 
                        S_VALUE(sndp->rx_bytes,      sndc->rx_bytes,      itv) / 1024,
2874
 
                        S_VALUE(sndp->tx_bytes,      sndc->tx_bytes,      itv) / 1024,
2875
 
                        S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
2876
 
                        S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
2877
 
                        S_VALUE(sndp->multicast,     sndc->multicast,     itv));
2878
 
        }
2879
 
        tab--;
2880
 
 
2881
 
close_xml_markup:
2882
 
        if (CLOSE_MARKUP(a->options)) {
2883
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
2884
 
        }
2885
 
}
2886
 
 
2887
 
/*
2888
 
 ***************************************************************************
2889
 
 * Display network interfaces error statistics in XML.
2890
 
 *
2891
 
 * IN:
2892
 
 * @a           Activity structure with statistics.
2893
 
 * @curr        Index in array for current sample statistics.
2894
 
 * @tab         Indentation in XML output.
2895
 
 * @itv         Interval of time in jiffies.
2896
 
 ***************************************************************************
2897
 
 */
2898
 
__print_funct_t xml_print_net_edev_stats(struct activity *a, int curr, int tab,
2899
 
                                         unsigned long long itv)
2900
 
{
2901
 
        int i, j;
2902
 
        struct stats_net_edev *snedc, *snedp;
2903
 
 
2904
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
2905
 
                goto close_xml_markup;
2906
 
 
2907
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
2908
 
        tab++;
2909
 
 
2910
 
        for (i = 0; i < a->nr; i++) {
2911
 
 
2912
 
                snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
2913
 
 
2914
 
                if (!strcmp(snedc->interface, ""))
2915
 
                        continue;
2916
 
                
2917
 
                j = check_net_edev_reg(a, curr, !curr, i);
2918
 
                snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
2919
 
 
2920
 
                xprintf(tab, "<net-edev iface=\"%s\" "
2921
 
                        "rxerr=\"%.2f\" "
2922
 
                        "txerr=\"%.2f\" "
2923
 
                        "coll=\"%.2f\" "
2924
 
                        "rxdrop=\"%.2f\" "
2925
 
                        "txdrop=\"%.2f\" "
2926
 
                        "txcarr=\"%.2f\" "
2927
 
                        "rxfram=\"%.2f\" "
2928
 
                        "rxfifo=\"%.2f\" "
2929
 
                        "txfifo=\"%.2f\"/>",
2930
 
                        snedc->interface,
2931
 
                        S_VALUE(snedp->rx_errors,         snedc->rx_errors,         itv),
2932
 
                        S_VALUE(snedp->tx_errors,         snedc->tx_errors,         itv),
2933
 
                        S_VALUE(snedp->collisions,        snedc->collisions,        itv),
2934
 
                        S_VALUE(snedp->rx_dropped,        snedc->rx_dropped,        itv),
2935
 
                        S_VALUE(snedp->tx_dropped,        snedc->tx_dropped,        itv),
2936
 
                        S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
2937
 
                        S_VALUE(snedp->rx_frame_errors,   snedc->rx_frame_errors,   itv),
2938
 
                        S_VALUE(snedp->rx_fifo_errors,    snedc->rx_fifo_errors,    itv),
2939
 
                        S_VALUE(snedp->tx_fifo_errors,    snedc->tx_fifo_errors,    itv));
2940
 
        }
2941
 
        tab--;
2942
 
 
2943
 
close_xml_markup:
2944
 
        if (CLOSE_MARKUP(a->options)) {
2945
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
2946
 
        }
2947
 
}
2948
 
 
2949
 
/*
2950
 
 ***************************************************************************
2951
 
 * Display NFS client statistics in XML.
2952
 
 *
2953
 
 * IN:
2954
 
 * @a           Activity structure with statistics.
2955
 
 * @curr        Index in array for current sample statistics.
2956
 
 * @tab         Indentation in XML output.
2957
 
 * @itv         Interval of time in jiffies.
2958
 
 ***************************************************************************
2959
 
 */
2960
 
__print_funct_t xml_print_net_nfs_stats(struct activity *a, int curr, int tab,
2961
 
                                        unsigned long long itv)
2962
 
{
2963
 
        struct stats_net_nfs
2964
 
                *snnc = (struct stats_net_nfs *) a->buf[curr],
2965
 
                *snnp = (struct stats_net_nfs *) a->buf[!curr];
2966
 
        
2967
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
2968
 
                goto close_xml_markup;
2969
 
 
2970
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
2971
 
        tab++;
2972
 
 
2973
 
        xprintf(tab, "<net-nfs "
2974
 
                "call=\"%.2f\" "
2975
 
                "retrans=\"%.2f\" "
2976
 
                "read=\"%.2f\" "
2977
 
                "write=\"%.2f\" "
2978
 
                "access=\"%.2f\" "
2979
 
                "getatt=\"%.2f\"/>",
2980
 
                S_VALUE(snnp->nfs_rpccnt,     snnc->nfs_rpccnt,     itv),
2981
 
                S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
2982
 
                S_VALUE(snnp->nfs_readcnt,    snnc->nfs_readcnt,    itv),
2983
 
                S_VALUE(snnp->nfs_writecnt,   snnc->nfs_writecnt,   itv),
2984
 
                S_VALUE(snnp->nfs_accesscnt,  snnc->nfs_accesscnt,  itv),
2985
 
                S_VALUE(snnp->nfs_getattcnt,  snnc->nfs_getattcnt,  itv));
2986
 
        tab--;
2987
 
 
2988
 
close_xml_markup:
2989
 
        if (CLOSE_MARKUP(a->options)) {
2990
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
2991
 
        }
2992
 
}
2993
 
 
2994
 
/*
2995
 
 ***************************************************************************
2996
 
 * Display NFS server statistics in XML.
2997
 
 *
2998
 
 * IN:
2999
 
 * @a           Activity structure with statistics.
3000
 
 * @curr        Index in array for current sample statistics.
3001
 
 * @tab         Indentation in XML output.
3002
 
 * @itv         Interval of time in jiffies.
3003
 
 ***************************************************************************
3004
 
 */
3005
 
__print_funct_t xml_print_net_nfsd_stats(struct activity *a, int curr, int tab,
3006
 
                                         unsigned long long itv)
3007
 
{
3008
 
        struct stats_net_nfsd
3009
 
                *snndc = (struct stats_net_nfsd *) a->buf[curr],
3010
 
                *snndp = (struct stats_net_nfsd *) a->buf[!curr];
3011
 
 
3012
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3013
 
                goto close_xml_markup;
3014
 
 
3015
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3016
 
        tab++;
3017
 
 
3018
 
        xprintf(tab, "<net-nfsd "
3019
 
                "scall=\"%.2f\" "
3020
 
                "badcall=\"%.2f\" "
3021
 
                "packet=\"%.2f\" "
3022
 
                "udp=\"%.2f\" "
3023
 
                "tcp=\"%.2f\" "
3024
 
                "hit=\"%.2f\" "
3025
 
                "miss=\"%.2f\" "
3026
 
                "sread=\"%.2f\" "
3027
 
                "swrite=\"%.2f\" "
3028
 
                "saccess=\"%.2f\" "
3029
 
                "sgetatt=\"%.2f\"/>",
3030
 
                S_VALUE(snndp->nfsd_rpccnt,    snndc->nfsd_rpccnt,    itv),
3031
 
                S_VALUE(snndp->nfsd_rpcbad,    snndc->nfsd_rpcbad,    itv),
3032
 
                S_VALUE(snndp->nfsd_netcnt,    snndc->nfsd_netcnt,    itv),
3033
 
                S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
3034
 
                S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
3035
 
                S_VALUE(snndp->nfsd_rchits,    snndc->nfsd_rchits,    itv),
3036
 
                S_VALUE(snndp->nfsd_rcmisses,  snndc->nfsd_rcmisses,  itv),
3037
 
                S_VALUE(snndp->nfsd_readcnt,   snndc->nfsd_readcnt,   itv),
3038
 
                S_VALUE(snndp->nfsd_writecnt,  snndc->nfsd_writecnt,  itv),
3039
 
                S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
3040
 
                S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
3041
 
        tab--;
3042
 
 
3043
 
close_xml_markup:
3044
 
        if (CLOSE_MARKUP(a->options)) {
3045
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3046
 
        }
3047
 
}
3048
 
 
3049
 
/*
3050
 
 ***************************************************************************
3051
 
 * Display network socket statistics in XML.
3052
 
 *
3053
 
 * IN:
3054
 
 * @a           Activity structure with statistics.
3055
 
 * @curr        Index in array for current sample statistics.
3056
 
 * @tab         Indentation in XML output.
3057
 
 * @itv         Interval of time in jiffies.
3058
 
 ***************************************************************************
3059
 
 */
3060
 
__print_funct_t xml_print_net_sock_stats(struct activity *a, int curr, int tab,
3061
 
                                         unsigned long long itv)
3062
 
{
3063
 
        struct stats_net_sock
3064
 
                *snsc = (struct stats_net_sock *) a->buf[curr];
3065
 
        
3066
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3067
 
                goto close_xml_markup;
3068
 
 
3069
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3070
 
        tab++;
3071
 
 
3072
 
        xprintf(tab, "<net-sock "
3073
 
                "totsck=\"%u\" "
3074
 
                "tcpsck=\"%u\" "
3075
 
                "udpsck=\"%u\" "
3076
 
                "rawsck=\"%u\" "
3077
 
                "ip-frag=\"%u\" "
3078
 
                "tcp-tw=\"%u\"/>",
3079
 
                snsc->sock_inuse,
3080
 
                snsc->tcp_inuse,
3081
 
                snsc->udp_inuse,
3082
 
                snsc->raw_inuse,
3083
 
                snsc->frag_inuse,
3084
 
                snsc->tcp_tw);
3085
 
        tab--;
3086
 
 
3087
 
close_xml_markup:
3088
 
        if (CLOSE_MARKUP(a->options)) {
3089
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3090
 
        }
3091
 
}
3092
 
 
3093
 
/*
3094
 
 ***************************************************************************
3095
 
 * Display IP network statistics in XML.
3096
 
 *
3097
 
 * IN:
3098
 
 * @a           Activity structure with statistics.
3099
 
 * @curr        Index in array for current sample statistics.
3100
 
 * @tab         Indentation in XML output.
3101
 
 * @itv         Interval of time in jiffies.
3102
 
 ***************************************************************************
3103
 
 */
3104
 
__print_funct_t xml_print_net_ip_stats(struct activity *a, int curr, int tab,
3105
 
                                       unsigned long long itv)
3106
 
{
3107
 
        struct stats_net_ip
3108
 
                *snic = (struct stats_net_ip *) a->buf[curr],
3109
 
                *snip = (struct stats_net_ip *) a->buf[!curr];
3110
 
        
3111
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3112
 
                goto close_xml_markup;
3113
 
 
3114
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3115
 
        tab++;
3116
 
 
3117
 
        xprintf(tab, "<net-ip "
3118
 
                "irec=\"%.2f\" "
3119
 
                "fwddgm=\"%.2f\" "
3120
 
                "idel=\"%.2f\" "
3121
 
                "orq=\"%.2f\" "
3122
 
                "asmrq=\"%.2f\" "
3123
 
                "asmok=\"%.2f\" "
3124
 
                "fragok=\"%.2f\" "
3125
 
                "fragcrt=\"%.2f\"/>",
3126
 
                S_VALUE(snip->InReceives,    snic->InReceives,    itv),
3127
 
                S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
3128
 
                S_VALUE(snip->InDelivers,    snic->InDelivers,    itv),
3129
 
                S_VALUE(snip->OutRequests,   snic->OutRequests,   itv),
3130
 
                S_VALUE(snip->ReasmReqds,    snic->ReasmReqds,    itv),
3131
 
                S_VALUE(snip->ReasmOKs,      snic->ReasmOKs,      itv),
3132
 
                S_VALUE(snip->FragOKs,       snic->FragOKs,       itv),
3133
 
                S_VALUE(snip->FragCreates,   snic->FragCreates,   itv));
3134
 
        tab--;
3135
 
 
3136
 
close_xml_markup:
3137
 
        if (CLOSE_MARKUP(a->options)) {
3138
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3139
 
        }
3140
 
}
3141
 
 
3142
 
/*
3143
 
 ***************************************************************************
3144
 
 * Display IP network error statistics in XML.
3145
 
 *
3146
 
 * IN:
3147
 
 * @a           Activity structure with statistics.
3148
 
 * @curr        Index in array for current sample statistics.
3149
 
 * @tab         Indentation in XML output.
3150
 
 * @itv         Interval of time in jiffies.
3151
 
 ***************************************************************************
3152
 
 */
3153
 
__print_funct_t xml_print_net_eip_stats(struct activity *a, int curr, int tab,
3154
 
                                        unsigned long long itv)
3155
 
{
3156
 
        struct stats_net_eip
3157
 
                *sneic = (struct stats_net_eip *) a->buf[curr],
3158
 
                *sneip = (struct stats_net_eip *) a->buf[!curr];
3159
 
        
3160
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3161
 
                goto close_xml_markup;
3162
 
 
3163
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3164
 
        tab++;
3165
 
 
3166
 
        xprintf(tab, "<net-eip "
3167
 
                "ihdrerr=\"%.2f\" "
3168
 
                "iadrerr=\"%.2f\" "
3169
 
                "iukwnpr=\"%.2f\" "
3170
 
                "idisc=\"%.2f\" "
3171
 
                "odisc=\"%.2f\" "
3172
 
                "onort=\"%.2f\" "
3173
 
                "asmf=\"%.2f\" "
3174
 
                "fragf=\"%.2f\"/>",
3175
 
                S_VALUE(sneip->InHdrErrors,     sneic->InHdrErrors,     itv),
3176
 
                S_VALUE(sneip->InAddrErrors,    sneic->InAddrErrors,    itv),
3177
 
                S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
3178
 
                S_VALUE(sneip->InDiscards,      sneic->InDiscards,      itv),
3179
 
                S_VALUE(sneip->OutDiscards,     sneic->OutDiscards,     itv),
3180
 
                S_VALUE(sneip->OutNoRoutes,     sneic->OutNoRoutes,     itv),
3181
 
                S_VALUE(sneip->ReasmFails,      sneic->ReasmFails,      itv),
3182
 
                S_VALUE(sneip->FragFails,       sneic->FragFails,       itv));
3183
 
        tab--;
3184
 
 
3185
 
close_xml_markup:
3186
 
        if (CLOSE_MARKUP(a->options)) {
3187
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3188
 
        }
3189
 
}
3190
 
 
3191
 
/*
3192
 
 ***************************************************************************
3193
 
 * Display ICMP network statistics in XML.
3194
 
 *
3195
 
 * IN:
3196
 
 * @a           Activity structure with statistics.
3197
 
 * @curr        Index in array for current sample statistics.
3198
 
 * @tab         Indentation in XML output.
3199
 
 * @itv         Interval of time in jiffies.
3200
 
 ***************************************************************************
3201
 
 */
3202
 
__print_funct_t xml_print_net_icmp_stats(struct activity *a, int curr, int tab,
3203
 
                                         unsigned long long itv)
3204
 
{
3205
 
        struct stats_net_icmp
3206
 
                *snic = (struct stats_net_icmp *) a->buf[curr],
3207
 
                *snip = (struct stats_net_icmp *) a->buf[!curr];
3208
 
        
3209
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3210
 
                goto close_xml_markup;
3211
 
 
3212
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3213
 
        tab++;
3214
 
 
3215
 
        xprintf(tab, "<net-icmp "
3216
 
                "imsg=\"%.2f\" "
3217
 
                "omsg=\"%.2f\" "
3218
 
                "iech=\"%.2f\" "
3219
 
                "iechr=\"%.2f\" "
3220
 
                "oech=\"%.2f\" "
3221
 
                "oechr=\"%.2f\" "
3222
 
                "itm=\"%.2f\" "
3223
 
                "itmr=\"%.2f\" "
3224
 
                "otm=\"%.2f\" "
3225
 
                "otmr=\"%.2f\" "
3226
 
                "iadrmk=\"%.2f\" "
3227
 
                "iadrmkr=\"%.2f\" "
3228
 
                "oadrmk=\"%.2f\" "
3229
 
                "oadrmkr=\"%.2f\"/>",
3230
 
                S_VALUE(snip->InMsgs,           snic->InMsgs,           itv),
3231
 
                S_VALUE(snip->OutMsgs,          snic->OutMsgs,          itv),
3232
 
                S_VALUE(snip->InEchos,          snic->InEchos,          itv),
3233
 
                S_VALUE(snip->InEchoReps,       snic->InEchoReps,       itv),
3234
 
                S_VALUE(snip->OutEchos,         snic->OutEchos,         itv),
3235
 
                S_VALUE(snip->OutEchoReps,      snic->OutEchoReps,      itv),
3236
 
                S_VALUE(snip->InTimestamps,     snic->InTimestamps,     itv),
3237
 
                S_VALUE(snip->InTimestampReps,  snic->InTimestampReps,  itv),
3238
 
                S_VALUE(snip->OutTimestamps,    snic->OutTimestamps,    itv),
3239
 
                S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
3240
 
                S_VALUE(snip->InAddrMasks,      snic->InAddrMasks,      itv),
3241
 
                S_VALUE(snip->InAddrMaskReps,   snic->InAddrMaskReps,   itv),
3242
 
                S_VALUE(snip->OutAddrMasks,     snic->OutAddrMasks,     itv),
3243
 
                S_VALUE(snip->OutAddrMaskReps,  snic->OutAddrMaskReps,  itv));
3244
 
        tab--;
3245
 
 
3246
 
close_xml_markup:
3247
 
        if (CLOSE_MARKUP(a->options)) {
3248
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3249
 
        }
3250
 
}
3251
 
 
3252
 
/*
3253
 
 ***************************************************************************
3254
 
 * Display ICMP error message statistics in XML.
3255
 
 *
3256
 
 * IN:
3257
 
 * @a           Activity structure with statistics.
3258
 
 * @curr        Index in array for current sample statistics.
3259
 
 * @tab         Indentation in XML output.
3260
 
 * @itv         Interval of time in jiffies.
3261
 
 ***************************************************************************
3262
 
 */
3263
 
__print_funct_t xml_print_net_eicmp_stats(struct activity *a, int curr, int tab,
3264
 
                                          unsigned long long itv)
3265
 
{
3266
 
        struct stats_net_eicmp
3267
 
                *sneic = (struct stats_net_eicmp *) a->buf[curr],
3268
 
                *sneip = (struct stats_net_eicmp *) a->buf[!curr];
3269
 
        
3270
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3271
 
                goto close_xml_markup;
3272
 
 
3273
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3274
 
        tab++;
3275
 
 
3276
 
        xprintf(tab, "<net-eicmp "
3277
 
                "ierr=\"%.2f\" "
3278
 
                "oerr=\"%.2f\" "
3279
 
                "idstunr=\"%.2f\" "
3280
 
                "odstunr=\"%.2f\" "
3281
 
                "itmex=\"%.2f\" "
3282
 
                "otmex=\"%.2f\" "
3283
 
                "iparmpb=\"%.2f\" "
3284
 
                "oparmpb=\"%.2f\" "
3285
 
                "isrcq=\"%.2f\" "
3286
 
                "osrcq=\"%.2f\" "
3287
 
                "iredir=\"%.2f\" "
3288
 
                "oredir=\"%.2f\"/>",
3289
 
                S_VALUE(sneip->InErrors,        sneic->InErrors,        itv),
3290
 
                S_VALUE(sneip->OutErrors,       sneic->OutErrors,       itv),
3291
 
                S_VALUE(sneip->InDestUnreachs,  sneic->InDestUnreachs,  itv),
3292
 
                S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
3293
 
                S_VALUE(sneip->InTimeExcds,     sneic->InTimeExcds,     itv),
3294
 
                S_VALUE(sneip->OutTimeExcds,    sneic->OutTimeExcds,    itv),
3295
 
                S_VALUE(sneip->InParmProbs,     sneic->InParmProbs,     itv),
3296
 
                S_VALUE(sneip->OutParmProbs,    sneic->OutParmProbs,    itv),
3297
 
                S_VALUE(sneip->InSrcQuenchs,    sneic->InSrcQuenchs,    itv),
3298
 
                S_VALUE(sneip->OutSrcQuenchs,   sneic->OutSrcQuenchs,   itv),
3299
 
                S_VALUE(sneip->InRedirects,     sneic->InRedirects,     itv),
3300
 
                S_VALUE(sneip->OutRedirects,    sneic->OutRedirects,    itv));
3301
 
        tab--;
3302
 
 
3303
 
close_xml_markup:
3304
 
        if (CLOSE_MARKUP(a->options)) {
3305
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3306
 
        }
3307
 
}
3308
 
 
3309
 
/*
3310
 
 ***************************************************************************
3311
 
 * Display TCP network statistics in XML.
3312
 
 *
3313
 
 * IN:
3314
 
 * @a           Activity structure with statistics.
3315
 
 * @curr        Index in array for current sample statistics.
3316
 
 * @tab         Indentation in XML output.
3317
 
 * @itv         Interval of time in jiffies.
3318
 
 ***************************************************************************
3319
 
 */
3320
 
__print_funct_t xml_print_net_tcp_stats(struct activity *a, int curr, int tab,
3321
 
                                        unsigned long long itv)
3322
 
{
3323
 
        struct stats_net_tcp
3324
 
                *sntc = (struct stats_net_tcp *) a->buf[curr],
3325
 
                *sntp = (struct stats_net_tcp *) a->buf[!curr];
3326
 
        
3327
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3328
 
                goto close_xml_markup;
3329
 
 
3330
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3331
 
        tab++;
3332
 
 
3333
 
        xprintf(tab, "<net-tcp "
3334
 
                "active=\"%.2f\" "
3335
 
                "passive=\"%.2f\" "
3336
 
                "iseg=\"%.2f\" "
3337
 
                "oseg=\"%.2f\"/>",
3338
 
                S_VALUE(sntp->ActiveOpens,  sntc->ActiveOpens,  itv),
3339
 
                S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
3340
 
                S_VALUE(sntp->InSegs,       sntc->InSegs,       itv),
3341
 
                S_VALUE(sntp->OutSegs,      sntc->OutSegs,      itv));
3342
 
        tab--;
3343
 
 
3344
 
close_xml_markup:
3345
 
        if (CLOSE_MARKUP(a->options)) {
3346
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3347
 
        }
3348
 
}
3349
 
 
3350
 
/*
3351
 
 ***************************************************************************
3352
 
 * Display TCP network error statistics in XML.
3353
 
 *
3354
 
 * IN:
3355
 
 * @a           Activity structure with statistics.
3356
 
 * @curr        Index in array for current sample statistics.
3357
 
 * @tab         Indentation in XML output.
3358
 
 * @itv         Interval of time in jiffies.
3359
 
 ***************************************************************************
3360
 
 */
3361
 
__print_funct_t xml_print_net_etcp_stats(struct activity *a, int curr, int tab,
3362
 
                                         unsigned long long itv)
3363
 
{
3364
 
        struct stats_net_etcp
3365
 
                *snetc = (struct stats_net_etcp *) a->buf[curr],
3366
 
                *snetp = (struct stats_net_etcp *) a->buf[!curr];
3367
 
        
3368
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3369
 
                goto close_xml_markup;
3370
 
 
3371
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3372
 
        tab++;
3373
 
 
3374
 
        xprintf(tab, "<net-etcp "
3375
 
                "atmptf=\"%.2f\" "
3376
 
                "estres=\"%.2f\" "
3377
 
                "retrans=\"%.2f\" "
3378
 
                "isegerr=\"%.2f\" "
3379
 
                "orsts=\"%.2f\"/>",
3380
 
                S_VALUE(snetp->AttemptFails, snetc->AttemptFails,  itv),
3381
 
                S_VALUE(snetp->EstabResets,  snetc->EstabResets,  itv),
3382
 
                S_VALUE(snetp->RetransSegs,  snetc->RetransSegs,  itv),
3383
 
                S_VALUE(snetp->InErrs,       snetc->InErrs,  itv),
3384
 
                S_VALUE(snetp->OutRsts,      snetc->OutRsts,  itv));
3385
 
        tab--;
3386
 
 
3387
 
close_xml_markup:
3388
 
        if (CLOSE_MARKUP(a->options)) {
3389
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3390
 
        }
3391
 
}
3392
 
 
3393
 
/*
3394
 
 ***************************************************************************
3395
 
 * Display UDP network statistics in XML.
3396
 
 *
3397
 
 * IN:
3398
 
 * @a           Activity structure with statistics.
3399
 
 * @curr        Index in array for current sample statistics.
3400
 
 * @tab         Indentation in XML output.
3401
 
 * @itv         Interval of time in jiffies.
3402
 
 ***************************************************************************
3403
 
 */
3404
 
__print_funct_t xml_print_net_udp_stats(struct activity *a, int curr, int tab,
3405
 
                                        unsigned long long itv)
3406
 
{
3407
 
        struct stats_net_udp
3408
 
                *snuc = (struct stats_net_udp *) a->buf[curr],
3409
 
                *snup = (struct stats_net_udp *) a->buf[!curr];
3410
 
        
3411
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3412
 
                goto close_xml_markup;
3413
 
 
3414
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3415
 
        tab++;
3416
 
 
3417
 
        xprintf(tab, "<net-udp "
3418
 
                "idgm=\"%.2f\" "
3419
 
                "odgm=\"%.2f\" "
3420
 
                "noport=\"%.2f\" "
3421
 
                "idgmerr=\"%.2f\"/>",
3422
 
                S_VALUE(snup->InDatagrams,  snuc->InDatagrams,  itv),
3423
 
                S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
3424
 
                S_VALUE(snup->NoPorts,      snuc->NoPorts,      itv),
3425
 
                S_VALUE(snup->InErrors,     snuc->InErrors,     itv));
3426
 
        tab--;
3427
 
 
3428
 
close_xml_markup:
3429
 
        if (CLOSE_MARKUP(a->options)) {
3430
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3431
 
        }
3432
 
}
3433
 
 
3434
 
/*
3435
 
 ***************************************************************************
3436
 
 * Display IPv6 network socket statistics in XML.
3437
 
 *
3438
 
 * IN:
3439
 
 * @a           Activity structure with statistics.
3440
 
 * @curr        Index in array for current sample statistics.
3441
 
 * @tab         Indentation in XML output.
3442
 
 * @itv         Interval of time in jiffies.
3443
 
 ***************************************************************************
3444
 
 */
3445
 
__print_funct_t xml_print_net_sock6_stats(struct activity *a, int curr, int tab,
3446
 
                                          unsigned long long itv)
3447
 
{
3448
 
        struct stats_net_sock6
3449
 
                *snsc = (struct stats_net_sock6 *) a->buf[curr];
3450
 
        
3451
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3452
 
                goto close_xml_markup;
3453
 
 
3454
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3455
 
        tab++;
3456
 
 
3457
 
        xprintf(tab, "<net-sock6 "
3458
 
                "tcp6sck=\"%u\" "
3459
 
                "udp6sck=\"%u\" "
3460
 
                "raw6sck=\"%u\" "
3461
 
                "ip6-frag=\"%u\"/>",
3462
 
                snsc->tcp6_inuse,
3463
 
                snsc->udp6_inuse,
3464
 
                snsc->raw6_inuse,
3465
 
                snsc->frag6_inuse);
3466
 
        tab--;
3467
 
 
3468
 
close_xml_markup:
3469
 
        if (CLOSE_MARKUP(a->options)) {
3470
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3471
 
        }
3472
 
}
3473
 
 
3474
 
/*
3475
 
 ***************************************************************************
3476
 
 * Display IPv6 network statistics in XML.
3477
 
 *
3478
 
 * IN:
3479
 
 * @a           Activity structure with statistics.
3480
 
 * @curr        Index in array for current sample statistics.
3481
 
 * @tab         Indentation in XML output.
3482
 
 * @itv         Interval of time in jiffies.
3483
 
 ***************************************************************************
3484
 
 */
3485
 
__print_funct_t xml_print_net_ip6_stats(struct activity *a, int curr, int tab,
3486
 
                                        unsigned long long itv)
3487
 
{
3488
 
        struct stats_net_ip6
3489
 
                *snic = (struct stats_net_ip6 *) a->buf[curr],
3490
 
                *snip = (struct stats_net_ip6 *) a->buf[!curr];
3491
 
        
3492
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3493
 
                goto close_xml_markup;
3494
 
 
3495
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3496
 
        tab++;
3497
 
 
3498
 
        xprintf(tab, "<net-ip6 "
3499
 
                "irec6=\"%.2f\" "
3500
 
                "fwddgm6=\"%.2f\" "
3501
 
                "idel6=\"%.2f\" "
3502
 
                "orq6=\"%.2f\" "
3503
 
                "asmrq6=\"%.2f\" "
3504
 
                "asmok6=\"%.2f\" "
3505
 
                "imcpck6=\"%.2f\" "
3506
 
                "omcpck6=\"%.2f\" "
3507
 
                "fragok6=\"%.2f\" "
3508
 
                "fragcr6=\"%.2f\"/>",
3509
 
                S_VALUE(snip->InReceives6,       snic->InReceives6,       itv),
3510
 
                S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
3511
 
                S_VALUE(snip->InDelivers6,       snic->InDelivers6,       itv),
3512
 
                S_VALUE(snip->OutRequests6,      snic->OutRequests6,      itv),
3513
 
                S_VALUE(snip->ReasmReqds6,       snic->ReasmReqds6,       itv),
3514
 
                S_VALUE(snip->ReasmOKs6,         snic->ReasmOKs6,         itv),
3515
 
                S_VALUE(snip->InMcastPkts6,      snic->InMcastPkts6,      itv),
3516
 
                S_VALUE(snip->OutMcastPkts6,     snic->OutMcastPkts6,     itv),
3517
 
                S_VALUE(snip->FragOKs6,          snic->FragOKs6,          itv),
3518
 
                S_VALUE(snip->FragCreates6,      snic->FragCreates6,      itv));
3519
 
        tab--;
3520
 
 
3521
 
close_xml_markup:
3522
 
        if (CLOSE_MARKUP(a->options)) {
3523
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3524
 
        }
3525
 
}
3526
 
 
3527
 
/*
3528
 
 ***************************************************************************
3529
 
 * Display IPv6 network error statistics in XML.
3530
 
 *
3531
 
 * IN:
3532
 
 * @a           Activity structure with statistics.
3533
 
 * @curr        Index in array for current sample statistics.
3534
 
 * @tab         Indentation in XML output.
3535
 
 * @itv         Interval of time in jiffies.
3536
 
 ***************************************************************************
3537
 
 */
3538
 
__print_funct_t xml_print_net_eip6_stats(struct activity *a, int curr, int tab,
3539
 
                                         unsigned long long itv)
3540
 
{
3541
 
        struct stats_net_eip6
3542
 
                *sneic = (struct stats_net_eip6 *) a->buf[curr],
3543
 
                *sneip = (struct stats_net_eip6 *) a->buf[!curr];
3544
 
        
3545
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3546
 
                goto close_xml_markup;
3547
 
 
3548
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3549
 
        tab++;
3550
 
 
3551
 
        xprintf(tab, "<net-eip6 "
3552
 
                "ihdrer6=\"%.2f\" "
3553
 
                "iadrer6=\"%.2f\" "
3554
 
                "iukwnp6=\"%.2f\" "
3555
 
                "i2big6=\"%.2f\" "
3556
 
                "idisc6=\"%.2f\" "
3557
 
                "odisc6=\"%.2f\" "
3558
 
                "inort6=\"%.2f\" "
3559
 
                "onort6=\"%.2f\" "
3560
 
                "asmf6=\"%.2f\" "
3561
 
                "fragf6=\"%.2f\" "
3562
 
                "itrpck6=\"%.2f\"/>",
3563
 
                S_VALUE(sneip->InHdrErrors6,     sneic->InHdrErrors6,     itv),
3564
 
                S_VALUE(sneip->InAddrErrors6,    sneic->InAddrErrors6,    itv),
3565
 
                S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
3566
 
                S_VALUE(sneip->InTooBigErrors6,  sneic->InTooBigErrors6,  itv),
3567
 
                S_VALUE(sneip->InDiscards6,      sneic->InDiscards6,      itv),
3568
 
                S_VALUE(sneip->OutDiscards6,     sneic->OutDiscards6,     itv),
3569
 
                S_VALUE(sneip->InNoRoutes6,      sneic->InNoRoutes6,      itv),
3570
 
                S_VALUE(sneip->OutNoRoutes6,     sneic->OutNoRoutes6,     itv),
3571
 
                S_VALUE(sneip->ReasmFails6,      sneic->ReasmFails6,      itv),
3572
 
                S_VALUE(sneip->FragFails6,       sneic->FragFails6,       itv),
3573
 
                S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
3574
 
        tab--;
3575
 
 
3576
 
close_xml_markup:
3577
 
        if (CLOSE_MARKUP(a->options)) {
3578
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3579
 
        }
3580
 
}
3581
 
 
3582
 
/*
3583
 
 ***************************************************************************
3584
 
 * Display ICMPv6 network statistics in XML.
3585
 
 *
3586
 
 * IN:
3587
 
 * @a           Activity structure with statistics.
3588
 
 * @curr        Index in array for current sample statistics.
3589
 
 * @tab         Indentation in XML output.
3590
 
 * @itv         Interval of time in jiffies.
3591
 
 ***************************************************************************
3592
 
 */
3593
 
__print_funct_t xml_print_net_icmp6_stats(struct activity *a, int curr, int tab,
3594
 
                                          unsigned long long itv)
3595
 
{
3596
 
        struct stats_net_icmp6
3597
 
                *snic = (struct stats_net_icmp6 *) a->buf[curr],
3598
 
                *snip = (struct stats_net_icmp6 *) a->buf[!curr];
3599
 
        
3600
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3601
 
                goto close_xml_markup;
3602
 
 
3603
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3604
 
        tab++;
3605
 
 
3606
 
        xprintf(tab, "<net-icmp6 "
3607
 
                "imsg6=\"%.2f\" "
3608
 
                "omsg6=\"%.2f\" "
3609
 
                "iech6=\"%.2f\" "
3610
 
                "iechr6=\"%.2f\" "
3611
 
                "oechr6=\"%.2f\" "
3612
 
                "igmbq6=\"%.2f\" "
3613
 
                "igmbr6=\"%.2f\" "
3614
 
                "ogmbr6=\"%.2f\" "
3615
 
                "igmbrd6=\"%.2f\" "
3616
 
                "ogmbrd6=\"%.2f\" "
3617
 
                "irtsol6=\"%.2f\" "
3618
 
                "ortsol6=\"%.2f\" "
3619
 
                "irtad6=\"%.2f\" "
3620
 
                "inbsol6=\"%.2f\" "
3621
 
                "onbsol6=\"%.2f\" "
3622
 
                "inbad6=\"%.2f\" "
3623
 
                "onbad6=\"%.2f\"/>",
3624
 
                S_VALUE(snip->InMsgs6,                    snic->InMsgs6,                    itv),
3625
 
                S_VALUE(snip->OutMsgs6,                   snic->OutMsgs6,                   itv),
3626
 
                S_VALUE(snip->InEchos6,                   snic->InEchos6,                   itv),
3627
 
                S_VALUE(snip->InEchoReplies6,             snic->InEchoReplies6,             itv),
3628
 
                S_VALUE(snip->OutEchoReplies6,            snic->OutEchoReplies6,            itv),
3629
 
                S_VALUE(snip->InGroupMembQueries6,        snic->InGroupMembQueries6,        itv),
3630
 
                S_VALUE(snip->InGroupMembResponses6,      snic->InGroupMembResponses6,      itv),
3631
 
                S_VALUE(snip->OutGroupMembResponses6,     snic->OutGroupMembResponses6,     itv),
3632
 
                S_VALUE(snip->InGroupMembReductions6,     snic->InGroupMembReductions6,     itv),
3633
 
                S_VALUE(snip->OutGroupMembReductions6,    snic->OutGroupMembReductions6,    itv),
3634
 
                S_VALUE(snip->InRouterSolicits6,          snic->InRouterSolicits6,          itv),
3635
 
                S_VALUE(snip->OutRouterSolicits6,         snic->OutRouterSolicits6,         itv),
3636
 
                S_VALUE(snip->InRouterAdvertisements6,    snic->InRouterAdvertisements6,    itv),
3637
 
                S_VALUE(snip->InNeighborSolicits6,        snic->InNeighborSolicits6,        itv),
3638
 
                S_VALUE(snip->OutNeighborSolicits6,       snic->OutNeighborSolicits6,       itv),
3639
 
                S_VALUE(snip->InNeighborAdvertisements6,  snic->InNeighborAdvertisements6,  itv),
3640
 
                S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
3641
 
        tab--;
3642
 
 
3643
 
close_xml_markup:
3644
 
        if (CLOSE_MARKUP(a->options)) {
3645
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3646
 
        }
3647
 
}
3648
 
 
3649
 
/*
3650
 
 ***************************************************************************
3651
 
 * Display ICMPv6 error message statistics in XML.
3652
 
 *
3653
 
 * IN:
3654
 
 * @a           Activity structure with statistics.
3655
 
 * @curr        Index in array for current sample statistics.
3656
 
 * @tab         Indentation in XML output.
3657
 
 * @itv         Interval of time in jiffies.
3658
 
 ***************************************************************************
3659
 
 */
3660
 
__print_funct_t xml_print_net_eicmp6_stats(struct activity *a, int curr, int tab,
3661
 
                                           unsigned long long itv)
3662
 
{
3663
 
        struct stats_net_eicmp6
3664
 
                *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
3665
 
                *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
3666
 
        
3667
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3668
 
                goto close_xml_markup;
3669
 
 
3670
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3671
 
        tab++;
3672
 
 
3673
 
        xprintf(tab, "<net-eicmp6 "
3674
 
                "ierr6=\"%.2f\" "
3675
 
                "idtunr6=\"%.2f\" "
3676
 
                "odtunr6=\"%.2f\" "
3677
 
                "itmex6=\"%.2f\" "
3678
 
                "otmex6=\"%.2f\" "
3679
 
                "iprmpb6=\"%.2f\" "
3680
 
                "oprmpb6=\"%.2f\" "
3681
 
                "iredir6=\"%.2f\" "
3682
 
                "oredir6=\"%.2f\" "
3683
 
                "ipck2b6=\"%.2f\" "
3684
 
                "opck2b6=\"%.2f\"/>",
3685
 
                S_VALUE(sneip->InErrors6,        sneic->InErrors6,        itv),
3686
 
                S_VALUE(sneip->InDestUnreachs6,  sneic->InDestUnreachs6,  itv),
3687
 
                S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
3688
 
                S_VALUE(sneip->InTimeExcds6,     sneic->InTimeExcds6,     itv),
3689
 
                S_VALUE(sneip->OutTimeExcds6,    sneic->OutTimeExcds6,    itv),
3690
 
                S_VALUE(sneip->InParmProblems6,  sneic->InParmProblems6,  itv),
3691
 
                S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
3692
 
                S_VALUE(sneip->InRedirects6,     sneic->InRedirects6,     itv),
3693
 
                S_VALUE(sneip->OutRedirects6,    sneic->OutRedirects6,    itv),
3694
 
                S_VALUE(sneip->InPktTooBigs6,    sneic->InPktTooBigs6,    itv),
3695
 
                S_VALUE(sneip->OutPktTooBigs6,   sneic->OutPktTooBigs6,   itv));
3696
 
        tab--;
3697
 
 
3698
 
close_xml_markup:
3699
 
        if (CLOSE_MARKUP(a->options)) {
3700
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3701
 
        }
3702
 
}
3703
 
 
3704
 
/*
3705
 
 ***************************************************************************
3706
 
 * Display UDPv6 network statistics in XML.
3707
 
 *
3708
 
 * IN:
3709
 
 * @a           Activity structure with statistics.
3710
 
 * @curr        Index in array for current sample statistics.
3711
 
 * @tab         Indentation in XML output.
3712
 
 * @itv         Interval of time in jiffies.
3713
 
 ***************************************************************************
3714
 
 */
3715
 
__print_funct_t xml_print_net_udp6_stats(struct activity *a, int curr, int tab,
3716
 
                                         unsigned long long itv)
3717
 
{
3718
 
        struct stats_net_udp6
3719
 
                *snuc = (struct stats_net_udp6 *) a->buf[curr],
3720
 
                *snup = (struct stats_net_udp6 *) a->buf[!curr];
3721
 
        
3722
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3723
 
                goto close_xml_markup;
3724
 
 
3725
 
        xml_markup_network(tab, OPEN_XML_MARKUP);
3726
 
        tab++;
3727
 
 
3728
 
        xprintf(tab, "<net-udp6 "
3729
 
                "idgm6=\"%.2f\" "
3730
 
                "odgm6=\"%.2f\" "
3731
 
                "noport6=\"%.2f\" "
3732
 
                "idgmer6=\"%.2f\"/>",
3733
 
                S_VALUE(snup->InDatagrams6,  snuc->InDatagrams6,  itv),
3734
 
                S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
3735
 
                S_VALUE(snup->NoPorts6,      snuc->NoPorts6,      itv),
3736
 
                S_VALUE(snup->InErrors6,     snuc->InErrors6,     itv));
3737
 
        tab--;
3738
 
 
3739
 
close_xml_markup:
3740
 
        if (CLOSE_MARKUP(a->options)) {
3741
 
                xml_markup_network(tab, CLOSE_XML_MARKUP);
3742
 
        }
3743
 
}
3744
 
 
3745
 
/*
3746
 
 ***************************************************************************
3747
 
 * Display CPU frequency statistics in XML.
3748
 
 *
3749
 
 * IN:
3750
 
 * @a           Activity structure with statistics.
3751
 
 * @curr        Index in array for current sample statistics.
3752
 
 * @tab         Indentation in XML output.
3753
 
 * @itv         Interval of time in jiffies.
3754
 
 ***************************************************************************
3755
 
 */
3756
 
__print_funct_t xml_print_pwr_cpufreq_stats(struct activity *a, int curr, int tab,
3757
 
                                            unsigned long long itv)
3758
 
{
3759
 
        int i;
3760
 
        struct stats_pwr_cpufreq *spc;
3761
 
        char cpuno[8];
3762
 
 
3763
 
        if (!IS_SELECTED(a->options) || (a->nr <= 0))
3764
 
                goto close_xml_markup;
3765
 
 
3766
 
        xml_markup_power_management(tab, OPEN_XML_MARKUP);
3767
 
        tab++;
3768
 
 
3769
 
        xprintf(tab++, "<cpu-frequency unit=\"MHz\">");
3770
 
        
3771
 
        for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
3772
 
                
3773
 
                spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr]  + i * a->msize);
3774
 
        
3775
 
                /* Should current CPU (including CPU "all") be displayed? */
3776
 
                if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
3777
 
 
3778
 
                        /* Yes: Display it */
3779
 
                        if (!i) {
3780
 
                                /* This is CPU "all" */
3781
 
                                strcpy(cpuno, "all");
3782
 
                        }
3783
 
                        else {
3784
 
                                sprintf(cpuno, "%d", i - 1);
3785
 
                        }
3786
 
                        
3787
 
                        xprintf(tab, "<cpu number=\"%s\" "
3788
 
                                "frequency=\"%.2f\"/>",
3789
 
                                cpuno,
3790
 
                                ((double) spc->cpufreq) / 100);
3791
 
                }
3792
 
        }
3793
 
        
3794
 
        xprintf(--tab, "</cpu-frequency>");
3795
 
        tab--;
3796
 
 
3797
 
close_xml_markup:
3798
 
        if (CLOSE_MARKUP(a->options)) {
3799
 
                xml_markup_power_management(tab, CLOSE_XML_MARKUP);
3800
 
        }
3801
 
}