]> granicus.if.org Git - sysstat/blob - activity.c
sar: Define new AO_COUNTED and AO_PERSISTENT flags
[sysstat] / activity.c
1 /*
2  * activity.c: Define system activities available for sar/sadc.
3  * (C) 1999-2017 by Sebastien GODARD (sysstat <at> orange.fr)
4  *
5  ***************************************************************************
6  * This program is free software; you can redistribute it and/or modify it *
7  * under the terms of the GNU General Public License as published  by  the *
8  * Free Software Foundation; either version 2 of the License, or (at  your *
9  * option) any later version.                                              *
10  *                                                                         *
11  * This program is distributed in the hope that it  will  be  useful,  but *
12  * WITHOUT ANY WARRANTY; without the implied warranty  of  MERCHANTABILITY *
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
14  * for more details.                                                       *
15  *                                                                         *
16  * You should have received a copy of the GNU General Public License along *
17  * with this program; if not, write to the Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA              *
19  ***************************************************************************
20  */
21
22 #include "sa.h"
23
24 #ifdef SOURCE_SADC
25 #include "rd_stats.h"
26 #include "rd_sensors.h"
27 #endif
28
29 #ifdef SOURCE_SAR
30 #include "pr_stats.h"
31 #endif
32
33 #ifdef SOURCE_SADF
34 #include "rndr_stats.h"
35 #include "xml_stats.h"
36 #include "json_stats.h"
37 #include "svg_stats.h"
38 #include "raw_stats.h"
39 #endif
40
41 /*
42  ***************************************************************************
43  * Definitions of system activities.
44  * See sa.h file for activity structure definition.
45  * Activity structure doesn't matter for daily data files.
46  ***************************************************************************
47  */
48
49 /*
50  * Bitmaps needed by activities.
51  * Remember to allocate them before use!
52  */
53
54 /* CPU bitmap */
55 struct act_bitmap cpu_bitmap = {
56         .b_array        = NULL,
57         .b_size         = NR_CPUS
58 };
59
60 /* Interrupts bitmap */
61 struct act_bitmap irq_bitmap = {
62         .b_array        = NULL,
63         .b_size         = NR_IRQS
64 };
65
66
67 /*
68  * CPU statistics.
69  * This is the only activity which *must* be collected by sadc
70  * so that uptime can be filled.
71  */
72 struct activity cpu_act = {
73         .id             = A_CPU,
74         .options        = AO_COLLECTED + AO_COUNTED + AO_PERSISTENT +
75                           AO_MULTIPLE_OUTPUTS + AO_GRAPH_PER_ITEM,
76         .magic          = ACTIVITY_MAGIC_BASE,
77         .group          = G_DEFAULT,
78 #ifdef SOURCE_SADC
79         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
80         .f_count2       = NULL,
81         .f_read         = wrap_read_stat_cpu,
82 #endif
83 #ifdef SOURCE_SAR
84         .f_print        = print_cpu_stats,
85         .f_print_avg    = print_cpu_stats,
86 #endif
87 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
88         .hdr_line       = "CPU;%user;%nice;%system;%iowait;%steal;%idle|"
89                           "CPU;%usr;%nice;%sys;%iowait;%steal;%irq;%soft;%guest;%gnice;%idle",
90 #endif
91         .gtypes_nr      = {10, 0, 0},
92         .ftypes_nr      = {0, 0, 0},
93 #ifdef SOURCE_SADF
94         .f_render       = render_cpu_stats,
95         .f_xml_print    = xml_print_cpu_stats,
96         .f_json_print   = json_print_cpu_stats,
97         .f_svg_print    = svg_print_cpu_stats,
98         .f_raw_print    = raw_print_cpu_stats,
99         .name           = "A_CPU",
100         .g_nr           = 1,
101 #endif
102         .nr             = -1,
103         .nr2            = 1,
104         .nr_max         = NR_CPUS + 1,
105         .fsize          = STATS_CPU_SIZE,
106         .msize          = STATS_CPU_SIZE,
107         .opt_flags      = AO_F_CPU_DEF,
108         .buf            = {NULL, NULL, NULL},
109         .bitmap         = &cpu_bitmap
110 };
111
112 /* Process (task) creation and context switch activity */
113 struct activity pcsw_act = {
114         .id             = A_PCSW,
115         .options        = AO_COLLECTED,
116         .magic          = ACTIVITY_MAGIC_BASE,
117         .group          = G_DEFAULT,
118 #ifdef SOURCE_SADC
119         .f_count_index  = -1,
120         .f_count2       = NULL,
121         .f_read         = wrap_read_stat_pcsw,
122 #endif
123 #ifdef SOURCE_SAR
124         .f_print        = print_pcsw_stats,
125         .f_print_avg    = print_pcsw_stats,
126 #endif
127 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
128         .hdr_line       = "proc/s;cswch/s",
129 #endif
130         .gtypes_nr      = {1, 1, 0},
131         .ftypes_nr      = {0, 0, 0},
132 #ifdef SOURCE_SADF
133         .f_render       = render_pcsw_stats,
134         .f_xml_print    = xml_print_pcsw_stats,
135         .f_json_print   = json_print_pcsw_stats,
136         .f_svg_print    = svg_print_pcsw_stats,
137         .f_raw_print    = raw_print_pcsw_stats,
138         .name           = "A_PCSW",
139         .g_nr           = 2,
140 #endif
141         .nr             = 1,
142         .nr2            = 1,
143         .nr_max         = 1,
144         .fsize          = STATS_PCSW_SIZE,
145         .msize          = STATS_PCSW_SIZE,
146         .opt_flags      = 0,
147         .buf            = {NULL, NULL, NULL},
148         .bitmap         = NULL
149 };
150
151 /* Interrupts statistics */
152 struct activity irq_act = {
153         .id             = A_IRQ,
154         .options        = AO_COUNTED,
155         .magic          = ACTIVITY_MAGIC_BASE,
156         .group          = G_INT,
157 #ifdef SOURCE_SADC
158         .f_count_index  = 1,    /* wrap_get_irq_nr() */
159         .f_count2       = NULL,
160         .f_read         = wrap_read_stat_irq,
161 #endif
162 #ifdef SOURCE_SAR
163         .f_print        = print_irq_stats,
164         .f_print_avg    = print_irq_stats,
165 #endif
166 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
167         .hdr_line       = "INTR;intr/s",
168 #endif
169         .gtypes_nr      = {1, 0, 0},
170         .ftypes_nr      = {0, 0, 0},
171 #ifdef SOURCE_SADF
172         .f_render       = render_irq_stats,
173         .f_xml_print    = xml_print_irq_stats,
174         .f_json_print   = json_print_irq_stats,
175         .f_svg_print    = NULL,
176         .f_raw_print    = raw_print_irq_stats,
177         .name           = "A_IRQ",
178         .g_nr           = 0,
179 #endif
180         .nr             = -1,
181         .nr2            = 1,
182         .nr_max         = NR_IRQS + 1,
183         .fsize          = STATS_IRQ_SIZE,
184         .msize          = STATS_IRQ_SIZE,
185         .opt_flags      = 0,
186         .buf            = {NULL, NULL, NULL},
187         .bitmap         = &irq_bitmap
188 };
189
190 /* Swapping activity */
191 struct activity swap_act = {
192         .id             = A_SWAP,
193         .options        = AO_COLLECTED,
194         .magic          = ACTIVITY_MAGIC_BASE,
195         .group          = G_DEFAULT,
196 #ifdef SOURCE_SADC
197         .f_count_index  = -1,
198         .f_count2       = NULL,
199         .f_read         = wrap_read_swap,
200 #endif
201 #ifdef SOURCE_SAR
202         .f_print        = print_swap_stats,
203         .f_print_avg    = print_swap_stats,
204 #endif
205 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
206         .hdr_line       = "pswpin/s;pswpout/s",
207 #endif
208         .gtypes_nr      = {0, 2, 0},
209         .ftypes_nr      = {0, 0, 0},
210 #ifdef SOURCE_SADF
211         .f_render       = render_swap_stats,
212         .f_xml_print    = xml_print_swap_stats,
213         .f_json_print   = json_print_swap_stats,
214         .f_svg_print    = svg_print_swap_stats,
215         .f_raw_print    = raw_print_swap_stats,
216         .name           = "A_SWAP",
217         .g_nr           = 1,
218 #endif
219         .nr             = 1,
220         .nr2            = 1,
221         .nr_max         = 1,
222         .fsize          = STATS_SWAP_SIZE,
223         .msize          = STATS_SWAP_SIZE,
224         .opt_flags      = 0,
225         .buf            = {NULL, NULL, NULL},
226         .bitmap         = NULL
227 };
228
229 /* Paging activity */
230 struct activity paging_act = {
231         .id             = A_PAGE,
232         .options        = AO_COLLECTED,
233         .magic          = ACTIVITY_MAGIC_BASE,
234         .group          = G_DEFAULT,
235 #ifdef SOURCE_SADC
236         .f_count_index  = -1,
237         .f_count2       = NULL,
238         .f_read         = wrap_read_paging,
239 #endif
240 #ifdef SOURCE_SAR
241         .f_print        = print_paging_stats,
242         .f_print_avg    = print_paging_stats,
243 #endif
244 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
245         .hdr_line       = "pgpgin/s;pgpgout/s;fault/s;majflt/s;"
246                           "pgfree/s;pgscank/s;pgscand/s;pgsteal/s;%vmeff",
247 #endif
248         .gtypes_nr      = {0, 8, 0},
249         .ftypes_nr      = {0, 0, 0},
250 #ifdef SOURCE_SADF
251         .f_render       = render_paging_stats,
252         .f_xml_print    = xml_print_paging_stats,
253         .f_json_print   = json_print_paging_stats,
254         .f_svg_print    = svg_print_paging_stats,
255         .f_raw_print    = raw_print_paging_stats,
256         .name           = "A_PAGE",
257         .g_nr           = 3,
258 #endif
259         .nr             = 1,
260         .nr2            = 1,
261         .nr_max         = 1,
262         .fsize          = STATS_PAGING_SIZE,
263         .msize          = STATS_PAGING_SIZE,
264         .opt_flags      = 0,
265         .buf            = {NULL, NULL, NULL},
266         .bitmap         = NULL
267 };
268
269 /* I/O and transfer rate activity */
270 struct activity io_act = {
271         .id             = A_IO,
272         .options        = AO_COLLECTED,
273         .magic          = ACTIVITY_MAGIC_BASE + 1,
274         .group          = G_DEFAULT,
275 #ifdef SOURCE_SADC
276         .f_count_index  = -1,
277         .f_count2       = NULL,
278         .f_read         = wrap_read_io,
279 #endif
280 #ifdef SOURCE_SAR
281         .f_print        = print_io_stats,
282         .f_print_avg    = print_io_stats,
283 #endif
284 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
285         .hdr_line       = "tps;rtps;wtps;bread/s;bwrtn/s",
286 #endif
287         .gtypes_nr      = {5, 0, 0},
288         .ftypes_nr      = {0, 0, 0},
289 #ifdef SOURCE_SADF
290         .f_render       = render_io_stats,
291         .f_xml_print    = xml_print_io_stats,
292         .f_json_print   = json_print_io_stats,
293         .f_svg_print    = svg_print_io_stats,
294         .f_raw_print    = raw_print_io_stats,
295         .name           = "A_IO",
296         .g_nr           = 2,
297 #endif
298         .nr             = 1,
299         .nr2            = 1,
300         .nr_max         = 1,
301         .fsize          = STATS_IO_SIZE,
302         .msize          = STATS_IO_SIZE,
303         .opt_flags      = 0,
304         .buf            = {NULL, NULL, NULL},
305         .bitmap         = NULL
306 };
307
308 /* Memory and swap space utilization activity */
309 struct activity memory_act = {
310         .id             = A_MEMORY,
311         .options        = AO_COLLECTED + AO_MULTIPLE_OUTPUTS,
312         .magic          = ACTIVITY_MAGIC_BASE,
313         .group          = G_DEFAULT,
314 #ifdef SOURCE_SADC
315         .f_count_index  = -1,
316         .f_count2       = NULL,
317         .f_read         = wrap_read_meminfo,
318 #endif
319 #ifdef SOURCE_SAR
320         .f_print        = print_memory_stats,
321         .f_print_avg    = print_avg_memory_stats,
322 #endif
323 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
324         .hdr_line       = "kbmemfree;kbavail;kbmemused;%memused;kbbuffers;kbcached;kbcommit;%commit;kbactive;kbinact;kbdirty&kbanonpg;kbslab;kbkstack;kbpgtbl;kbvmused|"
325                           "kbswpfree;kbswpused;%swpused;kbswpcad;%swpcad",
326 #endif
327         .gtypes_nr      = {0, 17, 0},
328         .ftypes_nr      = {0, 0, 0},
329 #ifdef SOURCE_SADF
330         .f_render       = render_memory_stats,
331         .f_xml_print    = xml_print_memory_stats,
332         .f_json_print   = json_print_memory_stats,
333         .f_svg_print    = svg_print_memory_stats,
334         .f_raw_print    = raw_print_memory_stats,
335         .name           = "A_MEMORY",
336         .g_nr           = 9,
337 #endif
338         .nr             = 1,
339         .nr2            = 1,
340         .nr_max         = 1,
341         .fsize          = STATS_MEMORY_SIZE,
342         .msize          = STATS_MEMORY_SIZE,
343         .opt_flags      = 0,
344         .buf            = {NULL, NULL, NULL},
345         .bitmap         = NULL
346 };
347
348 /* Kernel tables activity */
349 struct activity ktables_act = {
350         .id             = A_KTABLES,
351         .options        = AO_COLLECTED,
352         .magic          = ACTIVITY_MAGIC_BASE,
353         .group          = G_DEFAULT,
354 #ifdef SOURCE_SADC
355         .f_count_index  = -1,
356         .f_count2       = NULL,
357         .f_read         = wrap_read_kernel_tables,
358 #endif
359 #ifdef SOURCE_SAR
360         .f_print        = print_ktables_stats,
361         .f_print_avg    = print_avg_ktables_stats,
362 #endif
363 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
364         .hdr_line       = "dentunusd;file-nr;inode-nr;pty-nr",
365 #endif
366         .gtypes_nr      = {0, 0, 4},
367         .ftypes_nr      = {0, 0, 0},
368 #ifdef SOURCE_SADF
369         .f_render       = render_ktables_stats,
370         .f_xml_print    = xml_print_ktables_stats,
371         .f_json_print   = json_print_ktables_stats,
372         .f_svg_print    = svg_print_ktables_stats,
373         .f_raw_print    = raw_print_ktables_stats,
374         .name           = "A_KTABLES",
375         .g_nr           = 2,
376 #endif
377         .nr             = 1,
378         .nr2            = 1,
379         .nr_max         = 1,
380         .fsize          = STATS_KTABLES_SIZE,
381         .msize          = STATS_KTABLES_SIZE,
382         .opt_flags      = 0,
383         .buf            = {NULL, NULL, NULL},
384         .bitmap         = NULL
385 };
386
387 /* Queue and load activity */
388 struct activity queue_act = {
389         .id             = A_QUEUE,
390         .options        = AO_COLLECTED,
391         .magic          = ACTIVITY_MAGIC_BASE + 1,
392         .group          = G_DEFAULT,
393 #ifdef SOURCE_SADC
394         .f_count_index  = -1,
395         .f_count2       = NULL,
396         .f_read         = wrap_read_loadavg,
397 #endif
398 #ifdef SOURCE_SAR
399         .f_print        = print_queue_stats,
400         .f_print_avg    = print_avg_queue_stats,
401 #endif
402 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
403         .hdr_line       = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15;blocked",
404 #endif
405         .gtypes_nr      = {0, 2, 4},
406         .ftypes_nr      = {0, 0, 0},
407 #ifdef SOURCE_SADF
408         .f_render       = render_queue_stats,
409         .f_xml_print    = xml_print_queue_stats,
410         .f_json_print   = json_print_queue_stats,
411         .f_svg_print    = svg_print_queue_stats,
412         .f_raw_print    = raw_print_queue_stats,
413         .name           = "A_QUEUE",
414         .g_nr           = 3,
415 #endif
416         .nr             = 1,
417         .nr2            = 1,
418         .nr_max         = 1,
419         .fsize          = STATS_QUEUE_SIZE,
420         .msize          = STATS_QUEUE_SIZE,
421         .opt_flags      = 0,
422         .buf            = {NULL, NULL, NULL},
423         .bitmap         = NULL
424 };
425
426 /* Serial lines activity */
427 struct activity serial_act = {
428         .id             = A_SERIAL,
429         .options        = AO_COLLECTED + AO_COUNTED,
430         .magic          = ACTIVITY_MAGIC_BASE,
431         .group          = G_DEFAULT,
432 #ifdef SOURCE_SADC
433         .f_count_index  = 2,    /* wrap_get_serial_nr() */
434         .f_count2       = NULL,
435         .f_read         = wrap_read_tty_driver_serial,
436 #endif
437 #ifdef SOURCE_SAR
438         .f_print        = print_serial_stats,
439         .f_print_avg    = print_serial_stats,
440 #endif
441 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
442         .hdr_line       = "TTY;rcvin/s;txmtin/s;framerr/s;prtyerr/s;brk/s;ovrun/s",
443 #endif
444         .gtypes_nr      = {0, 0, 7},
445         .ftypes_nr      = {0, 0, 0},
446 #ifdef SOURCE_SADF
447         .f_render       = render_serial_stats,
448         .f_xml_print    = xml_print_serial_stats,
449         .f_json_print   = json_print_serial_stats,
450         .f_svg_print    = NULL,
451         .f_raw_print    = raw_print_serial_stats,
452         .name           = "A_SERIAL",
453         .g_nr           = 0,
454 #endif
455         .nr             = -1,
456         .nr2            = 1,
457         .nr_max         = MAX_NR_SERIAL_LINES,
458         .fsize          = STATS_SERIAL_SIZE,
459         .msize          = STATS_SERIAL_SIZE,
460         .opt_flags      = 0,
461         .buf            = {NULL, NULL, NULL},
462         .bitmap         = NULL
463 };
464
465 /* Block devices activity */
466 struct activity disk_act = {
467         .id             = A_DISK,
468         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
469         .magic          = ACTIVITY_MAGIC_BASE + 1,
470         .group          = G_DISK,
471 #ifdef SOURCE_SADC
472         .f_count_index  = 3,    /* wrap_get_disk_nr() */
473         .f_count2       = NULL,
474         .f_read         = wrap_read_disk,
475 #endif
476 #ifdef SOURCE_SAR
477         .f_print        = print_disk_stats,
478         .f_print_avg    = print_disk_stats,
479 #endif
480 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
481         .hdr_line       = "DEV;tps;rkB/s;wkB/s;areq-sz;aqu-sz;await;svctm;%util",
482 #endif
483         .gtypes_nr      = {1, 2, 6},
484         .ftypes_nr      = {0, 0, 0},
485 #ifdef SOURCE_SADF
486         .f_render       = render_disk_stats,
487         .f_xml_print    = xml_print_disk_stats,
488         .f_json_print   = json_print_disk_stats,
489         .f_svg_print    = svg_print_disk_stats,
490         .f_raw_print    = raw_print_disk_stats,
491         .name           = "A_DISK",
492         .g_nr           = 5,
493 #endif
494         .nr             = -1,
495         .nr2            = 1,
496         .nr_max         = MAX_NR_DISKS,
497         .fsize          = STATS_DISK_SIZE,
498         .msize          = STATS_DISK_SIZE,
499         .opt_flags      = 0,
500         .buf            = {NULL, NULL, NULL},
501         .bitmap         = NULL
502 };
503
504 /* Network interfaces activity */
505 struct activity net_dev_act = {
506         .id             = A_NET_DEV,
507         .options        = AO_COLLECTED + AO_COUNTED + AO_GRAPH_PER_ITEM,
508         .magic          = ACTIVITY_MAGIC_BASE + 2,
509         .group          = G_DEFAULT,
510 #ifdef SOURCE_SADC
511         .f_count_index  = 4,    /* wrap_get_iface_nr() */
512         .f_count2       = NULL,
513         .f_read         = wrap_read_net_dev,
514 #endif
515 #ifdef SOURCE_SAR
516         .f_print        = print_net_dev_stats,
517         .f_print_avg    = print_net_dev_stats,
518 #endif
519 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
520         .hdr_line       = "IFACE;rxpck/s;txpck/s;rxkB/s;txkB/s;rxcmp/s;txcmp/s;rxmcst/s;%ifutil",
521 #endif
522         .gtypes_nr      = {7, 0, 1},
523         .ftypes_nr      = {0, 0, 0},
524 #ifdef SOURCE_SADF
525         .f_render       = render_net_dev_stats,
526         .f_xml_print    = xml_print_net_dev_stats,
527         .f_json_print   = json_print_net_dev_stats,
528         .f_svg_print    = svg_print_net_dev_stats,
529         .f_raw_print    = raw_print_net_dev_stats,
530         .name           = "A_NET_DEV",
531         .g_nr           = 4,
532 #endif
533         .nr             = -1,
534         .nr2            = 1,
535         .nr_max         = MAX_NR_IFACES,
536         .fsize          = STATS_NET_DEV_SIZE,
537         .msize          = STATS_NET_DEV_SIZE,
538         .opt_flags      = 0,
539         .buf            = {NULL, NULL, NULL},
540         .bitmap         = NULL
541 };
542
543 /* Network interfaces (errors) activity */
544 struct activity net_edev_act = {
545         .id             = A_NET_EDEV,
546         .options        = AO_COLLECTED + AO_COUNTED + AO_GRAPH_PER_ITEM,
547         .magic          = ACTIVITY_MAGIC_BASE + 1,
548         .group          = G_DEFAULT,
549 #ifdef SOURCE_SADC
550         .f_count_index  = 4,    /* wrap_get_iface_nr() */
551         .f_count2       = NULL,
552         .f_read         = wrap_read_net_edev,
553 #endif
554 #ifdef SOURCE_SAR
555         .f_print        = print_net_edev_stats,
556         .f_print_avg    = print_net_edev_stats,
557 #endif
558 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
559         .hdr_line       = "IFACE;rxerr/s;txerr/s;coll/s;rxdrop/s;txdrop/s;"
560                           "txcarr/s;rxfram/s;rxfifo/s;txfifo/s",
561 #endif
562         .gtypes_nr      = {9, 0, 0},
563         .ftypes_nr      = {0, 0, 0},
564 #ifdef SOURCE_SADF
565         .f_render       = render_net_edev_stats,
566         .f_xml_print    = xml_print_net_edev_stats,
567         .f_json_print   = json_print_net_edev_stats,
568         .f_svg_print    = svg_print_net_edev_stats,
569         .f_raw_print    = raw_print_net_edev_stats,
570         .name           = "A_NET_EDEV",
571         .g_nr           = 4,
572 #endif
573         .nr             = -1,
574         .nr2            = 1,
575         .nr_max         = MAX_NR_IFACES,
576         .fsize          = STATS_NET_EDEV_SIZE,
577         .msize          = STATS_NET_EDEV_SIZE,
578         .opt_flags      = 0,
579         .buf            = {NULL, NULL, NULL},
580         .bitmap         = NULL
581 };
582
583 /* NFS client activity */
584 struct activity net_nfs_act = {
585         .id             = A_NET_NFS,
586         .options        = AO_COLLECTED,
587         .magic          = ACTIVITY_MAGIC_BASE,
588         .group          = G_DEFAULT,
589 #ifdef SOURCE_SADC
590         .f_count_index  = -1,
591         .f_count2       = NULL,
592         .f_read         = wrap_read_net_nfs,
593 #endif
594 #ifdef SOURCE_SAR
595         .f_print        = print_net_nfs_stats,
596         .f_print_avg    = print_net_nfs_stats,
597 #endif
598 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
599         .hdr_line       = "call/s;retrans/s;read/s;write/s;access/s;getatt/s",
600 #endif
601         .gtypes_nr      = {0, 0, 6},
602         .ftypes_nr      = {0, 0, 0},
603 #ifdef SOURCE_SADF
604         .f_render       = render_net_nfs_stats,
605         .f_xml_print    = xml_print_net_nfs_stats,
606         .f_json_print   = json_print_net_nfs_stats,
607         .f_svg_print    = svg_print_net_nfs_stats,
608         .f_raw_print    = raw_print_net_nfs_stats,
609         .name           = "A_NET_NFS",
610         .g_nr           = 3,
611 #endif
612         .nr             = 1,
613         .nr2            = 1,
614         .nr_max         = 1,
615         .fsize          = STATS_NET_NFS_SIZE,
616         .msize          = STATS_NET_NFS_SIZE,
617         .opt_flags      = 0,
618         .buf            = {NULL, NULL, NULL},
619         .bitmap         = NULL
620 };
621
622 /* NFS server activity */
623 struct activity net_nfsd_act = {
624         .id             = A_NET_NFSD,
625         .options        = AO_COLLECTED,
626         .magic          = ACTIVITY_MAGIC_BASE,
627         .group          = G_DEFAULT,
628 #ifdef SOURCE_SADC
629         .f_count_index  = -1,
630         .f_count2       = NULL,
631         .f_read         = wrap_read_net_nfsd,
632 #endif
633 #ifdef SOURCE_SAR
634         .f_print        = print_net_nfsd_stats,
635         .f_print_avg    = print_net_nfsd_stats,
636 #endif
637 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
638         .hdr_line       = "scall/s;badcall/s;packet/s;udp/s;tcp/s;hit/s;miss/s;"
639                           "sread/s;swrite/s;saccess/s;sgetatt/s",
640 #endif
641         .gtypes_nr      = {0, 0, 11},
642         .ftypes_nr      = {0, 0, 0},
643 #ifdef SOURCE_SADF
644         .f_render       = render_net_nfsd_stats,
645         .f_xml_print    = xml_print_net_nfsd_stats,
646         .f_json_print   = json_print_net_nfsd_stats,
647         .f_svg_print    = svg_print_net_nfsd_stats,
648         .f_raw_print    = raw_print_net_nfsd_stats,
649         .name           = "A_NET_NFSD",
650         .g_nr           = 5,
651 #endif
652         .nr             = 1,
653         .nr2            = 1,
654         .nr_max         = 1,
655         .fsize          = STATS_NET_NFSD_SIZE,
656         .msize          = STATS_NET_NFSD_SIZE,
657         .opt_flags      = 0,
658         .buf            = {NULL, NULL, NULL},
659         .bitmap         = NULL
660 };
661
662 /* Network sockets activity */
663 struct activity net_sock_act = {
664         .id             = A_NET_SOCK,
665         .options        = AO_COLLECTED,
666         .magic          = ACTIVITY_MAGIC_BASE,
667         .group          = G_DEFAULT,
668 #ifdef SOURCE_SADC
669         .f_count_index  = -1,
670         .f_count2       = NULL,
671         .f_read         = wrap_read_net_sock,
672 #endif
673 #ifdef SOURCE_SAR
674         .f_print        = print_net_sock_stats,
675         .f_print_avg    = print_avg_net_sock_stats,
676 #endif
677 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
678         .hdr_line       = "totsck;tcpsck;udpsck;rawsck;ip-frag;tcp-tw",
679 #endif
680         .gtypes_nr      = {0, 0, 6},
681         .ftypes_nr      = {0, 0, 0},
682 #ifdef SOURCE_SADF
683         .f_render       = render_net_sock_stats,
684         .f_xml_print    = xml_print_net_sock_stats,
685         .f_json_print   = json_print_net_sock_stats,
686         .f_svg_print    = svg_print_net_sock_stats,
687         .f_raw_print    = raw_print_net_sock_stats,
688         .name           = "A_NET_SOCK",
689         .g_nr           = 2,
690 #endif
691         .nr             = 1,
692         .nr2            = 1,
693         .nr_max         = 1,
694         .fsize          = STATS_NET_SOCK_SIZE,
695         .msize          = STATS_NET_SOCK_SIZE,
696         .opt_flags      = 0,
697         .buf            = {NULL, NULL, NULL},
698         .bitmap         = NULL
699 };
700
701 /* IP network traffic activity */
702 struct activity net_ip_act = {
703         .id             = A_NET_IP,
704         .options        = AO_NULL,
705         .magic          = ACTIVITY_MAGIC_BASE + 1,
706         .group          = G_SNMP,
707 #ifdef SOURCE_SADC
708         .f_count_index  = -1,
709         .f_count2       = NULL,
710         .f_read         = wrap_read_net_ip,
711 #endif
712 #ifdef SOURCE_SAR
713         .f_print        = print_net_ip_stats,
714         .f_print_avg    = print_net_ip_stats,
715 #endif
716 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
717         .hdr_line       = "irec/s;fwddgm/s;idel/s;orq/s;asmrq/s;asmok/s;fragok/s;fragcrt/s",
718 #endif
719         .gtypes_nr      = {8, 0, 0},
720         .ftypes_nr      = {0, 0, 0},
721 #ifdef SOURCE_SADF
722         .f_render       = render_net_ip_stats,
723         .f_xml_print    = xml_print_net_ip_stats,
724         .f_json_print   = json_print_net_ip_stats,
725         .f_svg_print    = svg_print_net_ip_stats,
726         .f_raw_print    = raw_print_net_ip_stats,
727         .name           = "A_NET_IP",
728         .g_nr           = 3,
729 #endif
730         .nr             = 1,
731         .nr2            = 1,
732         .nr_max         = 1,
733         .fsize          = STATS_NET_IP_SIZE,
734         .msize          = STATS_NET_IP_SIZE,
735         .opt_flags      = 0,
736         .buf            = {NULL, NULL, NULL},
737         .bitmap         = NULL
738 };
739
740 /* IP network traffic (errors) activity */
741 struct activity net_eip_act = {
742         .id             = A_NET_EIP,
743         .options        = AO_NULL,
744         .magic          = ACTIVITY_MAGIC_BASE + 1,
745         .group          = G_SNMP,
746 #ifdef SOURCE_SADC
747         .f_count_index  = -1,
748         .f_count2       = NULL,
749         .f_read         = wrap_read_net_eip,
750 #endif
751 #ifdef SOURCE_SAR
752         .f_print        = print_net_eip_stats,
753         .f_print_avg    = print_net_eip_stats,
754 #endif
755 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
756         .hdr_line       = "ihdrerr/s;iadrerr/s;iukwnpr/s;idisc/s;odisc/s;onort/s;asmf/s;fragf/s",
757 #endif
758         .gtypes_nr      = {8, 0, 0},
759         .ftypes_nr      = {0, 0, 0},
760 #ifdef SOURCE_SADF
761         .f_render       = render_net_eip_stats,
762         .f_xml_print    = xml_print_net_eip_stats,
763         .f_json_print   = json_print_net_eip_stats,
764         .f_svg_print    = svg_print_net_eip_stats,
765         .f_raw_print    = raw_print_net_eip_stats,
766         .name           = "A_NET_EIP",
767         .g_nr           = 3,
768 #endif
769         .nr             = 1,
770         .nr2            = 1,
771         .nr_max         = 1,
772         .fsize          = STATS_NET_EIP_SIZE,
773         .msize          = STATS_NET_EIP_SIZE,
774         .opt_flags      = 0,
775         .buf            = {NULL, NULL, NULL},
776         .bitmap         = NULL
777 };
778
779 /* ICMP network traffic activity */
780 struct activity net_icmp_act = {
781         .id             = A_NET_ICMP,
782         .options        = AO_NULL,
783         .magic          = ACTIVITY_MAGIC_BASE,
784         .group          = G_SNMP,
785 #ifdef SOURCE_SADC
786         .f_count_index  = -1,
787         .f_count2       = NULL,
788         .f_read         = wrap_read_net_icmp,
789 #endif
790 #ifdef SOURCE_SAR
791         .f_print        = print_net_icmp_stats,
792         .f_print_avg    = print_net_icmp_stats,
793 #endif
794 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
795         .hdr_line       = "imsg/s;omsg/s;iech/s;iechr/s;oech/s;oechr/s;itm/s;itmr/s;otm/s;"
796                           "otmr/s;iadrmk/s;iadrmkr/s;oadrmk/s;oadrmkr/s",
797 #endif
798         .gtypes_nr      = {0, 14, 0},
799         .ftypes_nr      = {0, 0, 0},
800 #ifdef SOURCE_SADF
801         .f_render       = render_net_icmp_stats,
802         .f_xml_print    = xml_print_net_icmp_stats,
803         .f_json_print   = json_print_net_icmp_stats,
804         .f_svg_print    = svg_print_net_icmp_stats,
805         .f_raw_print    = raw_print_net_icmp_stats,
806         .name           = "A_NET_ICMP",
807         .g_nr           = 4,
808 #endif
809         .nr             = 1,
810         .nr2            = 1,
811         .nr_max         = 1,
812         .fsize          = STATS_NET_ICMP_SIZE,
813         .msize          = STATS_NET_ICMP_SIZE,
814         .opt_flags      = 0,
815         .buf            = {NULL, NULL, NULL},
816         .bitmap         = NULL
817 };
818
819 /* ICMP network traffic (errors) activity */
820 struct activity net_eicmp_act = {
821         .id             = A_NET_EICMP,
822         .options        = AO_NULL,
823         .magic          = ACTIVITY_MAGIC_BASE,
824         .group          = G_SNMP,
825 #ifdef SOURCE_SADC
826         .f_count_index  = -1,
827         .f_count2       = NULL,
828         .f_read         = wrap_read_net_eicmp,
829 #endif
830 #ifdef SOURCE_SAR
831         .f_print        = print_net_eicmp_stats,
832         .f_print_avg    = print_net_eicmp_stats,
833 #endif
834 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
835         .hdr_line       = "ierr/s;oerr/s;idstunr/s;odstunr/s;itmex/s;otmex/s;"
836                           "iparmpb/s;oparmpb/s;isrcq/s;osrcq/s;iredir/s;oredir/s",
837 #endif
838         .gtypes_nr      = {0, 12, 0},
839         .ftypes_nr      = {0, 0, 0},
840 #ifdef SOURCE_SADF
841         .f_render       = render_net_eicmp_stats,
842         .f_xml_print    = xml_print_net_eicmp_stats,
843         .f_json_print   = json_print_net_eicmp_stats,
844         .f_svg_print    = svg_print_net_eicmp_stats,
845         .f_raw_print    = raw_print_net_eicmp_stats,
846         .name           = "A_NET_EICMP",
847         .g_nr           = 6,
848 #endif
849         .nr             = 1,
850         .nr2            = 1,
851         .nr_max         = 1,
852         .fsize          = STATS_NET_EICMP_SIZE,
853         .msize          = STATS_NET_EICMP_SIZE,
854         .opt_flags      = 0,
855         .buf            = {NULL, NULL, NULL},
856         .bitmap         = NULL
857 };
858
859 /* TCP network traffic activity */
860 struct activity net_tcp_act = {
861         .id             = A_NET_TCP,
862         .options        = AO_NULL,
863         .magic          = ACTIVITY_MAGIC_BASE,
864         .group          = G_SNMP,
865 #ifdef SOURCE_SADC
866         .f_count_index  = -1,
867         .f_count2       = NULL,
868         .f_read         = wrap_read_net_tcp,
869 #endif
870 #ifdef SOURCE_SAR
871         .f_print        = print_net_tcp_stats,
872         .f_print_avg    = print_net_tcp_stats,
873 #endif
874 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
875         .hdr_line       = "active/s;passive/s;iseg/s;oseg/s",
876 #endif
877         .gtypes_nr      = {0, 4, 0},
878         .ftypes_nr      = {0, 0, 0},
879 #ifdef SOURCE_SADF
880         .f_render       = render_net_tcp_stats,
881         .f_xml_print    = xml_print_net_tcp_stats,
882         .f_json_print   = json_print_net_tcp_stats,
883         .f_svg_print    = svg_print_net_tcp_stats,
884         .f_raw_print    = raw_print_net_tcp_stats,
885         .name           = "A_NET_TCP",
886         .g_nr           = 2,
887 #endif
888         .nr             = 1,
889         .nr2            = 1,
890         .nr_max         = 1,
891         .fsize          = STATS_NET_TCP_SIZE,
892         .msize          = STATS_NET_TCP_SIZE,
893         .opt_flags      = 0,
894         .buf            = {NULL, NULL, NULL},
895         .bitmap         = NULL
896 };
897
898 /* TCP network traffic (errors) activity */
899 struct activity net_etcp_act = {
900         .id             = A_NET_ETCP,
901         .options        = AO_NULL,
902         .magic          = ACTIVITY_MAGIC_BASE,
903         .group          = G_SNMP,
904 #ifdef SOURCE_SADC
905         .f_count_index  = -1,
906         .f_count2       = NULL,
907         .f_read         = wrap_read_net_etcp,
908 #endif
909 #ifdef SOURCE_SAR
910         .f_print        = print_net_etcp_stats,
911         .f_print_avg    = print_net_etcp_stats,
912 #endif
913 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
914         .hdr_line       = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s",
915 #endif
916         .gtypes_nr      = {0, 5, 0},
917         .ftypes_nr      = {0, 0, 0},
918 #ifdef SOURCE_SADF
919         .f_render       = render_net_etcp_stats,
920         .f_xml_print    = xml_print_net_etcp_stats,
921         .f_json_print   = json_print_net_etcp_stats,
922         .f_svg_print    = svg_print_net_etcp_stats,
923         .f_raw_print    = raw_print_net_etcp_stats,
924         .name           = "A_NET_ETCP",
925         .g_nr           = 2,
926 #endif
927         .nr             = 1,
928         .nr2            = 1,
929         .nr_max         = 1,
930         .fsize          = STATS_NET_ETCP_SIZE,
931         .msize          = STATS_NET_ETCP_SIZE,
932         .opt_flags      = 0,
933         .buf            = {NULL, NULL, NULL},
934         .bitmap         = NULL
935 };
936
937 /* UDP network traffic activity */
938 struct activity net_udp_act = {
939         .id             = A_NET_UDP,
940         .options        = AO_NULL,
941         .magic          = ACTIVITY_MAGIC_BASE,
942         .group          = G_SNMP,
943 #ifdef SOURCE_SADC
944         .f_count_index  = -1,
945         .f_count2       = NULL,
946         .f_read         = wrap_read_net_udp,
947 #endif
948 #ifdef SOURCE_SAR
949         .f_print        = print_net_udp_stats,
950         .f_print_avg    = print_net_udp_stats,
951 #endif
952 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
953         .hdr_line       = "idgm/s;odgm/s;noport/s;idgmerr/s",
954 #endif
955         .gtypes_nr      = {0, 4, 0},
956         .ftypes_nr      = {0, 0, 0},
957 #ifdef SOURCE_SADF
958         .f_render       = render_net_udp_stats,
959         .f_xml_print    = xml_print_net_udp_stats,
960         .f_json_print   = json_print_net_udp_stats,
961         .f_svg_print    = svg_print_net_udp_stats,
962         .f_raw_print    = raw_print_net_udp_stats,
963         .name           = "A_NET_UDP",
964         .g_nr           = 2,
965 #endif
966         .nr             = 1,
967         .nr2            = 1,
968         .nr_max         = 1,
969         .fsize          = STATS_NET_UDP_SIZE,
970         .msize          = STATS_NET_UDP_SIZE,
971         .opt_flags      = 0,
972         .buf            = {NULL, NULL, NULL},
973         .bitmap         = NULL
974 };
975
976 /* IPv6 sockets activity */
977 struct activity net_sock6_act = {
978         .id             = A_NET_SOCK6,
979         .options        = AO_NULL,
980         .magic          = ACTIVITY_MAGIC_BASE,
981         .group          = G_IPV6,
982 #ifdef SOURCE_SADC
983         .f_count_index  = -1,
984         .f_count2       = NULL,
985         .f_read         = wrap_read_net_sock6,
986 #endif
987 #ifdef SOURCE_SAR
988         .f_print        = print_net_sock6_stats,
989         .f_print_avg    = print_avg_net_sock6_stats,
990 #endif
991 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
992         .hdr_line       = "tcp6sck;udp6sck;raw6sck;ip6-frag",
993 #endif
994         .gtypes_nr      = {0, 0, 4},
995         .ftypes_nr      = {0, 0, 0},
996 #ifdef SOURCE_SADF
997         .f_render       = render_net_sock6_stats,
998         .f_xml_print    = xml_print_net_sock6_stats,
999         .f_json_print   = json_print_net_sock6_stats,
1000         .f_svg_print    = svg_print_net_sock6_stats,
1001         .f_raw_print    = raw_print_net_sock6_stats,
1002         .name           = "A_NET_SOCK6",
1003         .g_nr           = 1,
1004 #endif
1005         .nr             = 1,
1006         .nr2            = 1,
1007         .nr_max         = 1,
1008         .fsize          = STATS_NET_SOCK6_SIZE,
1009         .msize          = STATS_NET_SOCK6_SIZE,
1010         .opt_flags      = 0,
1011         .buf            = {NULL, NULL, NULL},
1012         .bitmap         = NULL
1013 };
1014
1015 /* IPv6 network traffic activity */
1016 struct activity net_ip6_act = {
1017         .id             = A_NET_IP6,
1018         .options        = AO_NULL,
1019         .magic          = ACTIVITY_MAGIC_BASE + 1,
1020         .group          = G_IPV6,
1021 #ifdef SOURCE_SADC
1022         .f_count_index  = -1,
1023         .f_count2       = NULL,
1024         .f_read         = wrap_read_net_ip6,
1025 #endif
1026 #ifdef SOURCE_SAR
1027         .f_print        = print_net_ip6_stats,
1028         .f_print_avg    = print_net_ip6_stats,
1029 #endif
1030 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1031         .hdr_line       = "irec6/s;fwddgm6/s;idel6/s;orq6/s;asmrq6/s;asmok6/s;"
1032                           "imcpck6/s;omcpck6/s;fragok6/s;fragcr6/s",
1033 #endif
1034         .gtypes_nr      = {10, 0, 0},
1035         .ftypes_nr      = {0, 0, 0},
1036 #ifdef SOURCE_SADF
1037         .f_render       = render_net_ip6_stats,
1038         .f_xml_print    = xml_print_net_ip6_stats,
1039         .f_json_print   = json_print_net_ip6_stats,
1040         .f_svg_print    = svg_print_net_ip6_stats,
1041         .f_raw_print    = raw_print_net_ip6_stats,
1042         .name           = "A_NET_IP6",
1043         .g_nr           = 4,
1044 #endif
1045         .nr             = 1,
1046         .nr2            = 1,
1047         .nr_max         = 1,
1048         .fsize          = STATS_NET_IP6_SIZE,
1049         .msize          = STATS_NET_IP6_SIZE,
1050         .opt_flags      = 0,
1051         .buf            = {NULL, NULL, NULL},
1052         .bitmap         = NULL
1053 };
1054
1055 /* IPv6 network traffic (errors) activity */
1056 struct activity net_eip6_act = {
1057         .id             = A_NET_EIP6,
1058         .options        = AO_NULL,
1059         .magic          = ACTIVITY_MAGIC_BASE + 1,
1060         .group          = G_IPV6,
1061 #ifdef SOURCE_SADC
1062         .f_count_index  = -1,
1063         .f_count2       = NULL,
1064         .f_read         = wrap_read_net_eip6,
1065 #endif
1066 #ifdef SOURCE_SAR
1067         .f_print        = print_net_eip6_stats,
1068         .f_print_avg    = print_net_eip6_stats,
1069 #endif
1070 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1071         .hdr_line       = "ihdrer6/s;iadrer6/s;iukwnp6/s;i2big6/s;idisc6/s;odisc6/s;"
1072                           "inort6/s;onort6/s;asmf6/s;fragf6/s;itrpck6/s",
1073 #endif
1074         .gtypes_nr      = {11, 0, 0},
1075         .ftypes_nr      = {0, 0, 0},
1076 #ifdef SOURCE_SADF
1077         .f_render       = render_net_eip6_stats,
1078         .f_xml_print    = xml_print_net_eip6_stats,
1079         .f_json_print   = json_print_net_eip6_stats,
1080         .f_svg_print    = svg_print_net_eip6_stats,
1081         .f_raw_print    = raw_print_net_eip6_stats,
1082         .name           = "A_NET_EIP6",
1083         .g_nr           = 4,
1084 #endif
1085         .nr             = 1,
1086         .nr2            = 1,
1087         .nr_max         = 1,
1088         .fsize          = STATS_NET_EIP6_SIZE,
1089         .msize          = STATS_NET_EIP6_SIZE,
1090         .opt_flags      = 0,
1091         .buf            = {NULL, NULL, NULL},
1092         .bitmap         = NULL
1093 };
1094
1095 /* ICMPv6 network traffic activity */
1096 struct activity net_icmp6_act = {
1097         .id             = A_NET_ICMP6,
1098         .options        = AO_NULL,
1099         .magic          = ACTIVITY_MAGIC_BASE,
1100         .group          = G_IPV6,
1101 #ifdef SOURCE_SADC
1102         .f_count_index  = -1,
1103         .f_count2       = NULL,
1104         .f_read         = wrap_read_net_icmp6,
1105 #endif
1106 #ifdef SOURCE_SAR
1107         .f_print        = print_net_icmp6_stats,
1108         .f_print_avg    = print_net_icmp6_stats,
1109 #endif
1110 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1111         .hdr_line       = "imsg6/s;omsg6/s;iech6/s;iechr6/s;oechr6/s;igmbq6/s;igmbr6/s;ogmbr6/s;"
1112                           "igmbrd6/s;ogmbrd6/s;irtsol6/s;ortsol6/s;irtad6/s;inbsol6/s;onbsol6/s;"
1113                           "inbad6/s;onbad6/s",
1114 #endif
1115         .gtypes_nr      = {0, 17, 0},
1116         .ftypes_nr      = {0, 0, 0},
1117 #ifdef SOURCE_SADF
1118         .f_render       = render_net_icmp6_stats,
1119         .f_xml_print    = xml_print_net_icmp6_stats,
1120         .f_json_print   = json_print_net_icmp6_stats,
1121         .f_svg_print    = svg_print_net_icmp6_stats,
1122         .f_raw_print    = raw_print_net_icmp6_stats,
1123         .name           = "A_NET_ICMP6",
1124         .g_nr           = 5,
1125 #endif
1126         .nr             = 1,
1127         .nr2            = 1,
1128         .nr_max         = 1,
1129         .fsize          = STATS_NET_ICMP6_SIZE,
1130         .msize          = STATS_NET_ICMP6_SIZE,
1131         .opt_flags      = 0,
1132         .buf            = {NULL, NULL, NULL},
1133         .bitmap         = NULL
1134 };
1135
1136 /* ICMPv6 network traffic (errors) activity */
1137 struct activity net_eicmp6_act = {
1138         .id             = A_NET_EICMP6,
1139         .options        = AO_NULL,
1140         .magic          = ACTIVITY_MAGIC_BASE,
1141         .group          = G_IPV6,
1142 #ifdef SOURCE_SADC
1143         .f_count_index  = -1,
1144         .f_count2       = NULL,
1145         .f_read         = wrap_read_net_eicmp6,
1146 #endif
1147 #ifdef SOURCE_SAR
1148         .f_print        = print_net_eicmp6_stats,
1149         .f_print_avg    = print_net_eicmp6_stats,
1150 #endif
1151 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1152         .hdr_line       = "ierr6/s;idtunr6/s;odtunr6/s;itmex6/s;otmex6/s;"
1153                           "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s",
1154 #endif
1155         .gtypes_nr      = {0, 11, 0},
1156         .ftypes_nr      = {0, 0, 0},
1157 #ifdef SOURCE_SADF
1158         .f_render       = render_net_eicmp6_stats,
1159         .f_xml_print    = xml_print_net_eicmp6_stats,
1160         .f_json_print   = json_print_net_eicmp6_stats,
1161         .f_svg_print    = svg_print_net_eicmp6_stats,
1162         .f_raw_print    = raw_print_net_eicmp6_stats,
1163         .name           = "A_NET_EICMP6",
1164         .g_nr           = 6,
1165 #endif
1166         .nr             = 1,
1167         .nr2            = 1,
1168         .nr_max         = 1,
1169         .fsize          = STATS_NET_EICMP6_SIZE,
1170         .msize          = STATS_NET_EICMP6_SIZE,
1171         .opt_flags      = 0,
1172         .buf            = {NULL, NULL, NULL},
1173         .bitmap         = NULL
1174 };
1175
1176 /* UDPv6 network traffic activity */
1177 struct activity net_udp6_act = {
1178         .id             = A_NET_UDP6,
1179         .options        = AO_NULL,
1180         .magic          = ACTIVITY_MAGIC_BASE,
1181         .group          = G_IPV6,
1182 #ifdef SOURCE_SADC
1183         .f_count_index  = -1,
1184         .f_count2       = NULL,
1185         .f_read         = wrap_read_net_udp6,
1186 #endif
1187 #ifdef SOURCE_SAR
1188         .f_print        = print_net_udp6_stats,
1189         .f_print_avg    = print_net_udp6_stats,
1190 #endif
1191 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1192         .hdr_line       = "idgm6/s;odgm6/s;noport6/s;idgmer6/s",
1193 #endif
1194         .gtypes_nr      = {0, 4, 0},
1195         .ftypes_nr      = {0, 0, 0},
1196 #ifdef SOURCE_SADF
1197         .f_render       = render_net_udp6_stats,
1198         .f_xml_print    = xml_print_net_udp6_stats,
1199         .f_json_print   = json_print_net_udp6_stats,
1200         .f_svg_print    = svg_print_net_udp6_stats,
1201         .f_raw_print    = raw_print_net_udp6_stats,
1202         .name           = "A_NET_UDP6",
1203         .g_nr           = 2,
1204 #endif
1205         .nr             = 1,
1206         .nr2            = 1,
1207         .nr_max         = 1,
1208         .fsize          = STATS_NET_UDP6_SIZE,
1209         .msize          = STATS_NET_UDP6_SIZE,
1210         .opt_flags      = 0,
1211         .buf            = {NULL, NULL, NULL},
1212         .bitmap         = NULL
1213 };
1214
1215 /* CPU frequency */
1216 struct activity pwr_cpufreq_act = {
1217         .id             = A_PWR_CPUFREQ,
1218         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1219         .magic          = ACTIVITY_MAGIC_BASE,
1220         .group          = G_POWER,
1221 #ifdef SOURCE_SADC
1222         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1223         .f_count2       = NULL,
1224         .f_read         = wrap_read_cpuinfo,
1225 #endif
1226 #ifdef SOURCE_SAR
1227         .f_print        = print_pwr_cpufreq_stats,
1228         .f_print_avg    = print_avg_pwr_cpufreq_stats,
1229 #endif
1230 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1231         .hdr_line       = "CPU;MHz",
1232 #endif
1233         .gtypes_nr      = {0, 1, 0},
1234         .ftypes_nr      = {0, 0, 0},
1235 #ifdef SOURCE_SADF
1236         .f_render       = render_pwr_cpufreq_stats,
1237         .f_xml_print    = xml_print_pwr_cpufreq_stats,
1238         .f_json_print   = json_print_pwr_cpufreq_stats,
1239         .f_svg_print    = svg_print_pwr_cpufreq_stats,
1240         .f_raw_print    = raw_print_pwr_cpufreq_stats,
1241         .name           = "A_PWR_CPUFREQ",
1242         .g_nr           = 1,
1243 #endif
1244         .nr             = -1,
1245         .nr2            = 1,
1246         .nr_max         = NR_CPUS + 1,
1247         .fsize          = STATS_PWR_CPUFREQ_SIZE,
1248         .msize          = STATS_PWR_CPUFREQ_SIZE,
1249         .opt_flags      = 0,
1250         .buf            = {NULL, NULL, NULL},
1251         .bitmap         = &cpu_bitmap
1252 };
1253
1254 /* Fan */
1255 struct activity pwr_fan_act = {
1256         .id             = A_PWR_FAN,
1257         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1258         .magic          = ACTIVITY_MAGIC_BASE,
1259         .group          = G_POWER,
1260 #ifdef SOURCE_SADC
1261         .f_count_index  = 5,    /* wrap_get_fan_nr() */
1262         .f_count2       = NULL,
1263         .f_read         = wrap_read_fan,
1264 #endif
1265 #ifdef SOURCE_SAR
1266         .f_print        = print_pwr_fan_stats,
1267         .f_print_avg    = print_avg_pwr_fan_stats,
1268 #endif
1269 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1270         .hdr_line       = "FAN;DEVICE;rpm;drpm",
1271 #endif
1272         .gtypes_nr      = {2, 0, 0},
1273         .ftypes_nr      = {0, 0, 0},
1274 #ifdef SOURCE_SADF
1275         .f_render       = render_pwr_fan_stats,
1276         .f_xml_print    = xml_print_pwr_fan_stats,
1277         .f_json_print   = json_print_pwr_fan_stats,
1278         .f_svg_print    = svg_print_pwr_fan_stats,
1279         .f_raw_print    = raw_print_pwr_fan_stats,
1280         .name           = "A_PWR_FAN",
1281         .g_nr           = 1,
1282 #endif
1283         .nr             = -1,
1284         .nr2            = 1,
1285         .nr_max         = MAX_NR_FANS,
1286         .fsize          = STATS_PWR_FAN_SIZE,
1287         .msize          = STATS_PWR_FAN_SIZE,
1288         .opt_flags      = 0,
1289         .buf            = {NULL, NULL, NULL},
1290         .bitmap         = NULL
1291 };
1292
1293 /* Temperature */
1294 struct activity pwr_temp_act = {
1295         .id             = A_PWR_TEMP,
1296         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1297         .magic          = ACTIVITY_MAGIC_BASE,
1298         .group          = G_POWER,
1299 #ifdef SOURCE_SADC
1300         .f_count_index  = 6,    /* wrap_get_temp_nr() */
1301         .f_count2       = NULL,
1302         .f_read         = wrap_read_temp,
1303 #endif
1304 #ifdef SOURCE_SAR
1305         .f_print        = print_pwr_temp_stats,
1306         .f_print_avg    = print_avg_pwr_temp_stats,
1307 #endif
1308 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1309         .hdr_line       = "TEMP;DEVICE;degC;%temp",
1310 #endif
1311         .gtypes_nr      = {3, 0, 0},
1312         .ftypes_nr      = {0, 0, 0},
1313 #ifdef SOURCE_SADF
1314         .f_render       = render_pwr_temp_stats,
1315         .f_xml_print    = xml_print_pwr_temp_stats,
1316         .f_json_print   = json_print_pwr_temp_stats,
1317         .f_svg_print    = svg_print_pwr_temp_stats,
1318         .f_raw_print    = raw_print_pwr_temp_stats,
1319         .name           = "A_PWR_TEMP",
1320         .g_nr           = 2,
1321 #endif
1322         .nr             = -1,
1323         .nr2            = 1,
1324         .nr_max         = MAX_NR_TEMP_SENSORS,
1325         .fsize          = STATS_PWR_TEMP_SIZE,
1326         .msize          = STATS_PWR_TEMP_SIZE,
1327         .opt_flags      = 0,
1328         .buf            = {NULL, NULL, NULL},
1329         .bitmap         = NULL
1330 };
1331
1332 /* Voltage inputs */
1333 struct activity pwr_in_act = {
1334         .id             = A_PWR_IN,
1335         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1336         .magic          = ACTIVITY_MAGIC_BASE,
1337         .group          = G_POWER,
1338 #ifdef SOURCE_SADC
1339         .f_count_index  = 7,    /* wrap_get_in_nr() */
1340         .f_count2       = NULL,
1341         .f_read         = wrap_read_in,
1342 #endif
1343 #ifdef SOURCE_SAR
1344         .f_print        = print_pwr_in_stats,
1345         .f_print_avg    = print_avg_pwr_in_stats,
1346 #endif
1347 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1348         .hdr_line       = "IN;DEVICE;inV;%in",
1349 #endif
1350         .gtypes_nr      = {3, 0, 0},
1351         .ftypes_nr      = {0, 0, 0},
1352 #ifdef SOURCE_SADF
1353         .f_render       = render_pwr_in_stats,
1354         .f_xml_print    = xml_print_pwr_in_stats,
1355         .f_json_print   = json_print_pwr_in_stats,
1356         .f_svg_print    = svg_print_pwr_in_stats,
1357         .f_raw_print    = raw_print_pwr_in_stats,
1358         .name           = "A_PWR_IN",
1359         .g_nr           = 2,
1360 #endif
1361         .nr             = -1,
1362         .nr2            = 1,
1363         .nr_max         = MAX_NR_IN_SENSORS,
1364         .fsize          = STATS_PWR_IN_SIZE,
1365         .msize          = STATS_PWR_IN_SIZE,
1366         .opt_flags      = 0,
1367         .buf            = {NULL, NULL, NULL},
1368         .bitmap         = NULL
1369 };
1370
1371 /* Hugepages activity */
1372 struct activity huge_act = {
1373         .id             = A_HUGE,
1374         .options        = AO_COLLECTED,
1375         .magic          = ACTIVITY_MAGIC_BASE,
1376         .group          = G_DEFAULT,
1377 #ifdef SOURCE_SADC
1378         .f_count_index  = -1,
1379         .f_count2       = NULL,
1380         .f_read         = wrap_read_meminfo_huge,
1381 #endif
1382 #ifdef SOURCE_SAR
1383         .f_print        = print_huge_stats,
1384         .f_print_avg    = print_avg_huge_stats,
1385 #endif
1386 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1387         .hdr_line       = "kbhugfree;kbhugused;%hugused",
1388 #endif
1389         .gtypes_nr      = {0, 2, 0},
1390         .ftypes_nr      = {0, 0, 0},
1391 #ifdef SOURCE_SADF
1392         .f_render       = render_huge_stats,
1393         .f_xml_print    = xml_print_huge_stats,
1394         .f_json_print   = json_print_huge_stats,
1395         .f_svg_print    = svg_print_huge_stats,
1396         .f_raw_print    = raw_print_huge_stats,
1397         .name           = "A_HUGE",
1398         .g_nr           = 2,
1399 #endif
1400         .nr             = 1,
1401         .nr2            = 1,
1402         .nr_max         = 1,
1403         .fsize          = STATS_HUGE_SIZE,
1404         .msize          = STATS_HUGE_SIZE,
1405         .opt_flags      = 0,
1406         .buf            = {NULL, NULL, NULL},
1407         .bitmap         = NULL
1408 };
1409
1410 /* CPU weighted frequency */
1411 struct activity pwr_wghfreq_act = {
1412         .id             = A_PWR_WGHFREQ,
1413         .options        = AO_COUNTED + AO_MATRIX,
1414         .magic          = ACTIVITY_MAGIC_BASE,
1415         .group          = G_POWER,
1416 #ifdef SOURCE_SADC
1417         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1418         .f_count2       = wrap_get_freq_nr,
1419         .f_read         = wrap_read_time_in_state,
1420 #endif
1421 #ifdef SOURCE_SAR
1422         .f_print        = print_pwr_wghfreq_stats,
1423         .f_print_avg    = print_pwr_wghfreq_stats,
1424 #endif
1425 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1426         .hdr_line       = "CPU;wghMHz",
1427 #endif
1428         .gtypes_nr      = {1, 1, 0},
1429         .ftypes_nr      = {0, 0, 0},
1430 #ifdef SOURCE_SADF
1431         .f_render       = render_pwr_wghfreq_stats,
1432         .f_xml_print    = xml_print_pwr_wghfreq_stats,
1433         .f_json_print   = json_print_pwr_wghfreq_stats,
1434         .f_svg_print    = NULL,
1435         .f_raw_print    = raw_print_pwr_wghfreq_stats,
1436         .name           = "A_PWR_WGHFREQ",
1437         .g_nr           = 0,
1438 #endif
1439         .nr             = -1,
1440         .nr2            = -1,
1441         .nr_max         = NR_CPUS + 1,
1442         .fsize          = STATS_PWR_WGHFREQ_SIZE,
1443         .msize          = STATS_PWR_WGHFREQ_SIZE,
1444         .opt_flags      = 0,
1445         .buf            = {NULL, NULL, NULL},
1446         .bitmap         = &cpu_bitmap
1447 };
1448
1449 /* USB devices plugged into the system */
1450 struct activity pwr_usb_act = {
1451         .id             = A_PWR_USB,
1452         .options        = AO_COUNTED + AO_CLOSE_MARKUP,
1453         .magic          = ACTIVITY_MAGIC_BASE,
1454         .group          = G_POWER,
1455 #ifdef SOURCE_SADC
1456         .f_count_index  = 8,    /* wrap_get_usb_nr() */
1457         .f_count2       = NULL,
1458         .f_read         = wrap_read_bus_usb_dev,
1459 #endif
1460 #ifdef SOURCE_SAR
1461         .f_print        = print_pwr_usb_stats,
1462         .f_print_avg    = print_avg_pwr_usb_stats,
1463 #endif
1464 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1465         .hdr_line       = "manufact;product;BUS;idvendor;idprod;maxpower",
1466 #endif
1467         .gtypes_nr      = {0, 0, 4},
1468         .ftypes_nr      = {0, 0, 0},
1469 #ifdef SOURCE_SADF
1470         .f_render       = render_pwr_usb_stats,
1471         .f_xml_print    = xml_print_pwr_usb_stats,
1472         .f_json_print   = json_print_pwr_usb_stats,
1473         .f_svg_print    = NULL,
1474         .f_raw_print    = raw_print_pwr_usb_stats,
1475         .name           = "A_PWR_USB",
1476         .g_nr           = 0,
1477 #endif
1478         .nr             = -1,
1479         .nr2            = 1,
1480         .nr_max         = MAX_NR_USB,
1481         .fsize          = STATS_PWR_USB_SIZE,
1482         .msize          = STATS_PWR_USB_SIZE,
1483         .opt_flags      = 0,
1484         .buf            = {NULL, NULL, NULL},
1485         .bitmap         = NULL
1486 };
1487
1488 /* Filesystem usage activity */
1489 struct activity filesystem_act = {
1490         .id             = A_FILESYSTEM,
1491         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM + AO_MULTIPLE_OUTPUTS,
1492         .magic          = ACTIVITY_MAGIC_BASE,
1493         .group          = G_XDISK,
1494 #ifdef SOURCE_SADC
1495         .f_count_index  = 9,    /* wrap_get_filesystem_nr() */
1496         .f_count2       = NULL,
1497         .f_read         = wrap_read_filesystem,
1498 #endif
1499 #ifdef SOURCE_SAR
1500         .f_print        = print_filesystem_stats,
1501         .f_print_avg    = print_avg_filesystem_stats,
1502 #endif
1503 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1504         .hdr_line       = "FILESYSTEM;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused|"
1505                           "MOUNTPOINT;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused",
1506 #endif
1507         .gtypes_nr      = {5, 0, 0},
1508         .ftypes_nr      = {0, 0, 0},
1509 #ifdef SOURCE_SADF
1510         .f_render       = render_filesystem_stats,
1511         .f_xml_print    = xml_print_filesystem_stats,
1512         .f_json_print   = json_print_filesystem_stats,
1513         .f_svg_print    = svg_print_filesystem_stats,
1514         .f_raw_print    = raw_print_filesystem_stats,
1515         .name           = "A_FILESYSTEM",
1516         .g_nr           = 4,
1517 #endif
1518         .nr             = -1,
1519         .nr2            = 1,
1520         .nr_max         = MAX_NR_FS,
1521         .fsize          = STATS_FILESYSTEM_SIZE,
1522         .msize          = STATS_FILESYSTEM_SIZE,
1523         .opt_flags      = 0,
1524         .buf            = {NULL, NULL, NULL},
1525         .bitmap         = NULL
1526 };
1527
1528 /* Fibre Channel HBA usage activity */
1529 struct activity fchost_act = {
1530         .id             = A_NET_FC,
1531         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1532         .magic          = ACTIVITY_MAGIC_BASE,
1533         .group          = G_DISK,
1534 #ifdef SOURCE_SADC
1535         .f_count_index  = 10,   /* wrap_get_fchost_nr() */
1536         .f_count2       = NULL,
1537         .f_read         = wrap_read_fchost,
1538 #endif
1539 #ifdef SOURCE_SAR
1540         .f_print        = print_fchost_stats,
1541         .f_print_avg    = print_fchost_stats,
1542 #endif
1543 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1544         .hdr_line       = "FCHOST;fch_rxf/s;fch_txf/s;fch_rxw/s;fch_txw/s",
1545 #endif
1546         .gtypes_nr      = {0, 4, 0},
1547         .ftypes_nr      = {0, 0, 0},
1548 #ifdef SOURCE_SADF
1549         .f_render       = render_fchost_stats,
1550         .f_xml_print    = xml_print_fchost_stats,
1551         .f_json_print   = json_print_fchost_stats,
1552         .f_svg_print    = svg_print_fchost_stats,
1553         .f_raw_print    = raw_print_fchost_stats,
1554         .name           = "A_FCHOST",
1555         .g_nr           = 2,
1556 #endif
1557         .nr             = -1,
1558         .nr2            = 1,
1559         .nr_max         = MAX_NR_FCHOSTS,
1560         .fsize          = STATS_FCHOST_SIZE,
1561         .msize          = STATS_FCHOST_SIZE,
1562         .opt_flags      = 0,
1563         .buf            = {NULL, NULL, NULL},
1564         .bitmap         = NULL
1565 };
1566
1567 /* Softnet activity */
1568 struct activity softnet_act = {
1569         .id             = A_NET_SOFT,
1570         .options        = AO_COLLECTED + AO_COUNTED + AO_CLOSE_MARKUP +
1571                           AO_GRAPH_PER_ITEM,
1572         .magic          = ACTIVITY_MAGIC_BASE,
1573         .group          = G_DEFAULT,
1574 #ifdef SOURCE_SADC
1575         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1576         .f_count2       = NULL,
1577         .f_read         = wrap_read_softnet,
1578 #endif
1579 #ifdef SOURCE_SAR
1580         .f_print        = print_softnet_stats,
1581         .f_print_avg    = print_softnet_stats,
1582 #endif
1583 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1584         .hdr_line       = "CPU;total/s;dropd/s;squeezd/s;rx_rps/s;flw_lim/s",
1585 #endif
1586         .gtypes_nr      = {0, 0, 5},
1587         .ftypes_nr      = {0, 0, 0},
1588 #ifdef SOURCE_SADF
1589         .f_render       = render_softnet_stats,
1590         .f_xml_print    = xml_print_softnet_stats,
1591         .f_json_print   = json_print_softnet_stats,
1592         .f_svg_print    = svg_print_softnet_stats,
1593         .f_raw_print    = raw_print_softnet_stats,
1594         .name           = "A_NET_SOFT",
1595         .g_nr           = 2,
1596 #endif
1597         .nr             = -1,
1598         .nr2            = 1,
1599         .nr_max         = NR_CPUS + 1,
1600         .fsize          = STATS_SOFTNET_SIZE,
1601         .msize          = STATS_SOFTNET_SIZE,
1602         .opt_flags      = 0,
1603         .buf            = {NULL, NULL, NULL},
1604         .bitmap         = &cpu_bitmap
1605 };
1606
1607 #ifdef SOURCE_SADC
1608 /*
1609  * Array of functions used to count number of items.
1610  */
1611 __nr_t (*f_count[NR_F_COUNT]) (struct activity *) = {
1612         wrap_get_cpu_nr,
1613         wrap_get_irq_nr,
1614         wrap_get_serial_nr,
1615         wrap_get_disk_nr,
1616         wrap_get_iface_nr,
1617         wrap_get_fan_nr,
1618         wrap_get_temp_nr,
1619         wrap_get_in_nr,
1620         wrap_get_usb_nr,
1621         wrap_get_filesystem_nr,
1622         wrap_get_fchost_nr
1623 };
1624 #endif
1625
1626 /*
1627  * Array of activities.
1628  * (Order of activities doesn't matter for daily data files).
1629  */
1630 struct activity *act[NR_ACT] = {
1631         &cpu_act,
1632         &pcsw_act,
1633         &irq_act,
1634         &swap_act,
1635         &paging_act,
1636         &io_act,
1637         &memory_act,
1638         &huge_act,
1639         &ktables_act,
1640         &queue_act,
1641         &serial_act,
1642         &disk_act,
1643         /* <network> */
1644         &net_dev_act,
1645         &net_edev_act,
1646         &net_nfs_act,
1647         &net_nfsd_act,
1648         &net_sock_act,
1649         &net_ip_act,
1650         &net_eip_act,
1651         &net_icmp_act,
1652         &net_eicmp_act,
1653         &net_tcp_act,
1654         &net_etcp_act,
1655         &net_udp_act,
1656         &net_sock6_act,
1657         &net_ip6_act,
1658         &net_eip6_act,
1659         &net_icmp6_act,
1660         &net_eicmp6_act,
1661         &net_udp6_act,
1662         &fchost_act,
1663         &softnet_act,   /* AO_CLOSE_MARKUP */
1664         /* </network> */
1665         /* <power-management> */
1666         &pwr_cpufreq_act,
1667         &pwr_fan_act,
1668         &pwr_temp_act,
1669         &pwr_in_act,
1670         &pwr_wghfreq_act,
1671         &pwr_usb_act,           /* AO_CLOSE_MARKUP */
1672         /* </power-management> */
1673         &filesystem_act
1674 };