]> granicus.if.org Git - sysstat/blob - pr_stats.c
No longer assume that device-mapper major number is 253.
[sysstat] / pr_stats.c
1 /*
2  * pr_stats.c: Functions used by sar to display statistics
3  * (C) 1999-2010 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 #include <stdlib.h>
26
27 #include "sa.h"
28 #include "ioconf.h"
29 #include "pr_stats.h"
30
31 #ifdef USE_NLS
32 #include <locale.h>
33 #include <libintl.h>
34 #define _(string) gettext(string)
35 #else
36 #define _(string) (string)
37 #endif
38
39 extern unsigned int flags;
40 extern unsigned int dm_major;
41 extern int  dis;
42 extern char timestamp[][TIMESTAMP_LEN];
43 extern unsigned long avg_count;
44
45 /*
46  ***************************************************************************
47  * Display CPU statistics.
48  *
49  * IN:
50  * @a           Activity structure with statistics.
51  * @prev        Index in array where stats used as reference are.
52  * @curr        Index in array for current sample statistics.
53  * @g_itv       Interval of time in jiffies multiplied by the number
54  *              of processors.
55  ***************************************************************************
56  */
57 __print_funct_t print_cpu_stats(struct activity *a, int prev, int curr,
58                                 unsigned long long g_itv)
59 {
60         int i;
61         struct stats_cpu *scc, *scp;
62
63         if (dis) {
64                 if (DISPLAY_CPU_DEF(a->opt_flags)) {
65                         printf("\n%-11s     CPU     %%user     %%nice   %%system"
66                                "   %%iowait    %%steal     %%idle\n",
67                                timestamp[!curr]);
68                 }
69                 else if (DISPLAY_CPU_ALL(a->opt_flags)) {
70                         printf("\n%-11s     CPU      %%usr     %%nice      %%sys"
71                                "   %%iowait    %%steal      %%irq     %%soft"
72                                "    %%guest     %%idle\n",
73                                timestamp[!curr]);
74                 }
75         }
76         
77         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
78                 
79                 /*
80                  * The size of a->buf[...] CPU structure may be different from the default
81                  * sizeof(struct stats_cpu) value if data have been read from a file!
82                  * That's why we don't use a syntax like:
83                  * scc = (struct stats_cpu *) a->buf[...] + i;
84                  */
85                 scc = (struct stats_cpu *) ((char *) a->buf[curr] + i * a->msize);
86                 scp = (struct stats_cpu *) ((char *) a->buf[prev] + i * a->msize);
87
88                 /*
89                  * Note: a->nr is in [1, NR_CPUS + 1].
90                  * Bitmap size is provided for (NR_CPUS + 1) CPUs.
91                  * Anyway, NR_CPUS may vary between the version of sysstat
92                  * used by sadc to create a file, and the version of sysstat
93                  * used by sar to read it...
94                  */
95                 
96                 /* Should current CPU (including CPU "all") be displayed? */
97                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
98                         
99                         /* Yes: Display it */
100                         printf("%-11s", timestamp[curr]);
101                         
102                         if (!i) {
103                                 /* This is CPU "all" */
104                                 printf("     all");
105                         }
106                         else {
107                                 printf("     %3d", i - 1);
108
109                                 /*
110                                  * If the CPU is offline then it is omited from /proc/stat:
111                                  * All the fields couldn't have been read and the sum of them is zero.
112                                  * (Remember that guest time is already included in user mode.)
113                                  */
114                                 if ((scc->cpu_user    + scc->cpu_nice + scc->cpu_sys   +
115                                      scc->cpu_iowait  + scc->cpu_idle + scc->cpu_steal +
116                                      scc->cpu_hardirq + scc->cpu_softirq) == 0) {
117                                         /*
118                                          * Set current struct fields (which have been set to zero)
119                                          * to values from previous iteration. Hence their values won't
120                                          * jump from zero when the CPU comes back online.
121                                          */
122                                         *scc = *scp;
123                                         
124                                         printf("    %6.2f    %6.2f    %6.2f"
125                                                "    %6.2f    %6.2f    %6.2f",
126                                                0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
127                                         
128                                         if (DISPLAY_CPU_ALL(a->opt_flags)) {
129                                                 printf("    %6.2f    %6.2f    %6.2f",
130                                                        0.0, 0.0, 0.0);
131                                         }
132                                         printf("\n");
133                                         continue;
134                                 }
135                                 
136                                 /* Recalculate interval for current proc */
137                                 g_itv = get_per_cpu_interval(scc, scp);
138                                 
139                                 if (!g_itv) {
140                                         /*
141                                          * If the CPU is tickless then there is no change in CPU values
142                                          * but the sum of values is not zero.
143                                          */
144                                         printf("    %6.2f    %6.2f    %6.2f"
145                                                "    %6.2f    %6.2f",
146                                                0.0, 0.0, 0.0, 0.0, 0.0);
147
148                                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
149                                                 printf("    %6.2f\n", 100.0);
150                                         }
151                                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
152                                                 printf("    %6.2f    %6.2f    %6.2f    %6.2f\n",
153                                                        0.0, 0.0, 0.0, 100.0);
154                                         }
155                                         continue;
156                                 }
157                         }
158                         
159                         if (DISPLAY_CPU_DEF(a->opt_flags)) {
160                                 printf("    %6.2f    %6.2f    %6.2f    %6.2f    %6.2f    %6.2f\n",
161                                        ll_sp_value(scp->cpu_user,   scc->cpu_user,   g_itv),
162                                        ll_sp_value(scp->cpu_nice,   scc->cpu_nice,   g_itv),
163                                        ll_sp_value(scp->cpu_sys + scp->cpu_hardirq + scp->cpu_softirq,
164                                                    scc->cpu_sys + scc->cpu_hardirq + scc->cpu_softirq,
165                                                    g_itv),
166                                        ll_sp_value(scp->cpu_iowait, scc->cpu_iowait, g_itv),
167                                        ll_sp_value(scp->cpu_steal,  scc->cpu_steal,  g_itv),
168                                        scc->cpu_idle < scp->cpu_idle ?
169                                        0.0 :
170                                        ll_sp_value(scp->cpu_idle,   scc->cpu_idle,   g_itv));
171                         }
172                         else if (DISPLAY_CPU_ALL(a->opt_flags)) {
173                                 printf("    %6.2f    %6.2f    %6.2f    %6.2f    %6.2f    %6.2f"
174                                        "    %6.2f    %6.2f    %6.2f\n",
175                                        (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
176                                        0.0 :
177                                        ll_sp_value(scp->cpu_user - scp->cpu_guest,
178                                                    scc->cpu_user - scc->cpu_guest,     g_itv),
179                                        ll_sp_value(scp->cpu_nice,    scc->cpu_nice,    g_itv),
180                                        ll_sp_value(scp->cpu_sys,     scc->cpu_sys,     g_itv),
181                                        ll_sp_value(scp->cpu_iowait,  scc->cpu_iowait,  g_itv),
182                                        ll_sp_value(scp->cpu_steal,   scc->cpu_steal,   g_itv),
183                                        ll_sp_value(scp->cpu_hardirq, scc->cpu_hardirq, g_itv),
184                                        ll_sp_value(scp->cpu_softirq, scc->cpu_softirq, g_itv),
185                                        ll_sp_value(scp->cpu_guest,   scc->cpu_guest,   g_itv),
186                                        scc->cpu_idle < scp->cpu_idle ?
187                                        0.0 :
188                                        ll_sp_value(scp->cpu_idle,    scc->cpu_idle,    g_itv));
189                         }
190                 }
191         }
192 }
193
194 /*
195  ***************************************************************************
196  * Display tasks creation and context switches statistics.
197  *
198  * IN:
199  * @a           Activity structure with statistics.
200  * @prev        Index in array where stats used as reference are.
201  * @curr        Index in array for current sample statistics.
202  * @itv         Interval of time in jiffies.
203  ***************************************************************************
204  */
205 __print_funct_t print_pcsw_stats(struct activity *a, int prev, int curr,
206                                  unsigned long long itv)
207 {
208         struct stats_pcsw
209                 *spc = (struct stats_pcsw *) a->buf[curr],
210                 *spp = (struct stats_pcsw *) a->buf[prev];
211         
212         if (dis) {
213                 printf("\n%-11s    proc/s   cswch/s\n", timestamp[!curr]);
214         }
215
216         printf("%-11s %9.2f %9.2f\n", timestamp[curr],
217                S_VALUE   (spp->processes,      spc->processes,      itv),
218                ll_s_value(spp->context_switch, spc->context_switch, itv));
219 }
220
221 /*
222  ***************************************************************************
223  * Display interrupts statistics.
224  *
225  * IN:
226  * @a           Activity structure with statistics.
227  * @prev        Index in array where stats used as reference are.
228  * @curr        Index in array for current sample statistics.
229  * @itv         Interval of time in jiffies.
230  ***************************************************************************
231  */
232 __print_funct_t print_irq_stats(struct activity *a, int prev, int curr,
233                                 unsigned long long itv)
234 {
235         int i;
236         struct stats_irq *sic, *sip;
237         
238         if (dis) {
239                 printf("\n%-11s      INTR    intr/s\n", timestamp[!curr]);
240         }
241         
242         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
243
244                 sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
245                 sip = (struct stats_irq *) ((char *) a->buf[prev] + i * a->msize);
246                 
247                 /*
248                  * Note: a->nr is in [0, NR_IRQS + 1].
249                  * Bitmap size is provided for (NR_IRQS + 1) interrupts.
250                  * Anyway, NR_IRQS may vary between the version of sysstat
251                  * used by sadc to create a file, and the version of sysstat
252                  * used by sar to read it...
253                  */
254                 
255                 /* Should current interrupt (including int "sum") be displayed? */
256                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
257                         
258                         /* Yes: Display it */
259                         printf("%-11s", timestamp[curr]);
260                         if (!i) {
261                                 /* This is interrupt "sum" */
262                                 printf("       sum");
263                         }
264                         else {
265                                 printf("       %3d", i - 1);
266                         }
267
268                         printf(" %9.2f\n",
269                                ll_s_value(sip->irq_nr, sic->irq_nr, itv));
270                 }
271         }
272 }
273
274 /*
275  ***************************************************************************
276  * Display swapping statistics.
277  *
278  * IN:
279  * @a           Activity structure with statistics.
280  * @prev        Index in array where stats used as reference are.
281  * @curr        Index in array for current sample statistics.
282  * @itv         Interval of time in jiffies.
283  ***************************************************************************
284  */
285 __print_funct_t print_swap_stats(struct activity *a, int prev, int curr,
286                                  unsigned long long itv)
287 {
288         struct stats_swap
289                 *ssc = (struct stats_swap *) a->buf[curr],
290                 *ssp = (struct stats_swap *) a->buf[prev];
291         
292         if (dis) {
293                 printf("\n%-11s  pswpin/s pswpout/s\n", timestamp[!curr]);
294         }
295
296         printf("%-11s %9.2f %9.2f\n", timestamp[curr],
297                S_VALUE(ssp->pswpin,  ssc->pswpin,  itv),
298                S_VALUE(ssp->pswpout, ssc->pswpout, itv));
299 }
300
301 /*
302  ***************************************************************************
303  * Display paging statistics.
304  *
305  * IN:
306  * @a           Activity structure with statistics.
307  * @prev        Index in array where stats used as reference are.
308  * @curr        Index in array for current sample statistics.
309  * @itv         Interval of time in jiffies.
310  ***************************************************************************
311  */
312 __print_funct_t print_paging_stats(struct activity *a, int prev, int curr,
313                                    unsigned long long itv)
314 {
315         struct stats_paging
316                 *spc = (struct stats_paging *) a->buf[curr],
317                 *spp = (struct stats_paging *) a->buf[prev];
318
319         if (dis) {
320                 printf("\n%-11s  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s"
321                        " pgscank/s pgscand/s pgsteal/s    %%vmeff\n",
322                        timestamp[!curr]);
323         }
324
325         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
326                timestamp[curr],
327                S_VALUE(spp->pgpgin,        spc->pgpgin,        itv),
328                S_VALUE(spp->pgpgout,       spc->pgpgout,       itv),
329                S_VALUE(spp->pgfault,       spc->pgfault,       itv),
330                S_VALUE(spp->pgmajfault,    spc->pgmajfault,    itv),
331                S_VALUE(spp->pgfree,        spc->pgfree,        itv),
332                S_VALUE(spp->pgscan_kswapd, spc->pgscan_kswapd, itv),
333                S_VALUE(spp->pgscan_direct, spc->pgscan_direct, itv),
334                S_VALUE(spp->pgsteal,       spc->pgsteal,       itv),
335                (spc->pgscan_kswapd + spc->pgscan_direct -
336                 spp->pgscan_kswapd - spp->pgscan_direct) ?
337                SP_VALUE(spp->pgsteal, spc->pgsteal,
338                         spc->pgscan_kswapd + spc->pgscan_direct -
339                         spp->pgscan_kswapd - spp->pgscan_direct) : 0.0);
340 }
341
342 /*
343  ***************************************************************************
344  * Display I/O and transfer rate statistics.
345  *
346  * IN:
347  * @a           Activity structure with statistics.
348  * @prev        Index in array where stats used as reference are.
349  * @curr        Index in array for current sample statistics.
350  * @itv         Interval of time in jiffies.
351  ***************************************************************************
352  */
353 __print_funct_t print_io_stats(struct activity *a, int prev, int curr,
354                                unsigned long long itv)
355 {
356         struct stats_io
357                 *sic = (struct stats_io *) a->buf[curr],
358                 *sip = (struct stats_io *) a->buf[prev];
359
360         if (dis) {
361                 printf("\n%-11s       tps      rtps      wtps   bread/s   bwrtn/s\n",
362                        timestamp[!curr]);
363         }
364
365         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f\n", timestamp[curr],
366                S_VALUE(sip->dk_drive,      sic->dk_drive,      itv),
367                S_VALUE(sip->dk_drive_rio,  sic->dk_drive_rio,  itv),
368                S_VALUE(sip->dk_drive_wio,  sic->dk_drive_wio,  itv),
369                S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv),
370                S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
371 }
372
373 /*
374  ***************************************************************************
375  * Display memory and swap statistics. This function is used to
376  * display instantaneous and average statistics.
377  *
378  * IN:
379  * @a           Activity structure with statistics.
380  * @prev        Index in array where stats used as reference are.
381  * @curr        Index in array for current sample statistics.
382  * @itv         Interval of time in jiffies.
383  * @dispavg     TRUE if displaying average statistics.
384  ***************************************************************************
385  */
386 void stub_print_memory_stats(struct activity *a, int prev, int curr,
387                              unsigned long long itv, int dispavg)
388 {
389         struct stats_memory
390                 *smc = (struct stats_memory *) a->buf[curr],
391                 *smp = (struct stats_memory *) a->buf[prev];
392         static unsigned long long
393                 avg_frmkb = 0,
394                 avg_bufkb = 0,
395                 avg_camkb = 0,
396                 avg_comkb = 0;
397         static unsigned long long
398                 avg_frskb = 0,
399                 avg_tlskb = 0,
400                 avg_caskb = 0;
401         
402         if (DISPLAY_MEMORY(a->opt_flags)) {
403                 if (dis) {
404                         printf("\n%-11s   frmpg/s   bufpg/s   campg/s\n",
405                                timestamp[!curr]);
406                 }
407
408                 printf("%-11s %9.2f %9.2f %9.2f\n", timestamp[curr],
409                        S_VALUE((double) KB_TO_PG(smp->frmkb), (double) KB_TO_PG(smc->frmkb), itv),
410                        S_VALUE((double) KB_TO_PG(smp->bufkb), (double) KB_TO_PG(smc->bufkb), itv),
411                        S_VALUE((double) KB_TO_PG(smp->camkb), (double) KB_TO_PG(smc->camkb), itv));
412         }
413         
414         if (DISPLAY_MEM_AMT(a->opt_flags)) {
415                 if (dis) {
416                         printf("\n%-11s kbmemfree kbmemused  %%memused kbbuffers  kbcached"
417                                "  kbcommit   %%commit\n", timestamp[!curr]);
418                 }
419
420                 if (!dispavg) {
421                         /* Display instantaneous values */
422                         printf("%-11s %9lu %9lu    %6.2f %9lu %9lu %9lu   %7.2f\n",
423                                timestamp[curr],
424                                smc->frmkb,
425                                smc->tlmkb - smc->frmkb,
426                                smc->tlmkb ?
427                                SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb) : 0.0,
428                                smc->bufkb,
429                                smc->camkb,
430                                smc->comkb,
431                                (smc->tlmkb + smc->tlskb) ?
432                                SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb) : 0.0);
433
434                         /*
435                          * Will be used to compute the average.
436                          * We assume that the total amount of memory installed can not vary
437                          * during the interval given on the command line.
438                          */
439                         avg_frmkb += smc->frmkb;
440                         avg_bufkb += smc->bufkb;
441                         avg_camkb += smc->camkb;
442                         avg_comkb += smc->comkb;
443                 }
444                 else {
445                         /* Display average values */
446                         printf("%-11s %9.0f %9.0f    %6.2f %9.0f %9.0f %9.0f   %7.2f\n",
447                                timestamp[curr],
448                                (double) avg_frmkb / avg_count,
449                                (double) smc->tlmkb - ((double) avg_frmkb / avg_count),
450                                smc->tlmkb ?
451                                SP_VALUE((double) (avg_frmkb / avg_count), smc->tlmkb,
452                                         smc->tlmkb) :
453                                0.0,
454                                (double) avg_bufkb / avg_count,
455                                (double) avg_camkb / avg_count,
456                                (double) avg_comkb / avg_count,
457                                (smc->tlmkb + smc->tlskb) ?
458                                SP_VALUE(0.0, (double) (avg_comkb / avg_count),
459                                         smc->tlmkb + smc->tlskb) :
460                                0.0);
461                         
462                         /* Reset average counters */
463                         avg_frmkb = avg_bufkb = avg_camkb = avg_comkb = 0;
464                 }
465         }
466         
467         if (DISPLAY_SWAP(a->opt_flags)) {
468                 if (dis) {
469                         printf("\n%-11s kbswpfree kbswpused  %%swpused  kbswpcad   %%swpcad\n",
470                                timestamp[!curr]);
471                 }
472
473                 if (!dispavg) {
474                         /* Display instantaneous values */
475                         printf("%-11s %9lu %9lu    %6.2f %9lu    %6.2f\n",
476                                timestamp[curr],
477                                smc->frskb,
478                                smc->tlskb - smc->frskb,
479                                smc->tlskb ?
480                                SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb) : 0.0,
481                                smc->caskb,
482                                (smc->tlskb - smc->frskb) ?
483                                SP_VALUE(0, smc->caskb, smc->tlskb - smc->frskb) : 0.0);
484
485                         /*
486                          * Will be used to compute the average.
487                          * We assume that the total amount of swap space may vary.
488                          */
489                         avg_frskb += smc->frskb;
490                         avg_tlskb += smc->tlskb;
491                         avg_caskb += smc->caskb;
492                 }
493                 else {
494                         /* Display average values */
495                         printf("%-11s %9.0f %9.0f    %6.2f %9.0f    %6.2f\n",
496                                timestamp[curr],
497                                (double) avg_frskb / avg_count,
498                                ((double) avg_tlskb / avg_count) -
499                                ((double) avg_frskb / avg_count),
500                                ((double) (avg_tlskb / avg_count)) ?
501                                SP_VALUE((double) (avg_frskb / avg_count),
502                                         (double) (avg_tlskb / avg_count),
503                                         (double) (avg_tlskb / avg_count)) :
504                                0.0,
505                                (double) (avg_caskb / avg_count),
506                                (((double) avg_tlskb / avg_count) -
507                                 ((double) avg_frskb / avg_count)) ?
508                                SP_VALUE(0.0, (double) (avg_caskb / avg_count),
509                                         ((double) avg_tlskb / avg_count) -
510                                         ((double) avg_frskb / avg_count)) :
511                                0.0);
512                         
513                         /* Reset average counters */
514                         avg_frskb = avg_tlskb = avg_caskb = 0;
515                 }
516         }
517 }
518
519 /*
520  ***************************************************************************
521  * Display memory and swap statistics.
522  *
523  * IN:
524  * @a           Activity structure with statistics.
525  * @prev        Index in array where stats used as reference are.
526  * @curr        Index in array for current sample statistics.
527  * @itv         Interval of time in jiffies.
528  ***************************************************************************
529  */
530 __print_funct_t print_memory_stats(struct activity *a, int prev, int curr,
531                                    unsigned long long itv)
532 {
533         stub_print_memory_stats(a, prev, curr, itv, FALSE);
534 }
535
536 /*
537  ***************************************************************************
538  * Display average memory statistics.
539  *
540  * IN:
541  * @a           Activity structure with statistics.
542  * @prev        Index in array where stats used as reference are.
543  * @curr        Index in array for current sample statistics.
544  * @itv         Interval of time in jiffies.
545  ***************************************************************************
546  */
547 __print_funct_t print_avg_memory_stats(struct activity *a, int prev, int curr,
548                                        unsigned long long itv)
549 {
550         stub_print_memory_stats(a, prev, curr, itv, TRUE);
551 }
552
553 /*
554  ***************************************************************************
555  * Display kernel tables statistics. This function is used to display
556  * instantaneous and average statistics.
557  *
558  * IN:
559  * @a           Activity structure with statistics.
560  * @prev        Index in array where stats used as reference are.
561  * @curr        Index in array for current sample statistics.
562  * @dispavg     True if displaying average statistics.
563  ***************************************************************************
564  */
565 void stub_print_ktables_stats(struct activity *a, int prev, int curr, int dispavg)
566 {
567         struct stats_ktables
568                 *skc = (struct stats_ktables *) a->buf[curr];
569         static unsigned long long
570                 avg_dentry_stat = 0,
571                 avg_file_used   = 0,
572                 avg_inode_used  = 0,
573                 avg_pty_nr      = 0;
574                 
575         
576         if (dis) {
577                 printf("\n%-11s dentunusd   file-nr  inode-nr    pty-nr\n",
578                        timestamp[!curr]);
579         }
580
581         if (!dispavg) {
582                 /* Display instantaneous values */
583                 printf("%-11s %9u %9u %9u %9u\n", timestamp[curr],
584                        skc->dentry_stat,
585                        skc->file_used,
586                        skc->inode_used,
587                        skc->pty_nr);
588
589                 /*
590                  * Will be used to compute the average.
591                  * Note: Overflow unlikely to happen but not impossible...
592                  */
593                 avg_dentry_stat += skc->dentry_stat;
594                 avg_file_used   += skc->file_used;
595                 avg_inode_used  += skc->inode_used;
596                 avg_pty_nr      += skc->pty_nr;
597         }
598         else {
599                 /* Display average values */
600                 printf("%-11s %9.0f %9.0f %9.0f %9.0f\n",
601                        timestamp[curr],
602                        (double) avg_dentry_stat / avg_count,
603                        (double) avg_file_used   / avg_count,
604                        (double) avg_inode_used  / avg_count,
605                        (double) avg_pty_nr      / avg_count);
606
607                 /* Reset average counters */
608                 avg_dentry_stat = avg_file_used = avg_inode_used = avg_pty_nr = 0;
609         }
610 }
611
612 /*
613  ***************************************************************************
614  * Display kernel tables statistics.
615  *
616  * IN:
617  * @a           Activity structure with statistics.
618  * @prev        Index in array where stats used as reference are.
619  * @curr        Index in array for current sample statistics.
620  * @itv         Interval of time in jiffies.
621  ***************************************************************************
622  */
623 __print_funct_t print_ktables_stats(struct activity *a, int prev, int curr,
624                                     unsigned long long itv)
625 {
626         stub_print_ktables_stats(a, prev, curr, FALSE);
627 }
628
629 /*
630  ***************************************************************************
631  * Display average kernel tables statistics.
632  *
633  * IN:
634  * @a           Activity structure with statistics.
635  * @prev        Index in array where stats used as reference are.
636  * @curr        Index in array for current sample statistics.
637  * @itv         Interval of time in jiffies.
638  ***************************************************************************
639  */
640 __print_funct_t print_avg_ktables_stats(struct activity *a, int prev, int curr,
641                                         unsigned long long itv)
642 {
643         stub_print_ktables_stats(a, prev, curr, TRUE);
644 }
645
646 /*
647  ***************************************************************************
648  * Display queue and load statistics. This function is used to display
649  * instantaneous and average statistics.
650  *
651  * IN:
652  * @a           Activity structure with statistics.
653  * @prev        Index in array where stats used as reference are.
654  * @curr        Index in array for current sample statistics.
655  * @dispavg     TRUE if displaying average statistics.
656  ***************************************************************************
657  */
658 void stub_print_queue_stats(struct activity *a, int prev, int curr, int dispavg)
659 {
660         struct stats_queue
661                 *sqc = (struct stats_queue *) a->buf[curr];
662         static unsigned long long
663                 avg_nr_running  = 0,
664                 avg_nr_threads  = 0,
665                 avg_load_avg_1  = 0,
666                 avg_load_avg_5  = 0,
667                 avg_load_avg_15 = 0;
668         
669         if (dis) {
670                 printf("\n%-11s   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15\n",
671                        timestamp[!curr]);
672         }
673
674         if (!dispavg) {
675                 /* Display instantaneous values */
676                 printf("%-11s %9lu %9u %9.2f %9.2f %9.2f\n", timestamp[curr],
677                        sqc->nr_running,
678                        sqc->nr_threads,
679                        (double) sqc->load_avg_1  / 100,
680                        (double) sqc->load_avg_5  / 100,
681                        (double) sqc->load_avg_15 / 100);
682
683                 /* Will be used to compute the average */
684                 avg_nr_running  += sqc->nr_running;
685                 avg_nr_threads  += sqc->nr_threads;
686                 avg_load_avg_1  += sqc->load_avg_1;
687                 avg_load_avg_5  += sqc->load_avg_5;
688                 avg_load_avg_15 += sqc->load_avg_15;
689         }
690         else {
691                 /* Display average values */
692                 printf("%-11s %9.0f %9.0f %9.2f %9.2f %9.2f\n", timestamp[curr],
693                        (double) avg_nr_running  / avg_count,
694                        (double) avg_nr_threads  / avg_count,
695                        (double) avg_load_avg_1  / (avg_count * 100),
696                        (double) avg_load_avg_5  / (avg_count * 100),
697                        (double) avg_load_avg_15 / (avg_count * 100));
698
699                 /* Reset average counters */
700                 avg_nr_running = avg_nr_threads = 0;
701                 avg_load_avg_1 = avg_load_avg_5 = avg_load_avg_15 = 0;
702         }
703 }
704
705 /*
706  ***************************************************************************
707  * Display queue and load statistics.
708  *
709  * IN:
710  * @a           Activity structure with statistics.
711  * @prev        Index in array where stats used as reference are.
712  * @curr        Index in array for current sample statistics.
713  * @itv         Interval of time in jiffies.
714  ***************************************************************************
715  */
716 __print_funct_t print_queue_stats(struct activity *a, int prev, int curr,
717                                   unsigned long long itv)
718 {
719         stub_print_queue_stats(a, prev, curr, FALSE);
720 }
721
722 /*
723  ***************************************************************************
724  * Display average queue and load statistics.
725  *
726  * IN:
727  * @a           Activity structure with statistics.
728  * @prev        Index in array where stats used as reference are.
729  * @curr        Index in array for current sample statistics.
730  * @itv         Interval of time in jiffies.
731  ***************************************************************************
732  */
733 __print_funct_t print_avg_queue_stats(struct activity *a, int prev, int curr,
734                                       unsigned long long itv)
735 {
736         stub_print_queue_stats(a, prev, curr, TRUE);
737 }
738
739 /*
740  ***************************************************************************
741  * Display serial lines statistics.
742  *
743  * IN:
744  * @a           Activity structure with statistics.
745  * @prev        Index in array where stats used as reference are.
746  * @curr        Index in array for current sample statistics.
747  * @itv         Interval of time in jiffies.
748  ***************************************************************************
749  */
750 __print_funct_t print_serial_stats(struct activity *a, int prev, int curr,
751                                    unsigned long long itv)
752 {
753         int i;
754         struct stats_serial *ssc, *ssp;
755
756         if (dis) {
757                 printf("\n%-11s       TTY   rcvin/s   xmtin/s framerr/s prtyerr/s"
758                        "     brk/s   ovrun/s\n", timestamp[!curr]);
759         }
760
761         for (i = 0; i < a->nr; i++) {
762
763                 ssc = (struct stats_serial *) ((char *) a->buf[curr] + i * a->msize);
764                 ssp = (struct stats_serial *) ((char *) a->buf[prev] + i * a->msize);
765
766                 if (ssc->line == 0)
767                         continue;
768
769                 printf("%-11s       %3d", timestamp[curr], ssc->line - 1);
770
771                 if ((ssc->line == ssp->line) || WANT_SINCE_BOOT(flags)) {
772                         printf(" %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
773                                S_VALUE(ssp->rx,      ssc->rx,      itv),
774                                S_VALUE(ssp->tx,      ssc->tx,      itv),
775                                S_VALUE(ssp->frame,   ssc->frame,   itv),
776                                S_VALUE(ssp->parity,  ssc->parity,  itv),
777                                S_VALUE(ssp->brk,     ssc->brk,     itv),
778                                S_VALUE(ssp->overrun, ssc->overrun, itv));
779                 }
780                 else {
781                         printf("       N/A       N/A       N/A       N/A"
782                                "       N/A       N/A\n");
783                 }
784         }
785 }
786
787 /*
788  ***************************************************************************
789  * Display disks statistics.
790  *
791  * IN:
792  * @a           Activity structure with statistics.
793  * @prev        Index in array where stats used as reference are.
794  * @curr        Index in array for current sample statistics.
795  * @itv         Interval of time in jiffies.
796  ***************************************************************************
797  */
798 __print_funct_t print_disk_stats(struct activity *a, int prev, int curr,
799                                  unsigned long long itv)
800 {
801         int i, j;
802         struct stats_disk *sdc, *sdp;
803         struct ext_disk_stats xds;
804         char *dev_name;
805
806         if (dis) {
807                 printf("\n%-11s       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz"
808                        "  avgqu-sz     await     svctm     %%util\n",
809                        timestamp[!curr]);
810         }
811
812         for (i = 0; i < a->nr; i++) {
813
814                 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
815
816                 if (!(sdc->major + sdc->minor))
817                         continue;
818
819                 j = check_disk_reg(a, curr, prev, i);
820                 sdp = (struct stats_disk *) ((char *) a->buf[prev] + j * a->msize);
821
822                 /* Compute service time, etc. */
823                 compute_ext_disk_stats(sdc, sdp, itv, &xds);
824                 
825                 dev_name = NULL;
826
827                 if ((USE_PRETTY_OPTION(flags)) && (sdc->major == dm_major)) {
828                         dev_name = transform_devmapname(sdc->major, sdc->minor);
829                 }
830
831                 if (!dev_name) {
832                         dev_name = get_devname(sdc->major, sdc->minor,
833                                                USE_PRETTY_OPTION(flags));
834                 }
835                 
836                 printf("%-11s %9s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
837                        timestamp[curr],
838                        /* Confusion possible here between index and minor numbers */
839                        dev_name,
840                        S_VALUE(sdp->nr_ios, sdc->nr_ios,  itv),
841                        ll_s_value(sdp->rd_sect, sdc->rd_sect, itv),
842                        ll_s_value(sdp->wr_sect, sdc->wr_sect, itv),
843                        /* See iostat for explanations */
844                        xds.arqsz,
845                        S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
846                        xds.await,
847                        xds.svctm,
848                        xds.util / 10.0);
849         }
850 }
851
852 /*
853  ***************************************************************************
854  * Display network interfaces statistics.
855  *
856  * IN:
857  * @a           Activity structure with statistics.
858  * @prev        Index in array where stats used as reference are.
859  * @curr        Index in array for current sample statistics.
860  * @itv         Interval of time in jiffies.
861  ***************************************************************************
862  */
863 __print_funct_t print_net_dev_stats(struct activity *a, int prev, int curr,
864                                     unsigned long long itv)
865 {
866         int i, j;
867         struct stats_net_dev *sndc, *sndp;
868
869         if (dis) {
870                 printf("\n%-11s     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s"
871                        "   rxcmp/s   txcmp/s  rxmcst/s\n", timestamp[!curr]);
872         }
873
874         for (i = 0; i < a->nr; i++) {
875
876                 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
877
878                 if (!strcmp(sndc->interface, ""))
879                         continue;
880                 
881                 j = check_net_dev_reg(a, curr, prev, i);
882                 sndp = (struct stats_net_dev *) ((char *) a->buf[prev] + j * a->msize);
883
884                 printf("%-11s %9s", timestamp[curr], sndc->interface);
885
886                 printf(" %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
887                        S_VALUE(sndp->rx_packets,    sndc->rx_packets,    itv),
888                        S_VALUE(sndp->tx_packets,    sndc->tx_packets,    itv),
889                        S_VALUE(sndp->rx_bytes,      sndc->rx_bytes,      itv) / 1024,
890                        S_VALUE(sndp->tx_bytes,      sndc->tx_bytes,      itv) / 1024,
891                        S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
892                        S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
893                        S_VALUE(sndp->multicast,     sndc->multicast,     itv));
894         }
895 }
896
897 /*
898  ***************************************************************************
899  * Display network interface errors statistics.
900  *
901  * IN:
902  * @a           Activity structure with statistics.
903  * @prev        Index in array where stats used as reference are.
904  * @curr        Index in array for current sample statistics.
905  * @itv         Interval of time in jiffies.
906  ***************************************************************************
907  */
908 __print_funct_t print_net_edev_stats(struct activity *a, int prev, int curr,
909                                      unsigned long long itv)
910 {
911         int i, j;
912         struct stats_net_edev *snedc, *snedp;
913
914         if (dis) {
915                 printf("\n%-11s     IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s"
916                        "  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s\n",
917                        timestamp[!curr]);
918         }
919
920         for (i = 0; i < a->nr; i++) {
921
922                 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
923
924                 if (!strcmp(snedc->interface, ""))
925                         continue;
926                 
927                 j = check_net_edev_reg(a, curr, prev, i);
928                 snedp = (struct stats_net_edev *) ((char *) a->buf[prev] + j * a->msize);
929
930                 printf("%-11s %9s", timestamp[curr], snedc->interface);
931
932                 printf(" %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
933                        S_VALUE(snedp->rx_errors,         snedc->rx_errors,         itv),
934                        S_VALUE(snedp->tx_errors,         snedc->tx_errors,         itv),
935                        S_VALUE(snedp->collisions,        snedc->collisions,        itv),
936                        S_VALUE(snedp->rx_dropped,        snedc->rx_dropped,        itv),
937                        S_VALUE(snedp->tx_dropped,        snedc->tx_dropped,        itv),
938                        S_VALUE(snedp->tx_carrier_errors, snedc->tx_carrier_errors, itv),
939                        S_VALUE(snedp->rx_frame_errors,   snedc->rx_frame_errors,   itv),
940                        S_VALUE(snedp->rx_fifo_errors,    snedc->rx_fifo_errors,    itv),
941                        S_VALUE(snedp->tx_fifo_errors,    snedc->tx_fifo_errors,    itv));
942         }
943 }
944
945 /*
946  ***************************************************************************
947  * Display NFS client statistics.
948  *
949  * IN:
950  * @a           Activity structure with statistics.
951  * @prev        Index in array where stats used as reference are.
952  * @curr        Index in array for current sample statistics.
953  * @itv         Interval of time in jiffies.
954  ***************************************************************************
955  */
956 __print_funct_t print_net_nfs_stats(struct activity *a, int prev, int curr,
957                                     unsigned long long itv)
958 {
959         struct stats_net_nfs
960                 *snnc = (struct stats_net_nfs *) a->buf[curr],
961                 *snnp = (struct stats_net_nfs *) a->buf[prev];
962         
963         if (dis) {
964                 printf("\n%-11s    call/s retrans/s    read/s   write/s  access/s"
965                        "  getatt/s\n", timestamp[!curr]);
966         }
967
968         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n", timestamp[curr],
969                S_VALUE(snnp->nfs_rpccnt,     snnc->nfs_rpccnt,     itv),
970                S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
971                S_VALUE(snnp->nfs_readcnt,    snnc->nfs_readcnt,    itv),
972                S_VALUE(snnp->nfs_writecnt,   snnc->nfs_writecnt,   itv),
973                S_VALUE(snnp->nfs_accesscnt,  snnc->nfs_accesscnt,  itv),
974                S_VALUE(snnp->nfs_getattcnt,  snnc->nfs_getattcnt,  itv));
975 }
976
977 /*
978  ***************************************************************************
979  * Display NFS server statistics.
980  *
981  * IN:
982  * @a           Activity structure with statistics.
983  * @prev        Index in array where stats used as reference are.
984  * @curr        Index in array for current sample statistics.
985  * @itv         Interval of time in jiffies.
986  ***************************************************************************
987  */
988 __print_funct_t print_net_nfsd_stats(struct activity *a, int prev, int curr,
989                                      unsigned long long itv)
990 {
991         struct stats_net_nfsd
992                 *snndc = (struct stats_net_nfsd *) a->buf[curr],
993                 *snndp = (struct stats_net_nfsd *) a->buf[prev];
994
995         if (dis) {
996                 printf("\n%-11s   scall/s badcall/s  packet/s     udp/s     tcp/s     "
997                        "hit/s    miss/s   sread/s  swrite/s saccess/s sgetatt/s\n",
998                        timestamp[!curr]);
999         }
1000
1001         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1002                timestamp[curr],
1003                S_VALUE(snndp->nfsd_rpccnt,    snndc->nfsd_rpccnt,    itv),
1004                S_VALUE(snndp->nfsd_rpcbad,    snndc->nfsd_rpcbad,    itv),
1005                S_VALUE(snndp->nfsd_netcnt,    snndc->nfsd_netcnt,    itv),
1006                S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv),
1007                S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv),
1008                S_VALUE(snndp->nfsd_rchits,    snndc->nfsd_rchits,    itv),
1009                S_VALUE(snndp->nfsd_rcmisses,  snndc->nfsd_rcmisses,  itv),
1010                S_VALUE(snndp->nfsd_readcnt,   snndc->nfsd_readcnt,   itv),
1011                S_VALUE(snndp->nfsd_writecnt,  snndc->nfsd_writecnt,  itv),
1012                S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv),
1013                S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
1014 }
1015
1016 /*
1017  ***************************************************************************
1018  * Display network sockets statistics. This function is used to display
1019  * instantaneous and average statistics.
1020  *
1021  * IN:
1022  * @a           Activity structure with statistics.
1023  * @prev        Index in array where stats used as reference are.
1024  * @curr        Index in array for current sample statistics.
1025  * @itv         Interval of time in jiffies.
1026  * @dispavg     TRUE if displaying average statistics.
1027  ***************************************************************************
1028  */
1029 void stub_print_net_sock_stats(struct activity *a, int prev, int curr,
1030                                unsigned long long itv, int dispavg)
1031 {
1032         struct stats_net_sock
1033                 *snsc = (struct stats_net_sock *) a->buf[curr];
1034         static unsigned long long
1035                 avg_sock_inuse = 0,
1036                 avg_tcp_inuse  = 0,
1037                 avg_udp_inuse  = 0,
1038                 avg_raw_inuse  = 0,
1039                 avg_frag_inuse = 0,
1040                 avg_tcp_tw     = 0;
1041         
1042         if (dis) {
1043                 printf("\n%-11s    totsck    tcpsck    udpsck    rawsck   ip-frag    tcp-tw\n",
1044                        timestamp[!curr]);
1045         }
1046
1047         if (!dispavg) {
1048                 /* Display instantaneous values */
1049                 printf("%-11s %9u %9u %9u %9u %9u %9u\n", timestamp[curr],
1050                        snsc->sock_inuse,
1051                        snsc->tcp_inuse,
1052                        snsc->udp_inuse,
1053                        snsc->raw_inuse,
1054                        snsc->frag_inuse,
1055                        snsc->tcp_tw);
1056
1057                 /* Will be used to compute the average */
1058                 avg_sock_inuse += snsc->sock_inuse;
1059                 avg_tcp_inuse  += snsc->tcp_inuse;
1060                 avg_udp_inuse  += snsc->udp_inuse;
1061                 avg_raw_inuse  += snsc->raw_inuse;
1062                 avg_frag_inuse += snsc->frag_inuse;
1063                 avg_tcp_tw     += snsc->tcp_tw;
1064         }
1065         else {
1066                 /* Display average values */
1067                 printf("%-11s %9.0f %9.0f %9.0f %9.0f %9.0f %9.0f\n", timestamp[curr],
1068                        (double) avg_sock_inuse / avg_count,
1069                        (double) avg_tcp_inuse  / avg_count,
1070                        (double) avg_udp_inuse  / avg_count,
1071                        (double) avg_raw_inuse  / avg_count,
1072                        (double) avg_frag_inuse / avg_count,
1073                        (double) avg_tcp_tw     / avg_count);
1074
1075                 /* Reset average counters */
1076                 avg_sock_inuse = avg_tcp_inuse = avg_udp_inuse = 0;
1077                 avg_raw_inuse = avg_frag_inuse = avg_tcp_tw = 0;
1078         }
1079 }
1080
1081 /*
1082  ***************************************************************************
1083  * Display network sockets statistics.
1084  *
1085  * IN:
1086  * @a           Activity structure with statistics.
1087  * @prev        Index in array where stats used as reference are.
1088  * @curr        Index in array for current sample statistics.
1089  * @itv         Interval of time in jiffies.
1090  ***************************************************************************
1091  */
1092 __print_funct_t print_net_sock_stats(struct activity *a, int prev, int curr,
1093                                      unsigned long long itv)
1094 {
1095         stub_print_net_sock_stats(a, prev, curr, itv, FALSE);
1096 }
1097
1098 /*
1099  ***************************************************************************
1100  * Display average network sockets statistics.
1101  *
1102  * IN:
1103  * @a           Activity structure with statistics.
1104  * @prev        Index in array where stats used as reference are.
1105  * @curr        Index in array for current sample statistics.
1106  * @itv         Interval of time in jiffies.
1107  ***************************************************************************
1108  */
1109 __print_funct_t print_avg_net_sock_stats(struct activity *a, int prev, int curr,
1110                                          unsigned long long itv)
1111 {
1112         stub_print_net_sock_stats(a, prev, curr, itv, TRUE);
1113 }
1114
1115 /*
1116  ***************************************************************************
1117  * Display IP network traffic statistics.
1118  *
1119  * IN:
1120  * @a           Activity structure with statistics.
1121  * @prev        Index in array where stats used as reference are.
1122  * @curr        Index in array for current sample statistics.
1123  * @itv         Interval of time in jiffies.
1124  ***************************************************************************
1125  */
1126 __print_funct_t print_net_ip_stats(struct activity *a, int prev, int curr,
1127                                    unsigned long long itv)
1128 {
1129         struct stats_net_ip
1130                 *snic = (struct stats_net_ip *) a->buf[curr],
1131                 *snip = (struct stats_net_ip *) a->buf[prev];
1132
1133         if (dis) {
1134                 printf("\n%-11s    irec/s  fwddgm/s    idel/s     orq/s   asmrq/s"
1135                        "   asmok/s  fragok/s fragcrt/s\n", timestamp[!curr]);
1136         }
1137
1138         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1139                timestamp[curr],
1140                S_VALUE(snip->InReceives,    snic->InReceives,    itv),
1141                S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
1142                S_VALUE(snip->InDelivers,    snic->InDelivers,    itv),
1143                S_VALUE(snip->OutRequests,   snic->OutRequests,   itv),
1144                S_VALUE(snip->ReasmReqds,    snic->ReasmReqds,    itv),
1145                S_VALUE(snip->ReasmOKs,      snic->ReasmOKs,      itv),
1146                S_VALUE(snip->FragOKs,       snic->FragOKs,       itv),
1147                S_VALUE(snip->FragCreates,   snic->FragCreates,   itv));
1148 }
1149
1150 /*
1151  ***************************************************************************
1152  * Display IP network error statistics.
1153  *
1154  * IN:
1155  * @a           Activity structure with statistics.
1156  * @prev        Index in array where stats used as reference are.
1157  * @curr        Index in array for current sample statistics.
1158  * @itv         Interval of time in jiffies.
1159  ***************************************************************************
1160  */
1161 __print_funct_t print_net_eip_stats(struct activity *a, int prev, int curr,
1162                                     unsigned long long itv)
1163 {
1164         struct stats_net_eip
1165                 *sneic = (struct stats_net_eip *) a->buf[curr],
1166                 *sneip = (struct stats_net_eip *) a->buf[prev];
1167
1168         if (dis) {
1169                 printf("\n%-11s ihdrerr/s iadrerr/s iukwnpr/s   idisc/s   odisc/s"
1170                        "   onort/s    asmf/s   fragf/s\n", timestamp[!curr]);
1171         }
1172
1173         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1174                timestamp[curr],
1175                S_VALUE(sneip->InHdrErrors,     sneic->InHdrErrors,     itv),
1176                S_VALUE(sneip->InAddrErrors,    sneic->InAddrErrors,    itv),
1177                S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
1178                S_VALUE(sneip->InDiscards,      sneic->InDiscards,      itv),
1179                S_VALUE(sneip->OutDiscards,     sneic->OutDiscards,     itv),
1180                S_VALUE(sneip->OutNoRoutes,     sneic->OutNoRoutes,     itv),
1181                S_VALUE(sneip->ReasmFails,      sneic->ReasmFails,      itv),
1182                S_VALUE(sneip->FragFails,       sneic->FragFails,       itv));
1183 }
1184
1185 /*
1186  ***************************************************************************
1187  * Display ICMP network traffic statistics.
1188  *
1189  * IN:
1190  * @a           Activity structure with statistics.
1191  * @prev        Index in array where stats used as reference are.
1192  * @curr        Index in array for current sample statistics.
1193  * @itv         Interval of time in jiffies.
1194  ***************************************************************************
1195  */
1196 __print_funct_t print_net_icmp_stats(struct activity *a, int prev, int curr,
1197                                      unsigned long long itv)
1198 {
1199         struct stats_net_icmp
1200                 *snic = (struct stats_net_icmp *) a->buf[curr],
1201                 *snip = (struct stats_net_icmp *) a->buf[prev];
1202
1203         if (dis) {
1204                 printf("\n%-11s    imsg/s    omsg/s    iech/s   iechr/s    oech/s"
1205                        "   oechr/s     itm/s    itmr/s     otm/s    otmr/s"
1206                        "  iadrmk/s iadrmkr/s  oadrmk/s oadrmkr/s\n", timestamp[!curr]);
1207         }
1208
1209         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f"
1210                " %9.2f %9.2f %9.2f %9.2f\n", timestamp[curr],
1211                S_VALUE(snip->InMsgs,           snic->InMsgs,           itv),
1212                S_VALUE(snip->OutMsgs,          snic->OutMsgs,          itv),
1213                S_VALUE(snip->InEchos,          snic->InEchos,          itv),
1214                S_VALUE(snip->InEchoReps,       snic->InEchoReps,       itv),
1215                S_VALUE(snip->OutEchos,         snic->OutEchos,         itv),
1216                S_VALUE(snip->OutEchoReps,      snic->OutEchoReps,      itv),
1217                S_VALUE(snip->InTimestamps,     snic->InTimestamps,     itv),
1218                S_VALUE(snip->InTimestampReps,  snic->InTimestampReps,  itv),
1219                S_VALUE(snip->OutTimestamps,    snic->OutTimestamps,    itv),
1220                S_VALUE(snip->OutTimestampReps, snic->OutTimestampReps, itv),
1221                S_VALUE(snip->InAddrMasks,      snic->InAddrMasks,      itv),
1222                S_VALUE(snip->InAddrMaskReps,   snic->InAddrMaskReps,   itv),
1223                S_VALUE(snip->OutAddrMasks,     snic->OutAddrMasks,     itv),
1224                S_VALUE(snip->OutAddrMaskReps,  snic->OutAddrMaskReps,  itv));
1225 }
1226
1227 /*
1228  ***************************************************************************
1229  * Display ICMP network error statistics.
1230  *
1231  * IN:
1232  * @a           Activity structure with statistics.
1233  * @prev        Index in array where stats used as reference are.
1234  * @curr        Index in array for current sample statistics.
1235  * @itv         Interval of time in jiffies.
1236  ***************************************************************************
1237  */
1238 __print_funct_t print_net_eicmp_stats(struct activity *a, int prev, int curr,
1239                                       unsigned long long itv)
1240 {
1241         struct stats_net_eicmp
1242                 *sneic = (struct stats_net_eicmp *) a->buf[curr],
1243                 *sneip = (struct stats_net_eicmp *) a->buf[prev];
1244
1245         if (dis) {
1246                 printf("\n%-11s    ierr/s    oerr/s idstunr/s odstunr/s   itmex/s"
1247                        "   otmex/s iparmpb/s oparmpb/s   isrcq/s   osrcq/s"
1248                        "  iredir/s  oredir/s\n", timestamp[!curr]);
1249         }
1250
1251         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f"
1252                " %9.2f %9.2f\n", timestamp[curr],
1253                S_VALUE(sneip->InErrors,        sneic->InErrors,        itv),
1254                S_VALUE(sneip->OutErrors,       sneic->OutErrors,       itv),
1255                S_VALUE(sneip->InDestUnreachs,  sneic->InDestUnreachs,  itv),
1256                S_VALUE(sneip->OutDestUnreachs, sneic->OutDestUnreachs, itv),
1257                S_VALUE(sneip->InTimeExcds,     sneic->InTimeExcds,     itv),
1258                S_VALUE(sneip->OutTimeExcds,    sneic->OutTimeExcds,    itv),
1259                S_VALUE(sneip->InParmProbs,     sneic->InParmProbs,     itv),
1260                S_VALUE(sneip->OutParmProbs,    sneic->OutParmProbs,    itv),
1261                S_VALUE(sneip->InSrcQuenchs,    sneic->InSrcQuenchs,    itv),
1262                S_VALUE(sneip->OutSrcQuenchs,   sneic->OutSrcQuenchs,   itv),
1263                S_VALUE(sneip->InRedirects,     sneic->InRedirects,     itv),
1264                S_VALUE(sneip->OutRedirects,    sneic->OutRedirects,    itv));
1265 }
1266
1267 /*
1268  ***************************************************************************
1269  * Display TCP network traffic statistics.
1270  *
1271  * IN:
1272  * @a           Activity structure with statistics.
1273  * @prev        Index in array where stats used as reference are.
1274  * @curr        Index in array for current sample statistics.
1275  * @itv         Interval of time in jiffies.
1276  ***************************************************************************
1277  */
1278 __print_funct_t print_net_tcp_stats(struct activity *a, int prev, int curr,
1279                                     unsigned long long itv)
1280 {
1281         struct stats_net_tcp
1282                 *sntc = (struct stats_net_tcp *) a->buf[curr],
1283                 *sntp = (struct stats_net_tcp *) a->buf[prev];
1284
1285         if (dis) {
1286                 printf("\n%-11s  active/s passive/s    iseg/s    oseg/s\n",
1287                        timestamp[!curr]);
1288         }
1289
1290         printf("%-11s %9.2f %9.2f %9.2f %9.2f\n",
1291                timestamp[curr],
1292                S_VALUE(sntp->ActiveOpens,  sntc->ActiveOpens,  itv),
1293                S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
1294                S_VALUE(sntp->InSegs,       sntc->InSegs,       itv),
1295                S_VALUE(sntp->OutSegs,      sntc->OutSegs,      itv));
1296 }
1297
1298 /*
1299  ***************************************************************************
1300  * Display TCP network error statistics.
1301  *
1302  * IN:
1303  * @a           Activity structure with statistics.
1304  * @prev        Index in array where stats used as reference are.
1305  * @curr        Index in array for current sample statistics.
1306  * @itv         Interval of time in jiffies.
1307  ***************************************************************************
1308  */
1309 __print_funct_t print_net_etcp_stats(struct activity *a, int prev, int curr,
1310                                      unsigned long long itv)
1311 {
1312         struct stats_net_etcp
1313                 *snetc = (struct stats_net_etcp *) a->buf[curr],
1314                 *snetp = (struct stats_net_etcp *) a->buf[prev];
1315
1316         if (dis) {
1317                 printf("\n%-11s  atmptf/s  estres/s retrans/s isegerr/s   orsts/s\n",
1318                        timestamp[!curr]);
1319         }
1320
1321         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1322                timestamp[curr],
1323                S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
1324                S_VALUE(snetp->EstabResets,  snetc->EstabResets,  itv),
1325                S_VALUE(snetp->RetransSegs,  snetc->RetransSegs,  itv),
1326                S_VALUE(snetp->InErrs,       snetc->InErrs,       itv),
1327                S_VALUE(snetp->OutRsts,      snetc->OutRsts,      itv));
1328 }
1329
1330 /*
1331  ***************************************************************************
1332  * Display UDP network traffic statistics.
1333  *
1334  * IN:
1335  * @a           Activity structure with statistics.
1336  * @prev        Index in array where stats used as reference are.
1337  * @curr        Index in array for current sample statistics.
1338  * @itv         Interval of time in jiffies.
1339  ***************************************************************************
1340  */
1341 __print_funct_t print_net_udp_stats(struct activity *a, int prev, int curr,
1342                                     unsigned long long itv)
1343 {
1344         struct stats_net_udp
1345                 *snuc = (struct stats_net_udp *) a->buf[curr],
1346                 *snup = (struct stats_net_udp *) a->buf[prev];
1347
1348         if (dis) {
1349                 printf("\n%-11s    idgm/s    odgm/s  noport/s idgmerr/s\n",
1350                        timestamp[!curr]);
1351         }
1352
1353         printf("%-11s %9.2f %9.2f %9.2f %9.2f\n",
1354                timestamp[curr],
1355                S_VALUE(snup->InDatagrams,  snuc->InDatagrams,  itv),
1356                S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
1357                S_VALUE(snup->NoPorts,      snuc->NoPorts,      itv),
1358                S_VALUE(snup->InErrors,     snuc->InErrors,     itv));
1359 }
1360
1361 /*
1362  ***************************************************************************
1363  * Display IPv6 sockets statistics. This function is used to display
1364  * instantaneous and average statistics.
1365  *
1366  * IN:
1367  * @a           Activity structure with statistics.
1368  * @prev        Index in array where stats used as reference are.
1369  * @curr        Index in array for current sample statistics.
1370  * @itv         Interval of time in jiffies.
1371  * @dispavg     TRUE if displaying average statistics.
1372  ***************************************************************************
1373  */
1374 void stub_print_net_sock6_stats(struct activity *a, int prev, int curr,
1375                                 unsigned long long itv, int dispavg)
1376 {
1377         struct stats_net_sock6
1378                 *snsc = (struct stats_net_sock6 *) a->buf[curr];
1379         static unsigned long long
1380                 avg_tcp6_inuse  = 0,
1381                 avg_udp6_inuse  = 0,
1382                 avg_raw6_inuse  = 0,
1383                 avg_frag6_inuse = 0;
1384         
1385         if (dis) {
1386                 printf("\n%-11s   tcp6sck   udp6sck   raw6sck  ip6-frag\n",
1387                        timestamp[!curr]);
1388         }
1389
1390         if (!dispavg) {
1391                 /* Display instantaneous values */
1392                 printf("%-11s %9u %9u %9u %9u\n", timestamp[curr],
1393                        snsc->tcp6_inuse,
1394                        snsc->udp6_inuse,
1395                        snsc->raw6_inuse,
1396                        snsc->frag6_inuse);
1397
1398                 /* Will be used to compute the average */
1399                 avg_tcp6_inuse  += snsc->tcp6_inuse;
1400                 avg_udp6_inuse  += snsc->udp6_inuse;
1401                 avg_raw6_inuse  += snsc->raw6_inuse;
1402                 avg_frag6_inuse += snsc->frag6_inuse;
1403         }
1404         else {
1405                 /* Display average values */
1406                 printf("%-11s %9.0f %9.0f %9.0f %9.0f\n", timestamp[curr],
1407                        (double) avg_tcp6_inuse  / avg_count,
1408                        (double) avg_udp6_inuse  / avg_count,
1409                        (double) avg_raw6_inuse  / avg_count,
1410                        (double) avg_frag6_inuse / avg_count);
1411
1412                 /* Reset average counters */
1413                 avg_tcp6_inuse = avg_udp6_inuse = avg_raw6_inuse = avg_frag6_inuse = 0;
1414         }
1415 }
1416
1417 /*
1418  ***************************************************************************
1419  * Display IPv6 sockets statistics.
1420  *
1421  * IN:
1422  * @a           Activity structure with statistics.
1423  * @prev        Index in array where stats used as reference are.
1424  * @curr        Index in array for current sample statistics.
1425  * @itv         Interval of time in jiffies.
1426  ***************************************************************************
1427  */
1428 __print_funct_t print_net_sock6_stats(struct activity *a, int prev, int curr,
1429                                       unsigned long long itv)
1430 {
1431         stub_print_net_sock6_stats(a, prev, curr, itv, FALSE);
1432 }
1433
1434 /*
1435  ***************************************************************************
1436  * Display average IPv6 sockets statistics.
1437  *
1438  * IN:
1439  * @a           Activity structure with statistics.
1440  * @prev        Index in array where stats used as reference are.
1441  * @curr        Index in array for current sample statistics.
1442  * @itv         Interval of time in jiffies.
1443  ***************************************************************************
1444  */
1445 __print_funct_t print_avg_net_sock6_stats(struct activity *a, int prev, int curr,
1446                                           unsigned long long itv)
1447 {
1448         stub_print_net_sock6_stats(a, prev, curr, itv, TRUE);
1449 }
1450
1451 /*
1452  ***************************************************************************
1453  * Display IPv6 network traffic statistics.
1454  *
1455  * IN:
1456  * @a           Activity structure with statistics.
1457  * @prev        Index in array where stats used as reference are.
1458  * @curr        Index in array for current sample statistics.
1459  * @itv         Interval of time in jiffies.
1460  ***************************************************************************
1461  */
1462 __print_funct_t print_net_ip6_stats(struct activity *a, int prev, int curr,
1463                                     unsigned long long itv)
1464 {
1465         struct stats_net_ip6
1466                 *snic = (struct stats_net_ip6 *) a->buf[curr],
1467                 *snip = (struct stats_net_ip6 *) a->buf[prev];
1468
1469         if (dis) {
1470                 printf("\n%-11s   irec6/s fwddgm6/s   idel6/s    orq6/s  asmrq6/s"
1471                        "  asmok6/s imcpck6/s omcpck6/s fragok6/s fragcr6/s\n",
1472                        timestamp[!curr]);
1473         }
1474
1475         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1476                timestamp[curr],
1477                S_VALUE(snip->InReceives6,       snic->InReceives6,       itv),
1478                S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
1479                S_VALUE(snip->InDelivers6,       snic->InDelivers6,       itv),
1480                S_VALUE(snip->OutRequests6,      snic->OutRequests6,      itv),
1481                S_VALUE(snip->ReasmReqds6,       snic->ReasmReqds6,       itv),
1482                S_VALUE(snip->ReasmOKs6,         snic->ReasmOKs6,         itv),
1483                S_VALUE(snip->InMcastPkts6,      snic->InMcastPkts6,      itv),
1484                S_VALUE(snip->OutMcastPkts6,     snic->OutMcastPkts6,     itv),
1485                S_VALUE(snip->FragOKs6,          snic->FragOKs6,          itv),
1486                S_VALUE(snip->FragCreates6,      snic->FragCreates6,      itv));
1487 }
1488
1489 /*
1490  ***************************************************************************
1491  * Display IPv6 network error statistics.
1492  *
1493  * IN:
1494  * @a           Activity structure with statistics.
1495  * @prev        Index in array where stats used as reference are.
1496  * @curr        Index in array for current sample statistics.
1497  * @itv         Interval of time in jiffies.
1498  ***************************************************************************
1499  */
1500 __print_funct_t print_net_eip6_stats(struct activity *a, int prev, int curr,
1501                                      unsigned long long itv)
1502 {
1503         struct stats_net_eip6
1504                 *sneic = (struct stats_net_eip6 *) a->buf[curr],
1505                 *sneip = (struct stats_net_eip6 *) a->buf[prev];
1506
1507         if (dis) {
1508                 printf("\n%-11s ihdrer6/s iadrer6/s iukwnp6/s  i2big6/s  idisc6/s  odisc6/s"
1509                        "  inort6/s  onort6/s   asmf6/s  fragf6/s itrpck6/s\n",
1510                        timestamp[!curr]);
1511         }
1512
1513         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n",
1514                timestamp[curr],
1515                S_VALUE(sneip->InHdrErrors6,     sneic->InHdrErrors6,     itv),
1516                S_VALUE(sneip->InAddrErrors6,    sneic->InAddrErrors6,    itv),
1517                S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
1518                S_VALUE(sneip->InTooBigErrors6,  sneic->InTooBigErrors6,  itv),
1519                S_VALUE(sneip->InDiscards6,      sneic->InDiscards6,      itv),
1520                S_VALUE(sneip->OutDiscards6,     sneic->OutDiscards6,     itv),
1521                S_VALUE(sneip->InNoRoutes6,      sneic->InNoRoutes6,      itv),
1522                S_VALUE(sneip->OutNoRoutes6,     sneic->OutNoRoutes6,     itv),
1523                S_VALUE(sneip->ReasmFails6,      sneic->ReasmFails6,      itv),
1524                S_VALUE(sneip->FragFails6,       sneic->FragFails6,       itv),
1525                S_VALUE(sneip->InTruncatedPkts6, sneic->InTruncatedPkts6, itv));
1526 }
1527
1528 /*
1529  ***************************************************************************
1530  * Display ICMPv6 network traffic statistics.
1531  *
1532  * IN:
1533  * @a           Activity structure with statistics.
1534  * @prev        Index in array where stats used as reference are.
1535  * @curr        Index in array for current sample statistics.
1536  * @itv         Interval of time in jiffies.
1537  ***************************************************************************
1538  */
1539 __print_funct_t print_net_icmp6_stats(struct activity *a, int prev, int curr,
1540                                       unsigned long long itv)
1541 {
1542         struct stats_net_icmp6
1543                 *snic = (struct stats_net_icmp6 *) a->buf[curr],
1544                 *snip = (struct stats_net_icmp6 *) a->buf[prev];
1545
1546         if (dis) {
1547                 printf("\n%-11s   imsg6/s   omsg6/s   iech6/s  iechr6/s  oechr6/s"
1548                        "  igmbq6/s  igmbr6/s  ogmbr6/s igmbrd6/s ogmbrd6/s irtsol6/s ortsol6/s"
1549                        "  irtad6/s inbsol6/s onbsol6/s  inbad6/s  onbad6/s\n",
1550                        timestamp[!curr]);
1551         }
1552
1553         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f"
1554                " %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f\n", timestamp[curr],
1555                S_VALUE(snip->InMsgs6,                    snic->InMsgs6,                    itv),
1556                S_VALUE(snip->OutMsgs6,                   snic->OutMsgs6,                   itv),
1557                S_VALUE(snip->InEchos6,                   snic->InEchos6,                   itv),
1558                S_VALUE(snip->InEchoReplies6,             snic->InEchoReplies6,             itv),
1559                S_VALUE(snip->OutEchoReplies6,            snic->OutEchoReplies6,            itv),
1560                S_VALUE(snip->InGroupMembQueries6,        snic->InGroupMembQueries6,        itv),
1561                S_VALUE(snip->InGroupMembResponses6,      snic->InGroupMembResponses6,      itv),
1562                S_VALUE(snip->OutGroupMembResponses6,     snic->OutGroupMembResponses6,     itv),
1563                S_VALUE(snip->InGroupMembReductions6,     snic->InGroupMembReductions6,     itv),
1564                S_VALUE(snip->OutGroupMembReductions6,    snic->OutGroupMembReductions6,    itv),
1565                S_VALUE(snip->InRouterSolicits6,          snic->InRouterSolicits6,          itv),
1566                S_VALUE(snip->OutRouterSolicits6,         snic->OutRouterSolicits6,         itv),
1567                S_VALUE(snip->InRouterAdvertisements6,    snic->InRouterAdvertisements6,    itv),
1568                S_VALUE(snip->InNeighborSolicits6,        snic->InNeighborSolicits6,        itv),
1569                S_VALUE(snip->OutNeighborSolicits6,       snic->OutNeighborSolicits6,       itv),
1570                S_VALUE(snip->InNeighborAdvertisements6,  snic->InNeighborAdvertisements6,  itv),
1571                S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv));
1572 }
1573
1574 /*
1575  ***************************************************************************
1576  * Display ICMPv6 network error statistics.
1577  *
1578  * IN:
1579  * @a           Activity structure with statistics.
1580  * @prev        Index in array where stats used as reference are.
1581  * @curr        Index in array for current sample statistics.
1582  * @itv         Interval of time in jiffies.
1583  ***************************************************************************
1584  */
1585 __print_funct_t print_net_eicmp6_stats(struct activity *a, int prev, int curr,
1586                                        unsigned long long itv)
1587 {
1588         struct stats_net_eicmp6
1589                 *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
1590                 *sneip = (struct stats_net_eicmp6 *) a->buf[prev];
1591
1592         if (dis) {
1593                 printf("\n%-11s   ierr6/s idtunr6/s odtunr6/s  itmex6/s  otmex6/s"
1594                        " iprmpb6/s oprmpb6/s iredir6/s oredir6/s ipck2b6/s opck2b6/s\n",
1595                        timestamp[!curr]);
1596         }
1597
1598         printf("%-11s %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f %9.2f"
1599                " %9.2f\n", timestamp[curr],
1600                S_VALUE(sneip->InErrors6,        sneic->InErrors6,        itv),
1601                S_VALUE(sneip->InDestUnreachs6,  sneic->InDestUnreachs6,  itv),
1602                S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
1603                S_VALUE(sneip->InTimeExcds6,     sneic->InTimeExcds6,     itv),
1604                S_VALUE(sneip->OutTimeExcds6,    sneic->OutTimeExcds6,    itv),
1605                S_VALUE(sneip->InParmProblems6,  sneic->InParmProblems6,  itv),
1606                S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
1607                S_VALUE(sneip->InRedirects6,     sneic->InRedirects6,     itv),
1608                S_VALUE(sneip->OutRedirects6,    sneic->OutRedirects6,    itv),
1609                S_VALUE(sneip->InPktTooBigs6,    sneic->InPktTooBigs6,    itv),
1610                S_VALUE(sneip->OutPktTooBigs6,   sneic->OutPktTooBigs6,   itv));
1611 }
1612
1613 /*
1614  ***************************************************************************
1615  * Display UDPv6 network traffic statistics.
1616  *
1617  * IN:
1618  * @a           Activity structure with statistics.
1619  * @prev        Index in array where stats used as reference are.
1620  * @curr        Index in array for current sample statistics.
1621  * @itv         Interval of time in jiffies.
1622  ***************************************************************************
1623  */
1624 __print_funct_t print_net_udp6_stats(struct activity *a, int prev, int curr,
1625                                      unsigned long long itv)
1626 {
1627         struct stats_net_udp6
1628                 *snuc = (struct stats_net_udp6 *) a->buf[curr],
1629                 *snup = (struct stats_net_udp6 *) a->buf[prev];
1630
1631         if (dis) {
1632                 printf("\n%-11s   idgm6/s   odgm6/s noport6/s idgmer6/s\n",
1633                        timestamp[!curr]);
1634         }
1635
1636         printf("%-11s %9.2f %9.2f %9.2f %9.2f\n",
1637                timestamp[curr],
1638                S_VALUE(snup->InDatagrams6,  snuc->InDatagrams6,  itv),
1639                S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
1640                S_VALUE(snup->NoPorts6,      snuc->NoPorts6,      itv),
1641                S_VALUE(snup->InErrors6,     snuc->InErrors6,     itv));
1642 }
1643
1644 /*
1645  ***************************************************************************
1646  * Display CPU frequency statistics. This function is used to display
1647  * instantaneous and average statistics.
1648  *
1649  * IN:
1650  * @a           Activity structure with statistics.
1651  * @prev        Index in array where stats used as reference are.
1652  * @curr        Index in array for current sample statistics.
1653  * @dispavg     True if displaying average statistics.
1654  ***************************************************************************
1655  */
1656 void stub_print_pwr_cpufreq_stats(struct activity *a, int prev, int curr, int dispavg)
1657 {
1658         int i;
1659         struct stats_pwr_cpufreq *spc;
1660         static unsigned long long
1661                 *avg_cpufreq = NULL;
1662         
1663         if (!avg_cpufreq) {
1664                 /* Allocate array of CPU frequency */
1665                 if ((avg_cpufreq = (unsigned long long *) malloc(sizeof(unsigned long long) * a->nr))
1666                     == NULL) {
1667                         perror("malloc");
1668                         exit(4);
1669                 }
1670                 memset(avg_cpufreq, 0, sizeof(unsigned long long) * a->nr);
1671         }
1672         
1673         if (dis) {
1674                 printf("\n%-11s     CPU       MHz\n",
1675                        timestamp[!curr]);
1676         }
1677
1678         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
1679                 
1680                 /*
1681                  * The size of a->buf[...] CPU structure may be different from the default
1682                  * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
1683                  * That's why we don't use a syntax like:
1684                  * spc = (struct stats_pwr_cpufreq *) a->buf[...] + i;
1685                  */
1686                 spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr] + i * a->msize);
1687
1688                 /*
1689                  * Note: a->nr is in [1, NR_CPUS + 1].
1690                  * Bitmap size is provided for (NR_CPUS + 1) CPUs.
1691                  * Anyway, NR_CPUS may vary between the version of sysstat
1692                  * used by sadc to create a file, and the version of sysstat
1693                  * used by sar to read it...
1694                  */
1695                 
1696                 /* Should current CPU (including CPU "all") be displayed? */
1697                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
1698
1699                         /* Yes: Display it */
1700                         printf("%-11s", timestamp[curr]);
1701                         
1702                         if (!i) {
1703                                 /* This is CPU "all" */
1704                                 printf("     all");
1705                         }
1706                         else {
1707                                 printf("     %3d", i - 1);
1708                         }
1709                         
1710                         if (!dispavg) {
1711                                 /* Display instantaneous values */
1712                                 printf(" %9.2f\n",
1713                                        ((double) spc->cpufreq) / 100);
1714                                 /*
1715                                  * Will be used to compute the average.
1716                                  * Note: overflow unlikely to happen but not impossible...
1717                                  */
1718                                 avg_cpufreq[i] += spc->cpufreq;
1719                         }
1720                         else {
1721                                 /* Display average values */
1722                                 printf(" %9.2f\n",
1723                                        (double) avg_cpufreq[i] / (100 * avg_count));                            
1724                         }
1725                 }
1726         }
1727         
1728         if (dispavg) {
1729                 /* Array of CPU frequency no longer needed: Free it! */
1730                 if (avg_cpufreq) {
1731                         free(avg_cpufreq);
1732                         avg_cpufreq = NULL;
1733                 }
1734         }
1735 }
1736
1737 /*
1738  ***************************************************************************
1739  * Display CPU frequency statistics.
1740  *
1741  * IN:
1742  * @a           Activity structure with statistics.
1743  * @prev        Index in array where stats used as reference are.
1744  * @curr        Index in array for current sample statistics.
1745  * @itv         Interval of time in jiffies.
1746  ***************************************************************************
1747  */
1748 __print_funct_t print_pwr_cpufreq_stats(struct activity *a, int prev, int curr,
1749                                         unsigned long long itv)
1750 {
1751         stub_print_pwr_cpufreq_stats(a, prev, curr, FALSE);
1752 }
1753
1754 /*
1755  ***************************************************************************
1756  * Display average CPU frequency statistics.
1757  *
1758  * IN:
1759  * @a           Activity structure with statistics.
1760  * @prev        Index in array where stats used as reference are.
1761  * @curr        Index in array for current sample statistics.
1762  * @itv         Interval of time in jiffies.
1763  ***************************************************************************
1764  */
1765 __print_funct_t print_avg_pwr_cpufreq_stats(struct activity *a, int prev, int curr,
1766                                             unsigned long long itv)
1767 {
1768         stub_print_pwr_cpufreq_stats(a, prev, curr, TRUE);
1769 }
1770
1771 /*
1772  ***************************************************************************
1773  * Display fan statistics. This function is used to display
1774  * instantaneous and average statistics.
1775  *
1776  * IN:
1777  * @a           Activity structure with statistics.
1778  * @prev        Index in array where stats used as reference are.
1779  * @curr        Index in array for current sample statistics.
1780  * @dispavg     True if displaying average statistics.
1781  ***************************************************************************
1782  */
1783 void stub_print_pwr_fan_stats(struct activity *a, int prev, int curr, int dispavg)
1784 {
1785         int i;
1786         struct stats_pwr_fan *spc;
1787         static double *avg_fan = NULL;
1788         static double *avg_fan_min = NULL;
1789
1790         /* Allocate arrays of fan RPMs */
1791         if (!avg_fan) {
1792                 if ((avg_fan = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
1793                         perror("malloc");
1794                         exit(4);
1795                 }
1796                 memset(avg_fan, 0, sizeof(double) * a->nr);
1797         }
1798         if (!avg_fan_min) {
1799                 if ((avg_fan_min = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
1800                         perror("malloc");
1801                         exit(4);
1802                 }
1803                 memset(avg_fan_min, 0, sizeof(double) * a->nr);
1804         }
1805
1806         if (dis) {
1807                 printf("\n%-11s     FAN       rpm      drpm     %*s\n",
1808                        timestamp[!curr], MAX_SENSORS_DEV_LEN, "DEVICE");
1809         }
1810
1811         for (i = 0; i < a->nr; i++) {
1812                 spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
1813
1814                 printf("%-11s     %3d", timestamp[curr], i + 1);
1815
1816                 if (dispavg) {
1817                         /* Display average values */
1818                         printf(" %9.2f %9.2f",
1819                                (double) avg_fan[i] / avg_count,
1820                                (double) (avg_fan[i] - avg_fan_min[i]) / avg_count);
1821                 }
1822                 else {
1823                         /* Display instantaneous values */
1824                         printf(" %9.2f %9.2f",
1825                                spc->rpm,
1826                                spc->rpm - spc->rpm_min);
1827                         avg_fan[i]     += spc->rpm;
1828                         avg_fan_min[i] += spc->rpm_min;
1829                 }
1830
1831                 printf("     %*s\n", MAX_SENSORS_DEV_LEN, spc->device);
1832         }
1833
1834         if (dispavg) {
1835                 if (avg_fan) {
1836                         free(avg_fan);
1837                         avg_fan = NULL;
1838                 }
1839                 if (avg_fan_min) {
1840                         free(avg_fan_min);
1841                         avg_fan_min = NULL;
1842                 }
1843         }
1844 }
1845
1846 /*
1847  ***************************************************************************
1848  * Display fan statistics.
1849  *
1850  * IN:
1851  * @a           Activity structure with statistics.
1852  * @prev        Index in array where stats used as reference are.
1853  * @curr        Index in array for current sample statistics.
1854  * @itv         Interval of time in jiffies.
1855  ***************************************************************************
1856  */
1857 __print_funct_t print_pwr_fan_stats(struct activity *a, int prev, int curr,
1858                                     unsigned long long itv)
1859 {
1860         stub_print_pwr_fan_stats(a, prev, curr, FALSE);
1861 }
1862
1863 /*
1864  ***************************************************************************
1865  * Display average fan statistics.
1866  *
1867  * IN:
1868  * @a           Activity structure with statistics.
1869  * @prev        Index in array where stats used as reference are.
1870  * @curr        Index in array for current sample statistics.
1871  * @itv         Interval of time in jiffies.
1872  ***************************************************************************
1873  */
1874 __print_funct_t print_avg_pwr_fan_stats(struct activity *a, int prev, int curr,
1875                                         unsigned long long itv)
1876 {
1877         stub_print_pwr_fan_stats(a, prev, curr, TRUE);
1878 }
1879
1880 /*
1881  ***************************************************************************
1882  * Display device temperature statistics. This function is used to display
1883  * instantaneous and average statistics.
1884  *
1885  * IN:
1886  * @a           Activity structure with statistics.
1887  * @prev        Index in array where stats used as reference are.
1888  * @curr        Index in array for current sample statistics.
1889  * @dispavg     True if displaying average statistics.
1890  ***************************************************************************
1891  */
1892 void stub_print_pwr_temp_stats(struct activity *a, int prev, int curr, int dispavg)
1893 {
1894         int i;
1895         struct stats_pwr_temp *spc;
1896         static double *avg_temp = NULL;
1897         static double *avg_temp_min = NULL, *avg_temp_max = NULL;
1898
1899         /* Allocate arrays of temperatures */
1900         if (!avg_temp) {
1901                 if ((avg_temp = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
1902                         perror("malloc");
1903                         exit(4);
1904                 }
1905                 memset(avg_temp, 0, sizeof(double) * a->nr);
1906         }
1907         if (!avg_temp_min) {
1908                 if ((avg_temp_min = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
1909                         perror("malloc");
1910                         exit(4);
1911                 }
1912                 memset(avg_temp_min, 0, sizeof(double) * a->nr);
1913         }
1914         if (!avg_temp_max) {
1915                 if ((avg_temp_max = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
1916                         perror("malloc");
1917                         exit(4);
1918                 }
1919                 memset(avg_temp_max, 0, sizeof(double) * a->nr);
1920         }
1921
1922         if (dis) {
1923                 printf("\n%-11s    TEMP      degC     %%temp     %*s\n",
1924                        timestamp[!curr], MAX_SENSORS_DEV_LEN, "DEVICE");
1925         }
1926
1927         for (i = 0; i < a->nr; i++) {
1928                 spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
1929
1930                 printf("%-11s     %3d", timestamp[curr], i + 1);
1931
1932                 if (dispavg) {
1933                         /* Display average values */
1934                         printf(" %9.2f %9.2f",
1935                                (double) avg_temp[i] / avg_count,
1936                                (avg_temp_max[i] - avg_temp_min[i]) ?
1937                                ((double) (avg_temp[i] / avg_count) - avg_temp_min[i]) / (avg_temp_max[i] - avg_temp_min[i]) * 100 :
1938                                0.0);
1939                 }
1940                 else {
1941                         /* Display instantaneous values */
1942                         printf(" %9.2f %9.2f",
1943                                spc->temp,
1944                                (spc->temp_max - spc->temp_min) ?
1945                                (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
1946                                0.0);
1947                         avg_temp[i] += spc->temp;
1948                         /* Assume that min and max temperatures cannot vary */
1949                         avg_temp_min[i] = spc->temp_min;
1950                         avg_temp_max[i] = spc->temp_max;
1951                 }
1952                 
1953                 printf("     %*s\n", MAX_SENSORS_DEV_LEN, spc->device);
1954         }
1955
1956         if (dispavg) {
1957                 if (avg_temp) {
1958                         free(avg_temp);
1959                         avg_temp = NULL;
1960                 }
1961                 if (avg_temp_min) {
1962                         free(avg_temp_min);
1963                         avg_temp_min = NULL;
1964                 }
1965                 if (avg_temp_max) {
1966                         free(avg_temp_max);
1967                         avg_temp_max = NULL;
1968                 }
1969         }
1970 }
1971
1972 /*
1973  ***************************************************************************
1974  * Display temperature statistics.
1975  *
1976  * IN:
1977  * @a           Activity structure with statistics.
1978  * @prev        Index in array where stats used as reference are.
1979  * @curr        Index in array for current sample statistics.
1980  * @itv         Interval of time in jiffies.
1981  ***************************************************************************
1982  */
1983 __print_funct_t print_pwr_temp_stats(struct activity *a, int prev, int curr,
1984                                      unsigned long long itv)
1985 {
1986         stub_print_pwr_temp_stats(a, prev, curr, FALSE);
1987 }
1988
1989 /*
1990  ***************************************************************************
1991  * Display average temperature statistics.
1992  *
1993  * IN:
1994  * @a           Activity structure with statistics.
1995  * @prev        Index in array where stats used as reference are.
1996  * @curr        Index in array for current sample statistics.
1997  * @itv         Interval of time in jiffies.
1998  ***************************************************************************
1999  */
2000 __print_funct_t print_avg_pwr_temp_stats(struct activity *a, int prev, int curr,
2001                                          unsigned long long itv)
2002 {
2003         stub_print_pwr_temp_stats(a, prev, curr, TRUE);
2004 }
2005
2006 /*
2007  ***************************************************************************
2008  * Display voltage inputs statistics. This function is used to display
2009  * instantaneous and average statistics.
2010  *
2011  * IN:
2012  * @a           Activity structure with statistics.
2013  * @prev        Index in array where stats used as reference are.
2014  * @curr        Index in array for current sample statistics.
2015  * @dispavg     True if displaying average statistics.
2016  ***************************************************************************
2017  */
2018 void stub_print_pwr_in_stats(struct activity *a, int prev, int curr, int dispavg)
2019 {
2020         int i;
2021         struct stats_pwr_in *spc;
2022         static double *avg_in = NULL;
2023         static double *avg_in_min = NULL, *avg_in_max = NULL;
2024
2025         /* Allocate arrays of voltage inputs */
2026         if (!avg_in) {
2027                 if ((avg_in = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
2028                         perror("malloc");
2029                         exit(4);
2030                 }
2031                 memset(avg_in, 0, sizeof(double) * a->nr);
2032         }
2033         if (!avg_in_min) {
2034                 if ((avg_in_min = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
2035                         perror("malloc");
2036                         exit(4);
2037                 }
2038                 memset(avg_in_min, 0, sizeof(double) * a->nr);
2039         }
2040         if (!avg_in_max) {
2041                 if ((avg_in_max = (double *) malloc(sizeof(double) * a->nr)) == NULL) {
2042                         perror("malloc");
2043                         exit(4);
2044                 }
2045                 memset(avg_in_max, 0, sizeof(double) * a->nr);
2046         }
2047
2048         if (dis) {
2049                 printf("\n%-11s      IN       inV       %%in     %*s\n",
2050                        timestamp[!curr], MAX_SENSORS_DEV_LEN, "DEVICE");
2051         }
2052
2053         for (i = 0; i < a->nr; i++) {
2054                 spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
2055
2056                 printf("%-11s     %3d", timestamp[curr], i);
2057
2058                 if (dispavg) {
2059                         /* Display average values */
2060                         printf(" %9.2f %9.2f",
2061                                (double) avg_in[i] / avg_count,
2062                                (avg_in_max[i] - avg_in_min[i]) ?
2063                                ((double) (avg_in[i] / avg_count) - avg_in_min[i]) / (avg_in_max[i] - avg_in_min[i]) * 100 :
2064                                0.0);
2065                 }
2066                 else {
2067                         /* Display instantaneous values */
2068                         printf(" %9.2f %9.2f",
2069                                spc->in,
2070                                (spc->in_max - spc->in_min) ?
2071                                (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
2072                                0.0);
2073                         avg_in[i] += spc->in;
2074                         /* Assume that min and max voltage inputs cannot vary */
2075                         avg_in_min[i] = spc->in_min;
2076                         avg_in_max[i] = spc->in_max;
2077                 }
2078
2079                 printf("     %*s\n", MAX_SENSORS_DEV_LEN, spc->device);
2080         }
2081
2082         if (dispavg) {
2083                 if (avg_in) {
2084                         free(avg_in);
2085                         avg_in = NULL;
2086                 }
2087                 if (avg_in_min) {
2088                         free(avg_in_min);
2089                         avg_in_min = NULL;
2090                 }
2091                 if (avg_in_max) {
2092                         free(avg_in_max);
2093                         avg_in_max = NULL;
2094                 }
2095         }
2096 }
2097
2098 /*
2099  ***************************************************************************
2100  * Display voltage inputs statistics.
2101  *
2102  * IN:
2103  * @a           Activity structure with statistics.
2104  * @prev        Index in array where stats used as reference are.
2105  * @curr        Index in array for current sample statistics.
2106  * @itv         Interval of time in jiffies.
2107  ***************************************************************************
2108  */
2109 __print_funct_t print_pwr_in_stats(struct activity *a, int prev, int curr,
2110                                    unsigned long long itv)
2111 {
2112         stub_print_pwr_in_stats(a, prev, curr, FALSE);
2113 }
2114
2115 /*
2116  ***************************************************************************
2117  * Display average voltage inputs statistics.
2118  *
2119  * IN:
2120  * @a           Activity structure with statistics.
2121  * @prev        Index in array where stats used as reference are.
2122  * @curr        Index in array for current sample statistics.
2123  * @itv         Interval of time in jiffies.
2124  ***************************************************************************
2125  */
2126 __print_funct_t print_avg_pwr_in_stats(struct activity *a, int prev, int curr,
2127                                        unsigned long long itv)
2128 {
2129         stub_print_pwr_in_stats(a, prev, curr, TRUE);
2130 }
2131
2132 /*
2133  ***************************************************************************
2134  * Display huge pages statistics. This function is used to
2135  * display instantaneous and average statistics.
2136  *
2137  * IN:
2138  * @a           Activity structure with statistics.
2139  * @prev        Index in array where stats used as reference are.
2140  * @curr        Index in array for current sample statistics.
2141  * @itv         Interval of time in jiffies.
2142  * @dispavg     TRUE if displaying average statistics.
2143  ***************************************************************************
2144  */
2145 void stub_print_huge_stats(struct activity *a, int prev, int curr,
2146                            unsigned long long itv, int dispavg)
2147 {
2148         struct stats_huge
2149                 *smc = (struct stats_huge *) a->buf[curr];
2150         static unsigned long long
2151                 avg_frhkb = 0,
2152                 avg_tlhkb = 0;
2153
2154         if (dis) {
2155                 printf("\n%-11s kbhugfree kbhugused  %%hugused\n",
2156                        timestamp[!curr]);
2157         }
2158
2159         if (!dispavg) {
2160                 /* Display instantaneous values */
2161                 printf("%-11s %9lu %9lu    %6.2f\n",
2162                        timestamp[curr],
2163                        smc->frhkb,
2164                        smc->tlhkb - smc->frhkb,
2165                        smc->tlhkb ?
2166                        SP_VALUE(smc->frhkb, smc->tlhkb, smc->tlhkb) : 0.0);
2167
2168                 /* Will be used to compute the average */
2169                 avg_frhkb += smc->frhkb;
2170                 avg_tlhkb += smc->tlhkb;
2171         }
2172         else {
2173                 /* Display average values */
2174                 printf("%-11s %9.0f %9.0f    %6.2f\n",
2175                        timestamp[curr],
2176                        (double) avg_frhkb / avg_count,
2177                        ((double) avg_tlhkb / avg_count) -
2178                        ((double) avg_frhkb / avg_count),
2179                        ((double) (avg_tlhkb / avg_count)) ?
2180                        SP_VALUE((double) (avg_frhkb / avg_count),
2181                                 (double) (avg_tlhkb / avg_count),
2182                                 (double) (avg_tlhkb / avg_count)) :
2183                        0.0);
2184
2185                 /* Reset average counters */
2186                 avg_frhkb = avg_tlhkb = 0;
2187         }
2188 }
2189
2190 /*
2191  ***************************************************************************
2192  * Display huge pages statistics.
2193  *
2194  * IN:
2195  * @a           Activity structure with statistics.
2196  * @prev        Index in array where stats used as reference are.
2197  * @curr        Index in array for current sample statistics.
2198  * @itv         Interval of time in jiffies.
2199  ***************************************************************************
2200  */
2201 __print_funct_t print_huge_stats(struct activity *a, int prev, int curr,
2202                                  unsigned long long itv)
2203 {
2204         stub_print_huge_stats(a, prev, curr, itv, FALSE);
2205 }
2206
2207 /*
2208  ***************************************************************************
2209  * Display huge pages statistics.
2210  *
2211  * IN:
2212  * @a           Activity structure with statistics.
2213  * @prev        Index in array where stats used as reference are.
2214  * @curr        Index in array for current sample statistics.
2215  * @itv         Interval of time in jiffies.
2216  ***************************************************************************
2217  */
2218 __print_funct_t print_avg_huge_stats(struct activity *a, int prev, int curr,
2219                                      unsigned long long itv)
2220 {
2221         stub_print_huge_stats(a, prev, curr, itv, TRUE);
2222 }
2223
2224 /*
2225  ***************************************************************************
2226  * Display CPU weighted frequency statistics. This function is used to
2227  * display instantaneous and average statistics.
2228  *
2229  * IN:
2230  * @a           Activity structure with statistics.
2231  * @prev        Index in array where stats used as reference are.
2232  * @curr        Index in array for current sample statistics.
2233  * @dispavg     True if displaying average statistics.
2234  ***************************************************************************
2235  */
2236 void print_pwr_wghfreq_stats(struct activity *a, int prev, int curr,
2237                              unsigned long long itv)
2238 {
2239         int i, k;
2240         struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
2241         unsigned long long tis, tisfreq;
2242
2243         if (dis) {
2244                 printf("\n%-11s     CPU    wghMHz\n",
2245                        timestamp[!curr]);
2246         }
2247
2248         for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) {
2249
2250                 /*
2251                  * The size of a->buf[...] CPU structure may be different from the default
2252                  * sizeof(struct stats_pwr_wghfreq) value if data have been read from a file!
2253                  * That's why we don't use a syntax like:
2254                  * spc = (struct stats_pwr_wghfreq *) a->buf[...] + i;
2255                  */
2256                 spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
2257                 spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[prev] + i * a->msize * a->nr2);
2258
2259                 /*
2260                  * Note: a->nr is in [1, NR_CPUS + 1].
2261                  * Bitmap size is provided for (NR_CPUS + 1) CPUs.
2262                  * Anyway, NR_CPUS may vary between the version of sysstat
2263                  * used by sadc to create a file, and the version of sysstat
2264                  * used by sar to read it...
2265                  */
2266
2267                 /* Should current CPU (including CPU "all") be displayed? */
2268                 if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
2269
2270                         /* Yes: Display it */
2271                         printf("%-11s", timestamp[curr]);
2272
2273                         if (!i) {
2274                                 /* This is CPU "all" */
2275                                 printf("     all");
2276                         }
2277                         else {
2278                                 printf("     %3d", i - 1);
2279                         }
2280
2281                         tisfreq = 0;
2282                         tis = 0;
2283
2284                         for (k = 0; k < a->nr2; k++) {
2285
2286                                 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
2287                                 if (!spc_k->freq)
2288                                         break;
2289                                 spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
2290
2291                                 tisfreq += (spc_k->freq / 1000) *
2292                                            (spc_k->time_in_state - spp_k->time_in_state);
2293                                 tis     += (spc_k->time_in_state - spp_k->time_in_state);
2294                         }
2295
2296                         /* Display weighted frequency for current CPU */
2297                         printf(" %9.2f\n", tis ? ((double) tisfreq) / tis : 0.0);
2298                 }
2299         }
2300 }