]> granicus.if.org Git - sysstat/blob - activity.c
count.c: Move SOURCE_SADC macro definition
[sysstat] / activity.c
1 /*
2  * activity.c: Define system activities available for sar/sadc.
3  * (C) 1999-2021 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_SAR
25 #include "pr_stats.h"
26 #endif
27
28 #ifdef SOURCE_SADF
29 #include "rndr_stats.h"
30 #include "xml_stats.h"
31 #include "json_stats.h"
32 #include "svg_stats.h"
33 #include "raw_stats.h"
34 #include "pcp_stats.h"
35 #endif
36
37 /*
38  ***************************************************************************
39  * Definitions of system activities.
40  * See sa.h file for activity structure definition.
41  * Activity structure doesn't matter for daily data files.
42  ***************************************************************************
43  */
44
45 /*
46  * Bitmaps needed by activities.
47  * Remember to allocate them before use!
48  */
49
50 /* CPU bitmap */
51 struct act_bitmap cpu_bitmap = {
52         .b_array        = NULL,
53         .b_size         = NR_CPUS
54 };
55
56 /* Interrupts bitmap */
57 struct act_bitmap irq_bitmap = {
58         .b_array        = NULL,
59         .b_size         = NR_IRQS
60 };
61
62
63 /*
64  * CPU statistics.
65  * This is the only activity which *must* be collected by sadc
66  * so that uptime can be filled.
67  */
68 struct activity cpu_act = {
69         .id             = A_CPU,
70         .options        = AO_COLLECTED + AO_COUNTED + AO_PERSISTENT +
71                           AO_MULTIPLE_OUTPUTS + AO_GRAPH_PER_ITEM +
72                           AO_ALWAYS_COUNTED,
73         .magic          = ACTIVITY_MAGIC_BASE + 1,
74         .group          = G_DEFAULT,
75 #ifdef SOURCE_SADC
76         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
77         .f_count2_index = -1,
78         .f_read         = wrap_read_stat_cpu,
79 #endif
80 #ifdef SOURCE_SAR
81         .f_print        = print_cpu_stats,
82         .f_print_avg    = print_cpu_stats,
83 #endif
84 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
85         .hdr_line       = "CPU;%user;%nice;%system;%iowait;%steal;%idle|"
86                           "CPU;%usr;%nice;%sys;%iowait;%steal;%irq;%soft;%guest;%gnice;%idle",
87 #endif
88         .gtypes_nr      = {STATS_CPU_ULL, STATS_CPU_UL, STATS_CPU_U},
89         .ftypes_nr      = {0, 0, 0},
90 #ifdef SOURCE_SADF
91         .f_render       = render_cpu_stats,
92         .f_xml_print    = xml_print_cpu_stats,
93         .f_json_print   = json_print_cpu_stats,
94         .f_svg_print    = svg_print_cpu_stats,
95         .f_raw_print    = raw_print_cpu_stats,
96         .f_pcp_print    = pcp_print_cpu_stats,
97         .f_count_new    = NULL,
98         .item_list      = NULL,
99         .desc           = "CPU utilization",
100 #endif
101         .name           = "A_CPU",
102         .item_list_sz   = 0,
103         .g_nr           = 1,
104         .nr_ini         = -1,
105         .nr2            = 1,
106         .nr_max         = NR_CPUS + 1,
107         .nr             = {-1, -1, -1},
108         .nr_allocated   = 0,
109         .fsize          = STATS_CPU_SIZE,
110         .msize          = STATS_CPU_SIZE,
111         .opt_flags      = AO_F_CPU_DEF,
112         .buf            = {NULL, NULL, NULL},
113         .bitmap         = &cpu_bitmap
114 };
115
116 /* Process (task) creation and context switch activity */
117 struct activity pcsw_act = {
118         .id             = A_PCSW,
119         .options        = AO_COLLECTED,
120         .magic          = ACTIVITY_MAGIC_BASE + 1,
121         .group          = G_DEFAULT,
122 #ifdef SOURCE_SADC
123         .f_count_index  = -1,
124         .f_count2_index = -1,
125         .f_read         = wrap_read_stat_pcsw,
126 #endif
127 #ifdef SOURCE_SAR
128         .f_print        = print_pcsw_stats,
129         .f_print_avg    = print_pcsw_stats,
130 #endif
131 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
132         .hdr_line       = "proc/s;cswch/s",
133 #endif
134         .gtypes_nr      = {STATS_PCSW_ULL, STATS_PCSW_UL, STATS_PCSW_U},
135         .ftypes_nr      = {0, 0, 0},
136 #ifdef SOURCE_SADF
137         .f_render       = render_pcsw_stats,
138         .f_xml_print    = xml_print_pcsw_stats,
139         .f_json_print   = json_print_pcsw_stats,
140         .f_svg_print    = svg_print_pcsw_stats,
141         .f_raw_print    = raw_print_pcsw_stats,
142         .f_pcp_print    = pcp_print_pcsw_stats,
143         .f_count_new    = NULL,
144         .item_list      = NULL,
145         .desc           = "Task creation and switching activity",
146 #endif
147         .name           = "A_PCSW",
148         .item_list_sz   = 0,
149         .g_nr           = 2,
150         .nr_ini         = 1,
151         .nr2            = 1,
152         .nr_max         = 1,
153         .nr             = {1, 1, 1},
154         .nr_allocated   = 0,
155         .fsize          = STATS_PCSW_SIZE,
156         .msize          = STATS_PCSW_SIZE,
157         .opt_flags      = 0,
158         .buf            = {NULL, NULL, NULL},
159         .bitmap         = NULL
160 };
161
162 /* Interrupts statistics */
163 struct activity irq_act = {
164         .id             = A_IRQ,
165         .options        = AO_COUNTED + AO_MATRIX,
166         .magic          = ACTIVITY_MAGIC_BASE + 2,
167         .group          = G_INT,
168 #ifdef SOURCE_SADC
169         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
170         .f_count2_index = 1,    /* wrap_get_irq_nr() */
171         .f_read         = wrap_read_stat_irq,
172 #endif
173 #ifdef SOURCE_SAR
174         .f_print        = print_irq_stats,
175         .f_print_avg    = print_irq_stats,
176 #endif
177 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
178         .hdr_line       = "INTR;CPU*",
179 #endif
180         .gtypes_nr      = {STATS_IRQ_ULL, STATS_IRQ_UL, STATS_IRQ_U},
181         .ftypes_nr      = {0, 0, 0},
182 #ifdef SOURCE_SADF
183         .f_render       = render_irq_stats,
184         .f_xml_print    = xml_print_irq_stats,
185         .f_json_print   = json_print_irq_stats,
186         .f_svg_print    = NULL,
187         .f_raw_print    = raw_print_irq_stats,
188         .f_pcp_print    = pcp_print_irq_stats,
189         .f_count_new    = NULL,
190         .item_list      = NULL,
191         .desc           = "Interrupts statistics",
192 #endif
193         .name           = "A_IRQ",
194         .item_list_sz   = 0,
195         .g_nr           = 0,
196         .nr_ini         = -1,
197         .nr2            = -1,
198         .nr_max         = NR_IRQS + 1,
199         .nr             = {-1, -1, -1},
200         .nr_allocated   = 0,
201         .fsize          = STATS_IRQ_SIZE,
202         .msize          = STATS_IRQ_SIZE,
203         .opt_flags      = 0,
204         .buf            = {NULL, NULL, NULL},
205         .bitmap         = &irq_bitmap
206 };
207
208 /* Swapping activity */
209 struct activity swap_act = {
210         .id             = A_SWAP,
211         .options        = AO_COLLECTED,
212         .magic          = ACTIVITY_MAGIC_BASE,
213         .group          = G_DEFAULT,
214 #ifdef SOURCE_SADC
215         .f_count_index  = -1,
216         .f_count2_index = -1,
217         .f_read         = wrap_read_swap,
218 #endif
219 #ifdef SOURCE_SAR
220         .f_print        = print_swap_stats,
221         .f_print_avg    = print_swap_stats,
222 #endif
223 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
224         .hdr_line       = "pswpin/s;pswpout/s",
225 #endif
226         .gtypes_nr      = {STATS_SWAP_ULL, STATS_SWAP_UL, STATS_SWAP_U},
227         .ftypes_nr      = {0, 0, 0},
228 #ifdef SOURCE_SADF
229         .f_render       = render_swap_stats,
230         .f_xml_print    = xml_print_swap_stats,
231         .f_json_print   = json_print_swap_stats,
232         .f_svg_print    = svg_print_swap_stats,
233         .f_raw_print    = raw_print_swap_stats,
234         .f_pcp_print    = pcp_print_swap_stats,
235         .f_count_new    = NULL,
236         .item_list      = NULL,
237         .desc           = "Swap activity",
238 #endif
239         .name           = "A_SWAP",
240         .item_list_sz   = 0,
241         .g_nr           = 1,
242         .nr_ini         = 1,
243         .nr2            = 1,
244         .nr_max         = 1,
245         .nr             = {1, 1, 1},
246         .nr_allocated   = 0,
247         .fsize          = STATS_SWAP_SIZE,
248         .msize          = STATS_SWAP_SIZE,
249         .opt_flags      = 0,
250         .buf            = {NULL, NULL, NULL},
251         .bitmap         = NULL
252 };
253
254 /* Paging activity */
255 struct activity paging_act = {
256         .id             = A_PAGE,
257         .options        = AO_COLLECTED,
258         .magic          = ACTIVITY_MAGIC_BASE,
259         .group          = G_DEFAULT,
260 #ifdef SOURCE_SADC
261         .f_count_index  = -1,
262         .f_count2_index = -1,
263         .f_read         = wrap_read_paging,
264 #endif
265 #ifdef SOURCE_SAR
266         .f_print        = print_paging_stats,
267         .f_print_avg    = print_paging_stats,
268 #endif
269 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
270         .hdr_line       = "pgpgin/s;pgpgout/s;fault/s;majflt/s;"
271                           "pgfree/s;pgscank/s;pgscand/s;pgsteal/s;%vmeff",
272 #endif
273         .gtypes_nr      = {STATS_PAGING_ULL, STATS_PAGING_UL, STATS_PAGING_U},
274         .ftypes_nr      = {0, 0, 0},
275 #ifdef SOURCE_SADF
276         .f_render       = render_paging_stats,
277         .f_xml_print    = xml_print_paging_stats,
278         .f_json_print   = json_print_paging_stats,
279         .f_svg_print    = svg_print_paging_stats,
280         .f_raw_print    = raw_print_paging_stats,
281         .f_pcp_print    = pcp_print_paging_stats,
282         .f_count_new    = NULL,
283         .item_list      = NULL,
284         .desc           = "Paging activity",
285 #endif
286         .name           = "A_PAGE",
287         .item_list_sz   = 0,
288         .g_nr           = 3,
289         .nr_ini         = 1,
290         .nr2            = 1,
291         .nr_max         = 1,
292         .nr             = {1, 1, 1},
293         .nr_allocated   = 0,
294         .fsize          = STATS_PAGING_SIZE,
295         .msize          = STATS_PAGING_SIZE,
296         .opt_flags      = 0,
297         .buf            = {NULL, NULL, NULL},
298         .bitmap         = NULL
299 };
300
301 /* I/O and transfer rate activity */
302 struct activity io_act = {
303         .id             = A_IO,
304         .options        = AO_COLLECTED,
305         .magic          = ACTIVITY_MAGIC_BASE + 1,
306         .group          = G_DEFAULT,
307 #ifdef SOURCE_SADC
308         .f_count_index  = -1,
309         .f_count2_index = -1,
310         .f_read         = wrap_read_io,
311 #endif
312 #ifdef SOURCE_SAR
313         .f_print        = print_io_stats,
314         .f_print_avg    = print_io_stats,
315 #endif
316 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
317         .hdr_line       = "tps;rtps;wtps;dtps;bread/s;bwrtn/s;bdscd/s",
318 #endif
319         .gtypes_nr      = {STATS_IO_ULL, STATS_IO_UL, STATS_IO_U},
320         .ftypes_nr      = {0, 0, 0},
321 #ifdef SOURCE_SADF
322         .f_render       = render_io_stats,
323         .f_xml_print    = xml_print_io_stats,
324         .f_json_print   = json_print_io_stats,
325         .f_svg_print    = svg_print_io_stats,
326         .f_raw_print    = raw_print_io_stats,
327         .f_pcp_print    = pcp_print_io_stats,
328         .f_count_new    = NULL,
329         .item_list      = NULL,
330         .desc           = "I/O and transfer rate statistics",
331 #endif
332         .name           = "A_IO",
333         .item_list_sz   = 0,
334         .g_nr           = 2,
335         .nr_ini         = 1,
336         .nr2            = 1,
337         .nr_max         = 1,
338         .nr             = {1, 1, 1},
339         .nr_allocated   = 0,
340         .fsize          = STATS_IO_SIZE,
341         .msize          = STATS_IO_SIZE,
342         .opt_flags      = 0,
343         .buf            = {NULL, NULL, NULL},
344         .bitmap         = NULL
345 };
346
347 /* Memory and swap space utilization activity */
348 struct activity memory_act = {
349         .id             = A_MEMORY,
350         .options        = AO_COLLECTED + AO_MULTIPLE_OUTPUTS,
351         .magic          = ACTIVITY_MAGIC_BASE + 1,
352         .group          = G_DEFAULT,
353 #ifdef SOURCE_SADC
354         .f_count_index  = -1,
355         .f_count2_index = -1,
356         .f_read         = wrap_read_meminfo,
357 #endif
358 #ifdef SOURCE_SAR
359         .f_print        = print_memory_stats,
360         .f_print_avg    = print_avg_memory_stats,
361 #endif
362 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
363         .hdr_line       = "kbmemfree;kbavail;kbmemused;%memused;kbbuffers;kbcached;kbcommit;%commit;kbactive;kbinact;kbdirty&kbanonpg;kbslab;kbkstack;kbpgtbl;kbvmused|"
364                           "kbswpfree;kbswpused;%swpused;kbswpcad;%swpcad",
365 #endif
366         .gtypes_nr      = {STATS_MEMORY_ULL, STATS_MEMORY_UL, STATS_MEMORY_U},
367         .ftypes_nr      = {0, 0, 0},
368 #ifdef SOURCE_SADF
369         .f_render       = render_memory_stats,
370         .f_xml_print    = xml_print_memory_stats,
371         .f_json_print   = json_print_memory_stats,
372         .f_svg_print    = svg_print_memory_stats,
373         .f_raw_print    = raw_print_memory_stats,
374         .f_pcp_print    = pcp_print_memory_stats,
375         .f_count_new    = NULL,
376         .item_list      = NULL,
377         .desc           = "Memory and/or swap utilization",
378 #endif
379         .name           = "A_MEMORY",
380         .item_list_sz   = 0,
381         .g_nr           = 9,
382         .nr_ini         = 1,
383         .nr2            = 1,
384         .nr_max         = 1,
385         .nr             = {1, 1, 1},
386         .nr_allocated   = 0,
387         .fsize          = STATS_MEMORY_SIZE,
388         .msize          = STATS_MEMORY_SIZE,
389         .opt_flags      = 0,
390         .buf            = {NULL, NULL, NULL},
391         .bitmap         = NULL
392 };
393
394 /* Kernel tables activity */
395 struct activity ktables_act = {
396         .id             = A_KTABLES,
397         .options        = AO_COLLECTED,
398         .magic          = ACTIVITY_MAGIC_BASE + 1,
399         .group          = G_DEFAULT,
400 #ifdef SOURCE_SADC
401         .f_count_index  = -1,
402         .f_count2_index = -1,
403         .f_read         = wrap_read_kernel_tables,
404 #endif
405 #ifdef SOURCE_SAR
406         .f_print        = print_ktables_stats,
407         .f_print_avg    = print_avg_ktables_stats,
408 #endif
409 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
410         .hdr_line       = "dentunusd;file-nr;inode-nr;pty-nr",
411 #endif
412         .gtypes_nr      = {STATS_KTABLES_ULL, STATS_KTABLES_UL, STATS_KTABLES_U},
413         .ftypes_nr      = {0, 0, 0},
414 #ifdef SOURCE_SADF
415         .f_render       = render_ktables_stats,
416         .f_xml_print    = xml_print_ktables_stats,
417         .f_json_print   = json_print_ktables_stats,
418         .f_svg_print    = svg_print_ktables_stats,
419         .f_raw_print    = raw_print_ktables_stats,
420         .f_pcp_print    = pcp_print_ktables_stats,
421         .f_count_new    = NULL,
422         .item_list      = NULL,
423         .desc           = "Kernel tables statistics",
424 #endif
425         .name           = "A_KTABLES",
426         .item_list_sz   = 0,
427         .g_nr           = 2,
428         .nr_ini         = 1,
429         .nr2            = 1,
430         .nr_max         = 1,
431         .nr             = {1, 1, 1},
432         .nr_allocated   = 0,
433         .fsize          = STATS_KTABLES_SIZE,
434         .msize          = STATS_KTABLES_SIZE,
435         .opt_flags      = 0,
436         .buf            = {NULL, NULL, NULL},
437         .bitmap         = NULL
438 };
439
440 /* Queue and load activity */
441 struct activity queue_act = {
442         .id             = A_QUEUE,
443         .options        = AO_COLLECTED,
444         .magic          = ACTIVITY_MAGIC_BASE + 2,
445         .group          = G_DEFAULT,
446 #ifdef SOURCE_SADC
447         .f_count_index  = -1,
448         .f_count2_index = -1,
449         .f_read         = wrap_read_loadavg,
450 #endif
451 #ifdef SOURCE_SAR
452         .f_print        = print_queue_stats,
453         .f_print_avg    = print_avg_queue_stats,
454 #endif
455 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
456         .hdr_line       = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15;blocked",
457 #endif
458         .gtypes_nr      = {STATS_QUEUE_ULL, STATS_QUEUE_UL, STATS_QUEUE_U},
459         .ftypes_nr      = {0, 0, 0},
460 #ifdef SOURCE_SADF
461         .f_render       = render_queue_stats,
462         .f_xml_print    = xml_print_queue_stats,
463         .f_json_print   = json_print_queue_stats,
464         .f_svg_print    = svg_print_queue_stats,
465         .f_raw_print    = raw_print_queue_stats,
466         .f_pcp_print    = pcp_print_queue_stats,
467         .f_count_new    = NULL,
468         .item_list      = NULL,
469         .desc           = "Queue length and load average statistics",
470 #endif
471         .name           = "A_QUEUE",
472         .item_list_sz   = 0,
473         .g_nr           = 3,
474         .nr_ini         = 1,
475         .nr2            = 1,
476         .nr_max         = 1,
477         .nr             = {1, 1, 1},
478         .nr_allocated   = 0,
479         .fsize          = STATS_QUEUE_SIZE,
480         .msize          = STATS_QUEUE_SIZE,
481         .opt_flags      = 0,
482         .buf            = {NULL, NULL, NULL},
483         .bitmap         = NULL
484 };
485
486 /* Serial lines activity */
487 struct activity serial_act = {
488         .id             = A_SERIAL,
489         .options        = AO_COLLECTED + AO_COUNTED,
490         .magic          = ACTIVITY_MAGIC_BASE + 1,
491         .group          = G_DEFAULT,
492 #ifdef SOURCE_SADC
493         .f_count_index  = 2,    /* wrap_get_serial_nr() */
494         .f_count2_index = -1,
495         .f_read         = wrap_read_tty_driver_serial,
496 #endif
497 #ifdef SOURCE_SAR
498         .f_print        = print_serial_stats,
499         .f_print_avg    = print_serial_stats,
500 #endif
501 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
502         .hdr_line       = "TTY;rcvin/s;xmtin/s;framerr/s;prtyerr/s;brk/s;ovrun/s",
503 #endif
504         .gtypes_nr      = {STATS_SERIAL_ULL, STATS_SERIAL_UL, STATS_SERIAL_U},
505         .ftypes_nr      = {0, 0, 0},
506 #ifdef SOURCE_SADF
507         .f_render       = render_serial_stats,
508         .f_xml_print    = xml_print_serial_stats,
509         .f_json_print   = json_print_serial_stats,
510         .f_svg_print    = NULL,
511         .f_raw_print    = raw_print_serial_stats,
512         .f_pcp_print    = pcp_print_serial_stats,
513         .f_count_new    = NULL,
514         .item_list      = NULL,
515         .desc           = "TTY devices statistics",
516 #endif
517         .name           = "A_SERIAL",
518         .item_list_sz   = 0,
519         .g_nr           = 0,
520         .nr_ini         = -1,
521         .nr2            = 1,
522         .nr_max         = MAX_NR_SERIAL_LINES,
523         .nr             = {-1, -1, -1},
524         .nr_allocated   = 0,
525         .fsize          = STATS_SERIAL_SIZE,
526         .msize          = STATS_SERIAL_SIZE,
527         .opt_flags      = 0,
528         .buf            = {NULL, NULL, NULL},
529         .bitmap         = NULL
530 };
531
532 /* Block devices activity */
533 struct activity disk_act = {
534         .id             = A_DISK,
535         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
536         .magic          = ACTIVITY_MAGIC_BASE + 2,
537         .group          = G_DISK,
538 #ifdef SOURCE_SADC
539         .f_count_index  = 3,    /* wrap_get_disk_nr() */
540         .f_count2_index = -1,
541         .f_read         = wrap_read_disk,
542 #endif
543 #ifdef SOURCE_SAR
544         .f_print        = print_disk_stats,
545         .f_print_avg    = print_disk_stats,
546 #endif
547 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
548         .hdr_line       = "DEV;tps;rkB/s;wkB/s;dkB/s;areq-sz;aqu-sz;await;%util",
549 #endif
550         .gtypes_nr      = {STATS_DISK_ULL, STATS_DISK_UL, STATS_DISK_U},
551         .ftypes_nr      = {0, 0, 0},
552 #ifdef SOURCE_SADF
553         .f_render       = render_disk_stats,
554         .f_xml_print    = xml_print_disk_stats,
555         .f_json_print   = json_print_disk_stats,
556         .f_svg_print    = svg_print_disk_stats,
557         .f_raw_print    = raw_print_disk_stats,
558         .f_pcp_print    = pcp_print_disk_stats,
559         .f_count_new    = count_new_disk,
560         .item_list      = NULL,
561         .desc           = "Block devices statistics",
562 #endif
563         .name           = "A_DISK",
564         .item_list_sz   = 0,
565         .g_nr           = 5,
566         .nr_ini         = -1,
567         .nr2            = 1,
568         .nr_max         = MAX_NR_DISKS,
569         .nr             = {-1, -1, -1},
570         .nr_allocated   = 0,
571         .fsize          = STATS_DISK_SIZE,
572         .msize          = STATS_DISK_SIZE,
573         .opt_flags      = 0,
574         .buf            = {NULL, NULL, NULL},
575         .bitmap         = NULL
576 };
577
578 /* Network interfaces activity */
579 struct activity net_dev_act = {
580         .id             = A_NET_DEV,
581         .options        = AO_COLLECTED + AO_COUNTED + AO_GRAPH_PER_ITEM,
582         .magic          = ACTIVITY_MAGIC_BASE + 3,
583         .group          = G_DEFAULT,
584 #ifdef SOURCE_SADC
585         .f_count_index  = 4,    /* wrap_get_iface_nr() */
586         .f_count2_index = -1,
587         .f_read         = wrap_read_net_dev,
588 #endif
589 #ifdef SOURCE_SAR
590         .f_print        = print_net_dev_stats,
591         .f_print_avg    = print_net_dev_stats,
592 #endif
593 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
594         .hdr_line       = "IFACE;rxpck/s;txpck/s;rxkB/s;txkB/s;rxcmp/s;txcmp/s;rxmcst/s;%ifutil",
595 #endif
596         .gtypes_nr      = {STATS_NET_DEV_ULL, STATS_NET_DEV_UL, STATS_NET_DEV_U},
597         .ftypes_nr      = {0, 0, 0},
598 #ifdef SOURCE_SADF
599         .f_render       = render_net_dev_stats,
600         .f_xml_print    = xml_print_net_dev_stats,
601         .f_json_print   = json_print_net_dev_stats,
602         .f_svg_print    = svg_print_net_dev_stats,
603         .f_raw_print    = raw_print_net_dev_stats,
604         .f_pcp_print    = pcp_print_net_dev_stats,
605         .f_count_new    = count_new_net_dev,
606         .item_list      = NULL,
607         .desc           = "Network interfaces statistics",
608 #endif
609         .name           = "A_NET_DEV",
610         .item_list_sz   = 0,
611         .g_nr           = 4,
612         .nr_ini         = -1,
613         .nr2            = 1,
614         .nr_max         = MAX_NR_IFACES,
615         .nr             = {-1, -1, -1},
616         .nr_allocated   = 0,
617         .fsize          = STATS_NET_DEV_SIZE,
618         .msize          = STATS_NET_DEV_SIZE,
619         .opt_flags      = 0,
620         .buf            = {NULL, NULL, NULL},
621         .bitmap         = NULL
622 };
623
624 /* Network interfaces (errors) activity */
625 struct activity net_edev_act = {
626         .id             = A_NET_EDEV,
627         .options        = AO_COLLECTED + AO_COUNTED + AO_GRAPH_PER_ITEM,
628         .magic          = ACTIVITY_MAGIC_BASE + 2,
629         .group          = G_DEFAULT,
630 #ifdef SOURCE_SADC
631         .f_count_index  = 4,    /* wrap_get_iface_nr() */
632         .f_count2_index = -1,
633         .f_read         = wrap_read_net_edev,
634 #endif
635 #ifdef SOURCE_SAR
636         .f_print        = print_net_edev_stats,
637         .f_print_avg    = print_net_edev_stats,
638 #endif
639 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
640         .hdr_line       = "IFACE;rxerr/s;txerr/s;coll/s;rxdrop/s;txdrop/s;"
641                           "txcarr/s;rxfram/s;rxfifo/s;txfifo/s",
642 #endif
643         .gtypes_nr      = {STATS_NET_EDEV_ULL, STATS_NET_EDEV_UL, STATS_NET_EDEV_U},
644         .ftypes_nr      = {0, 0, 0},
645 #ifdef SOURCE_SADF
646         .f_render       = render_net_edev_stats,
647         .f_xml_print    = xml_print_net_edev_stats,
648         .f_json_print   = json_print_net_edev_stats,
649         .f_svg_print    = svg_print_net_edev_stats,
650         .f_raw_print    = raw_print_net_edev_stats,
651         .f_pcp_print    = pcp_print_net_edev_stats,
652         .f_count_new    = count_new_net_edev,
653         .item_list      = NULL,
654         .desc           = "Network interfaces errors statistics",
655 #endif
656         .name           = "A_NET_EDEV",
657         .item_list_sz   = 0,
658         .g_nr           = 4,
659         .nr_ini         = -1,
660         .nr2            = 1,
661         .nr_max         = MAX_NR_IFACES,
662         .nr             = {-1, -1, -1},
663         .nr_allocated   = 0,
664         .fsize          = STATS_NET_EDEV_SIZE,
665         .msize          = STATS_NET_EDEV_SIZE,
666         .opt_flags      = 0,
667         .buf            = {NULL, NULL, NULL},
668         .bitmap         = NULL
669 };
670
671 /* NFS client activity */
672 struct activity net_nfs_act = {
673         .id             = A_NET_NFS,
674         .options        = AO_COLLECTED,
675         .magic          = ACTIVITY_MAGIC_BASE,
676         .group          = G_DEFAULT,
677 #ifdef SOURCE_SADC
678         .f_count_index  = -1,
679         .f_count2_index = -1,
680         .f_read         = wrap_read_net_nfs,
681 #endif
682 #ifdef SOURCE_SAR
683         .f_print        = print_net_nfs_stats,
684         .f_print_avg    = print_net_nfs_stats,
685 #endif
686 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
687         .hdr_line       = "call/s;retrans/s;read/s;write/s;access/s;getatt/s",
688 #endif
689         .gtypes_nr      = {STATS_NET_NFS_ULL, STATS_NET_NFS_UL, STATS_NET_NFS_U},
690         .ftypes_nr      = {0, 0, 0},
691 #ifdef SOURCE_SADF
692         .f_render       = render_net_nfs_stats,
693         .f_xml_print    = xml_print_net_nfs_stats,
694         .f_json_print   = json_print_net_nfs_stats,
695         .f_svg_print    = svg_print_net_nfs_stats,
696         .f_raw_print    = raw_print_net_nfs_stats,
697         .f_pcp_print    = pcp_print_net_nfs_stats,
698         .f_count_new    = NULL,
699         .item_list      = NULL,
700         .desc           = "NFS client statistics",
701 #endif
702         .name           = "A_NET_NFS",
703         .item_list_sz   = 0,
704         .g_nr           = 3,
705         .nr_ini         = 1,
706         .nr2            = 1,
707         .nr_max         = 1,
708         .nr             = {1, 1, 1},
709         .nr_allocated   = 0,
710         .fsize          = STATS_NET_NFS_SIZE,
711         .msize          = STATS_NET_NFS_SIZE,
712         .opt_flags      = 0,
713         .buf            = {NULL, NULL, NULL},
714         .bitmap         = NULL
715 };
716
717 /* NFS server activity */
718 struct activity net_nfsd_act = {
719         .id             = A_NET_NFSD,
720         .options        = AO_COLLECTED,
721         .magic          = ACTIVITY_MAGIC_BASE,
722         .group          = G_DEFAULT,
723 #ifdef SOURCE_SADC
724         .f_count_index  = -1,
725         .f_count2_index = -1,
726         .f_read         = wrap_read_net_nfsd,
727 #endif
728 #ifdef SOURCE_SAR
729         .f_print        = print_net_nfsd_stats,
730         .f_print_avg    = print_net_nfsd_stats,
731 #endif
732 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
733         .hdr_line       = "scall/s;badcall/s;packet/s;udp/s;tcp/s;hit/s;miss/s;"
734                           "sread/s;swrite/s;saccess/s;sgetatt/s",
735 #endif
736         .gtypes_nr      = {STATS_NET_NFSD_ULL, STATS_NET_NFSD_UL, STATS_NET_NFSD_U},
737         .ftypes_nr      = {0, 0, 0},
738 #ifdef SOURCE_SADF
739         .f_render       = render_net_nfsd_stats,
740         .f_xml_print    = xml_print_net_nfsd_stats,
741         .f_json_print   = json_print_net_nfsd_stats,
742         .f_svg_print    = svg_print_net_nfsd_stats,
743         .f_raw_print    = raw_print_net_nfsd_stats,
744         .f_pcp_print    = pcp_print_net_nfsd_stats,
745         .f_count_new    = NULL,
746         .item_list      = NULL,
747         .desc           = "NFS server statistics",
748 #endif
749         .name           = "A_NET_NFSD",
750         .item_list_sz   = 0,
751         .g_nr           = 5,
752         .nr_ini         = 1,
753         .nr2            = 1,
754         .nr_max         = 1,
755         .nr             = {1, 1, 1},
756         .nr_allocated   = 0,
757         .fsize          = STATS_NET_NFSD_SIZE,
758         .msize          = STATS_NET_NFSD_SIZE,
759         .opt_flags      = 0,
760         .buf            = {NULL, NULL, NULL},
761         .bitmap         = NULL
762 };
763
764 /* Network sockets activity */
765 struct activity net_sock_act = {
766         .id             = A_NET_SOCK,
767         .options        = AO_COLLECTED,
768         .magic          = ACTIVITY_MAGIC_BASE,
769         .group          = G_DEFAULT,
770 #ifdef SOURCE_SADC
771         .f_count_index  = -1,
772         .f_count2_index = -1,
773         .f_read         = wrap_read_net_sock,
774 #endif
775 #ifdef SOURCE_SAR
776         .f_print        = print_net_sock_stats,
777         .f_print_avg    = print_avg_net_sock_stats,
778 #endif
779 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
780         .hdr_line       = "totsck;tcpsck;udpsck;rawsck;ip-frag;tcp-tw",
781 #endif
782         .gtypes_nr      = {STATS_NET_SOCK_ULL, STATS_NET_SOCK_UL, STATS_NET_SOCK_U},
783         .ftypes_nr      = {0, 0, 0},
784 #ifdef SOURCE_SADF
785         .f_render       = render_net_sock_stats,
786         .f_xml_print    = xml_print_net_sock_stats,
787         .f_json_print   = json_print_net_sock_stats,
788         .f_svg_print    = svg_print_net_sock_stats,
789         .f_raw_print    = raw_print_net_sock_stats,
790         .f_pcp_print    = pcp_print_net_sock_stats,
791         .f_count_new    = NULL,
792         .item_list      = NULL,
793         .desc           = "IPv4 sockets statistics",
794 #endif
795         .name           = "A_NET_SOCK",
796         .item_list_sz   = 0,
797         .g_nr           = 2,
798         .nr_ini         = 1,
799         .nr2            = 1,
800         .nr_max         = 1,
801         .nr             = {1, 1, 1},
802         .nr_allocated   = 0,
803         .fsize          = STATS_NET_SOCK_SIZE,
804         .msize          = STATS_NET_SOCK_SIZE,
805         .opt_flags      = 0,
806         .buf            = {NULL, NULL, NULL},
807         .bitmap         = NULL
808 };
809
810 /* IP network traffic activity */
811 struct activity net_ip_act = {
812         .id             = A_NET_IP,
813         .options        = AO_NULL,
814         .magic          = ACTIVITY_MAGIC_BASE + 2,
815         .group          = G_SNMP,
816 #ifdef SOURCE_SADC
817         .f_count_index  = -1,
818         .f_count2_index = -1,
819         .f_read         = wrap_read_net_ip,
820 #endif
821 #ifdef SOURCE_SAR
822         .f_print        = print_net_ip_stats,
823         .f_print_avg    = print_net_ip_stats,
824 #endif
825 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
826         .hdr_line       = "irec/s;fwddgm/s;idel/s;orq/s;asmrq/s;asmok/s;fragok/s;fragcrt/s",
827 #endif
828         .gtypes_nr      = {STATS_NET_IP_ULL, STATS_NET_IP_UL, STATS_NET_IP_U},
829         .ftypes_nr      = {0, 0, 0},
830 #ifdef SOURCE_SADF
831         .f_render       = render_net_ip_stats,
832         .f_xml_print    = xml_print_net_ip_stats,
833         .f_json_print   = json_print_net_ip_stats,
834         .f_svg_print    = svg_print_net_ip_stats,
835         .f_raw_print    = raw_print_net_ip_stats,
836         .f_pcp_print    = pcp_print_net_ip_stats,
837         .f_count_new    = NULL,
838         .item_list      = NULL,
839         .desc           = "IPv4 traffic statistics",
840 #endif
841         .name           = "A_NET_IP",
842         .item_list_sz   = 0,
843         .g_nr           = 3,
844         .nr_ini         = 1,
845         .nr2            = 1,
846         .nr_max         = 1,
847         .nr             = {1, 1, 1},
848         .nr_allocated   = 0,
849         .fsize          = STATS_NET_IP_SIZE,
850         .msize          = STATS_NET_IP_SIZE,
851         .opt_flags      = 0,
852         .buf            = {NULL, NULL, NULL},
853         .bitmap         = NULL
854 };
855
856 /* IP network traffic (errors) activity */
857 struct activity net_eip_act = {
858         .id             = A_NET_EIP,
859         .options        = AO_NULL,
860         .magic          = ACTIVITY_MAGIC_BASE + 2,
861         .group          = G_SNMP,
862 #ifdef SOURCE_SADC
863         .f_count_index  = -1,
864         .f_count2_index = -1,
865         .f_read         = wrap_read_net_eip,
866 #endif
867 #ifdef SOURCE_SAR
868         .f_print        = print_net_eip_stats,
869         .f_print_avg    = print_net_eip_stats,
870 #endif
871 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
872         .hdr_line       = "ihdrerr/s;iadrerr/s;iukwnpr/s;idisc/s;odisc/s;onort/s;asmf/s;fragf/s",
873 #endif
874         .gtypes_nr      = {STATS_NET_EIP_ULL, STATS_NET_EIP_UL, STATS_NET_EIP_U},
875         .ftypes_nr      = {0, 0, 0},
876 #ifdef SOURCE_SADF
877         .f_render       = render_net_eip_stats,
878         .f_xml_print    = xml_print_net_eip_stats,
879         .f_json_print   = json_print_net_eip_stats,
880         .f_svg_print    = svg_print_net_eip_stats,
881         .f_raw_print    = raw_print_net_eip_stats,
882         .f_pcp_print    = pcp_print_net_eip_stats,
883         .f_count_new    = NULL,
884         .item_list      = NULL,
885         .desc           = "IPv4 traffic errors statistics",
886 #endif
887         .name           = "A_NET_EIP",
888         .item_list_sz   = 0,
889         .g_nr           = 3,
890         .nr_ini         = 1,
891         .nr2            = 1,
892         .nr_max         = 1,
893         .nr             = {1, 1, 1},
894         .nr_allocated   = 0,
895         .fsize          = STATS_NET_EIP_SIZE,
896         .msize          = STATS_NET_EIP_SIZE,
897         .opt_flags      = 0,
898         .buf            = {NULL, NULL, NULL},
899         .bitmap         = NULL
900 };
901
902 /* ICMP network traffic activity */
903 struct activity net_icmp_act = {
904         .id             = A_NET_ICMP,
905         .options        = AO_NULL,
906         .magic          = ACTIVITY_MAGIC_BASE,
907         .group          = G_SNMP,
908 #ifdef SOURCE_SADC
909         .f_count_index  = -1,
910         .f_count2_index = -1,
911         .f_read         = wrap_read_net_icmp,
912 #endif
913 #ifdef SOURCE_SAR
914         .f_print        = print_net_icmp_stats,
915         .f_print_avg    = print_net_icmp_stats,
916 #endif
917 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
918         .hdr_line       = "imsg/s;omsg/s;iech/s;iechr/s;oech/s;oechr/s;itm/s;itmr/s;otm/s;"
919                           "otmr/s;iadrmk/s;iadrmkr/s;oadrmk/s;oadrmkr/s",
920 #endif
921         .gtypes_nr      = {STATS_NET_ICMP_ULL, STATS_NET_ICMP_UL, STATS_NET_ICMP_U},
922         .ftypes_nr      = {0, 0, 0},
923 #ifdef SOURCE_SADF
924         .f_render       = render_net_icmp_stats,
925         .f_xml_print    = xml_print_net_icmp_stats,
926         .f_json_print   = json_print_net_icmp_stats,
927         .f_svg_print    = svg_print_net_icmp_stats,
928         .f_raw_print    = raw_print_net_icmp_stats,
929         .f_pcp_print    = pcp_print_net_icmp_stats,
930         .f_count_new    = NULL,
931         .item_list      = NULL,
932         .desc           = "ICMPv4 traffic statistics",
933 #endif
934         .name           = "A_NET_ICMP",
935         .item_list_sz   = 0,
936         .g_nr           = 4,
937         .nr_ini         = 1,
938         .nr2            = 1,
939         .nr_max         = 1,
940         .nr             = {1, 1, 1},
941         .nr_allocated   = 0,
942         .fsize          = STATS_NET_ICMP_SIZE,
943         .msize          = STATS_NET_ICMP_SIZE,
944         .opt_flags      = 0,
945         .buf            = {NULL, NULL, NULL},
946         .bitmap         = NULL
947 };
948
949 /* ICMP network traffic (errors) activity */
950 struct activity net_eicmp_act = {
951         .id             = A_NET_EICMP,
952         .options        = AO_NULL,
953         .magic          = ACTIVITY_MAGIC_BASE,
954         .group          = G_SNMP,
955 #ifdef SOURCE_SADC
956         .f_count_index  = -1,
957         .f_count2_index = -1,
958         .f_read         = wrap_read_net_eicmp,
959 #endif
960 #ifdef SOURCE_SAR
961         .f_print        = print_net_eicmp_stats,
962         .f_print_avg    = print_net_eicmp_stats,
963 #endif
964 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
965         .hdr_line       = "ierr/s;oerr/s;idstunr/s;odstunr/s;itmex/s;otmex/s;"
966                           "iparmpb/s;oparmpb/s;isrcq/s;osrcq/s;iredir/s;oredir/s",
967 #endif
968         .gtypes_nr      = {STATS_NET_EICMP_ULL, STATS_NET_EICMP_UL, STATS_NET_EICMP_U},
969         .ftypes_nr      = {0, 0, 0},
970 #ifdef SOURCE_SADF
971         .f_render       = render_net_eicmp_stats,
972         .f_xml_print    = xml_print_net_eicmp_stats,
973         .f_json_print   = json_print_net_eicmp_stats,
974         .f_svg_print    = svg_print_net_eicmp_stats,
975         .f_raw_print    = raw_print_net_eicmp_stats,
976         .f_pcp_print    = pcp_print_net_eicmp_stats,
977         .f_count_new    = NULL,
978         .item_list      = NULL,
979         .desc           = "ICMPv4 traffic errors statistics",
980 #endif
981         .name           = "A_NET_EICMP",
982         .item_list_sz   = 0,
983         .g_nr           = 6,
984         .nr_ini         = 1,
985         .nr2            = 1,
986         .nr_max         = 1,
987         .nr             = {1, 1, 1},
988         .nr_allocated   = 0,
989         .fsize          = STATS_NET_EICMP_SIZE,
990         .msize          = STATS_NET_EICMP_SIZE,
991         .opt_flags      = 0,
992         .buf            = {NULL, NULL, NULL},
993         .bitmap         = NULL
994 };
995
996 /* TCP network traffic activity */
997 struct activity net_tcp_act = {
998         .id             = A_NET_TCP,
999         .options        = AO_NULL,
1000         .magic          = ACTIVITY_MAGIC_BASE,
1001         .group          = G_SNMP,
1002 #ifdef SOURCE_SADC
1003         .f_count_index  = -1,
1004         .f_count2_index = -1,
1005         .f_read         = wrap_read_net_tcp,
1006 #endif
1007 #ifdef SOURCE_SAR
1008         .f_print        = print_net_tcp_stats,
1009         .f_print_avg    = print_net_tcp_stats,
1010 #endif
1011 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1012         .hdr_line       = "active/s;passive/s;iseg/s;oseg/s",
1013 #endif
1014         .gtypes_nr      = {STATS_NET_TCP_ULL, STATS_NET_TCP_UL, STATS_NET_TCP_U},
1015         .ftypes_nr      = {0, 0, 0},
1016 #ifdef SOURCE_SADF
1017         .f_render       = render_net_tcp_stats,
1018         .f_xml_print    = xml_print_net_tcp_stats,
1019         .f_json_print   = json_print_net_tcp_stats,
1020         .f_svg_print    = svg_print_net_tcp_stats,
1021         .f_raw_print    = raw_print_net_tcp_stats,
1022         .f_pcp_print    = pcp_print_net_tcp_stats,
1023         .f_count_new    = NULL,
1024         .item_list      = NULL,
1025         .desc           = "TCPv4 traffic statistics",
1026 #endif
1027         .name           = "A_NET_TCP",
1028         .item_list_sz   = 0,
1029         .g_nr           = 2,
1030         .nr_ini         = 1,
1031         .nr2            = 1,
1032         .nr_max         = 1,
1033         .nr             = {1, 1, 1},
1034         .nr_allocated   = 0,
1035         .fsize          = STATS_NET_TCP_SIZE,
1036         .msize          = STATS_NET_TCP_SIZE,
1037         .opt_flags      = 0,
1038         .buf            = {NULL, NULL, NULL},
1039         .bitmap         = NULL
1040 };
1041
1042 /* TCP network traffic (errors) activity */
1043 struct activity net_etcp_act = {
1044         .id             = A_NET_ETCP,
1045         .options        = AO_NULL,
1046         .magic          = ACTIVITY_MAGIC_BASE,
1047         .group          = G_SNMP,
1048 #ifdef SOURCE_SADC
1049         .f_count_index  = -1,
1050         .f_count2_index = -1,
1051         .f_read         = wrap_read_net_etcp,
1052 #endif
1053 #ifdef SOURCE_SAR
1054         .f_print        = print_net_etcp_stats,
1055         .f_print_avg    = print_net_etcp_stats,
1056 #endif
1057 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1058         .hdr_line       = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s",
1059 #endif
1060         .gtypes_nr      = {STATS_NET_ETCP_ULL, STATS_NET_ETCP_UL, STATS_NET_ETCP_U},
1061         .ftypes_nr      = {0, 0, 0},
1062 #ifdef SOURCE_SADF
1063         .f_render       = render_net_etcp_stats,
1064         .f_xml_print    = xml_print_net_etcp_stats,
1065         .f_json_print   = json_print_net_etcp_stats,
1066         .f_svg_print    = svg_print_net_etcp_stats,
1067         .f_raw_print    = raw_print_net_etcp_stats,
1068         .f_pcp_print    = pcp_print_net_etcp_stats,
1069         .f_count_new    = NULL,
1070         .item_list      = NULL,
1071         .desc           = "TCPv4 traffic errors statistics",
1072 #endif
1073         .name           = "A_NET_ETCP",
1074         .item_list_sz   = 0,
1075         .g_nr           = 2,
1076         .nr_ini         = 1,
1077         .nr2            = 1,
1078         .nr_max         = 1,
1079         .nr             = {1, 1, 1},
1080         .nr_allocated   = 0,
1081         .fsize          = STATS_NET_ETCP_SIZE,
1082         .msize          = STATS_NET_ETCP_SIZE,
1083         .opt_flags      = 0,
1084         .buf            = {NULL, NULL, NULL},
1085         .bitmap         = NULL
1086 };
1087
1088 /* UDP network traffic activity */
1089 struct activity net_udp_act = {
1090         .id             = A_NET_UDP,
1091         .options        = AO_NULL,
1092         .magic          = ACTIVITY_MAGIC_BASE,
1093         .group          = G_SNMP,
1094 #ifdef SOURCE_SADC
1095         .f_count_index  = -1,
1096         .f_count2_index = -1,
1097         .f_read         = wrap_read_net_udp,
1098 #endif
1099 #ifdef SOURCE_SAR
1100         .f_print        = print_net_udp_stats,
1101         .f_print_avg    = print_net_udp_stats,
1102 #endif
1103 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1104         .hdr_line       = "idgm/s;odgm/s;noport/s;idgmerr/s",
1105 #endif
1106         .gtypes_nr      = {STATS_NET_UDP_ULL, STATS_NET_UDP_UL, STATS_NET_UDP_U},
1107         .ftypes_nr      = {0, 0, 0},
1108 #ifdef SOURCE_SADF
1109         .f_render       = render_net_udp_stats,
1110         .f_xml_print    = xml_print_net_udp_stats,
1111         .f_json_print   = json_print_net_udp_stats,
1112         .f_svg_print    = svg_print_net_udp_stats,
1113         .f_raw_print    = raw_print_net_udp_stats,
1114         .f_pcp_print    = pcp_print_net_udp_stats,
1115         .f_count_new    = NULL,
1116         .item_list      = NULL,
1117         .desc           = "UDPv4 traffic statistics",
1118 #endif
1119         .name           = "A_NET_UDP",
1120         .item_list_sz   = 0,
1121         .g_nr           = 2,
1122         .nr_ini         = 1,
1123         .nr2            = 1,
1124         .nr_max         = 1,
1125         .nr             = {1, 1, 1},
1126         .nr_allocated   = 0,
1127         .fsize          = STATS_NET_UDP_SIZE,
1128         .msize          = STATS_NET_UDP_SIZE,
1129         .opt_flags      = 0,
1130         .buf            = {NULL, NULL, NULL},
1131         .bitmap         = NULL
1132 };
1133
1134 /* IPv6 sockets activity */
1135 struct activity net_sock6_act = {
1136         .id             = A_NET_SOCK6,
1137         .options        = AO_NULL,
1138         .magic          = ACTIVITY_MAGIC_BASE,
1139         .group          = G_IPV6,
1140 #ifdef SOURCE_SADC
1141         .f_count_index  = -1,
1142         .f_count2_index = -1,
1143         .f_read         = wrap_read_net_sock6,
1144 #endif
1145 #ifdef SOURCE_SAR
1146         .f_print        = print_net_sock6_stats,
1147         .f_print_avg    = print_avg_net_sock6_stats,
1148 #endif
1149 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1150         .hdr_line       = "tcp6sck;udp6sck;raw6sck;ip6-frag",
1151 #endif
1152         .gtypes_nr      = {STATS_NET_SOCK6_ULL, STATS_NET_SOCK6_UL, STATS_NET_SOCK6_U},
1153         .ftypes_nr      = {0, 0, 0},
1154 #ifdef SOURCE_SADF
1155         .f_render       = render_net_sock6_stats,
1156         .f_xml_print    = xml_print_net_sock6_stats,
1157         .f_json_print   = json_print_net_sock6_stats,
1158         .f_svg_print    = svg_print_net_sock6_stats,
1159         .f_raw_print    = raw_print_net_sock6_stats,
1160         .f_pcp_print    = pcp_print_net_sock6_stats,
1161         .f_count_new    = NULL,
1162         .item_list      = NULL,
1163         .desc           = "IPv6 sockets statistics",
1164 #endif
1165         .name           = "A_NET_SOCK6",
1166         .item_list_sz   = 0,
1167         .g_nr           = 1,
1168         .nr_ini         = 1,
1169         .nr2            = 1,
1170         .nr_max         = 1,
1171         .nr             = {1, 1, 1},
1172         .nr_allocated   = 0,
1173         .fsize          = STATS_NET_SOCK6_SIZE,
1174         .msize          = STATS_NET_SOCK6_SIZE,
1175         .opt_flags      = 0,
1176         .buf            = {NULL, NULL, NULL},
1177         .bitmap         = NULL
1178 };
1179
1180 /* IPv6 network traffic activity */
1181 struct activity net_ip6_act = {
1182         .id             = A_NET_IP6,
1183         .options        = AO_NULL,
1184         .magic          = ACTIVITY_MAGIC_BASE + 2,
1185         .group          = G_IPV6,
1186 #ifdef SOURCE_SADC
1187         .f_count_index  = -1,
1188         .f_count2_index = -1,
1189         .f_read         = wrap_read_net_ip6,
1190 #endif
1191 #ifdef SOURCE_SAR
1192         .f_print        = print_net_ip6_stats,
1193         .f_print_avg    = print_net_ip6_stats,
1194 #endif
1195 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1196         .hdr_line       = "irec6/s;fwddgm6/s;idel6/s;orq6/s;asmrq6/s;asmok6/s;"
1197                           "imcpck6/s;omcpck6/s;fragok6/s;fragcr6/s",
1198 #endif
1199         .gtypes_nr      = {STATS_NET_IP6_ULL, STATS_NET_IP6_UL, STATS_NET_IP6_U},
1200         .ftypes_nr      = {0, 0, 0},
1201 #ifdef SOURCE_SADF
1202         .f_render       = render_net_ip6_stats,
1203         .f_xml_print    = xml_print_net_ip6_stats,
1204         .f_json_print   = json_print_net_ip6_stats,
1205         .f_svg_print    = svg_print_net_ip6_stats,
1206         .f_raw_print    = raw_print_net_ip6_stats,
1207         .f_pcp_print    = pcp_print_net_ip6_stats,
1208         .f_count_new    = NULL,
1209         .item_list      = NULL,
1210         .desc           = "IPv6 traffic statistics",
1211 #endif
1212         .name           = "A_NET_IP6",
1213         .item_list_sz   = 0,
1214         .g_nr           = 4,
1215         .nr_ini         = 1,
1216         .nr2            = 1,
1217         .nr_max         = 1,
1218         .nr             = {1, 1, 1},
1219         .nr_allocated   = 0,
1220         .fsize          = STATS_NET_IP6_SIZE,
1221         .msize          = STATS_NET_IP6_SIZE,
1222         .opt_flags      = 0,
1223         .buf            = {NULL, NULL, NULL},
1224         .bitmap         = NULL
1225 };
1226
1227 /* IPv6 network traffic (errors) activity */
1228 struct activity net_eip6_act = {
1229         .id             = A_NET_EIP6,
1230         .options        = AO_NULL,
1231         .magic          = ACTIVITY_MAGIC_BASE + 2,
1232         .group          = G_IPV6,
1233 #ifdef SOURCE_SADC
1234         .f_count_index  = -1,
1235         .f_count2_index = -1,
1236         .f_read         = wrap_read_net_eip6,
1237 #endif
1238 #ifdef SOURCE_SAR
1239         .f_print        = print_net_eip6_stats,
1240         .f_print_avg    = print_net_eip6_stats,
1241 #endif
1242 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1243         .hdr_line       = "ihdrer6/s;iadrer6/s;iukwnp6/s;i2big6/s;idisc6/s;odisc6/s;"
1244                           "inort6/s;onort6/s;asmf6/s;fragf6/s;itrpck6/s",
1245 #endif
1246         .gtypes_nr      = {STATS_NET_EIP6_ULL, STATS_NET_EIP6_UL, STATS_NET_EIP6_U},
1247         .ftypes_nr      = {0, 0, 0},
1248 #ifdef SOURCE_SADF
1249         .f_render       = render_net_eip6_stats,
1250         .f_xml_print    = xml_print_net_eip6_stats,
1251         .f_json_print   = json_print_net_eip6_stats,
1252         .f_svg_print    = svg_print_net_eip6_stats,
1253         .f_raw_print    = raw_print_net_eip6_stats,
1254         .f_pcp_print    = pcp_print_net_eip6_stats,
1255         .f_count_new    = NULL,
1256         .item_list      = NULL,
1257         .desc           = "IPv6 traffic errors statistics",
1258 #endif
1259         .name           = "A_NET_EIP6",
1260         .item_list_sz   = 0,
1261         .g_nr           = 4,
1262         .nr_ini         = 1,
1263         .nr2            = 1,
1264         .nr_max         = 1,
1265         .nr             = {1, 1, 1},
1266         .nr_allocated   = 0,
1267         .fsize          = STATS_NET_EIP6_SIZE,
1268         .msize          = STATS_NET_EIP6_SIZE,
1269         .opt_flags      = 0,
1270         .buf            = {NULL, NULL, NULL},
1271         .bitmap         = NULL
1272 };
1273
1274 /* ICMPv6 network traffic activity */
1275 struct activity net_icmp6_act = {
1276         .id             = A_NET_ICMP6,
1277         .options        = AO_NULL,
1278         .magic          = ACTIVITY_MAGIC_BASE,
1279         .group          = G_IPV6,
1280 #ifdef SOURCE_SADC
1281         .f_count_index  = -1,
1282         .f_count2_index = -1,
1283         .f_read         = wrap_read_net_icmp6,
1284 #endif
1285 #ifdef SOURCE_SAR
1286         .f_print        = print_net_icmp6_stats,
1287         .f_print_avg    = print_net_icmp6_stats,
1288 #endif
1289 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1290         .hdr_line       = "imsg6/s;omsg6/s;iech6/s;iechr6/s;oechr6/s;igmbq6/s;igmbr6/s;ogmbr6/s;"
1291                           "igmbrd6/s;ogmbrd6/s;irtsol6/s;ortsol6/s;irtad6/s;inbsol6/s;onbsol6/s;"
1292                           "inbad6/s;onbad6/s",
1293 #endif
1294         .gtypes_nr      = {STATS_NET_ICMP6_ULL, STATS_NET_ICMP6_UL, STATS_NET_ICMP6_U},
1295         .ftypes_nr      = {0, 0, 0},
1296 #ifdef SOURCE_SADF
1297         .f_render       = render_net_icmp6_stats,
1298         .f_xml_print    = xml_print_net_icmp6_stats,
1299         .f_json_print   = json_print_net_icmp6_stats,
1300         .f_svg_print    = svg_print_net_icmp6_stats,
1301         .f_raw_print    = raw_print_net_icmp6_stats,
1302         .f_pcp_print    = pcp_print_net_icmp6_stats,
1303         .f_count_new    = NULL,
1304         .item_list      = NULL,
1305         .desc           = "ICMPv6 traffic statistics",
1306 #endif
1307         .name           = "A_NET_ICMP6",
1308         .item_list_sz   = 0,
1309         .g_nr           = 5,
1310         .nr_ini         = 1,
1311         .nr2            = 1,
1312         .nr_max         = 1,
1313         .nr             = {1, 1, 1},
1314         .nr_allocated   = 0,
1315         .fsize          = STATS_NET_ICMP6_SIZE,
1316         .msize          = STATS_NET_ICMP6_SIZE,
1317         .opt_flags      = 0,
1318         .buf            = {NULL, NULL, NULL},
1319         .bitmap         = NULL
1320 };
1321
1322 /* ICMPv6 network traffic (errors) activity */
1323 struct activity net_eicmp6_act = {
1324         .id             = A_NET_EICMP6,
1325         .options        = AO_NULL,
1326         .magic          = ACTIVITY_MAGIC_BASE,
1327         .group          = G_IPV6,
1328 #ifdef SOURCE_SADC
1329         .f_count_index  = -1,
1330         .f_count2_index = -1,
1331         .f_read         = wrap_read_net_eicmp6,
1332 #endif
1333 #ifdef SOURCE_SAR
1334         .f_print        = print_net_eicmp6_stats,
1335         .f_print_avg    = print_net_eicmp6_stats,
1336 #endif
1337 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1338         .hdr_line       = "ierr6/s;idtunr6/s;odtunr6/s;itmex6/s;otmex6/s;"
1339                           "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s",
1340 #endif
1341         .gtypes_nr      = {STATS_NET_EICMP6_ULL, STATS_NET_EICMP6_UL, STATS_NET_EICMP6_U},
1342         .ftypes_nr      = {0, 0, 0},
1343 #ifdef SOURCE_SADF
1344         .f_render       = render_net_eicmp6_stats,
1345         .f_xml_print    = xml_print_net_eicmp6_stats,
1346         .f_json_print   = json_print_net_eicmp6_stats,
1347         .f_svg_print    = svg_print_net_eicmp6_stats,
1348         .f_raw_print    = raw_print_net_eicmp6_stats,
1349         .f_pcp_print    = pcp_print_net_eicmp6_stats,
1350         .f_count_new    = NULL,
1351         .item_list      = NULL,
1352         .desc           = "ICMPv6 traffic errors statistics",
1353 #endif
1354         .name           = "A_NET_EICMP6",
1355         .item_list_sz   = 0,
1356         .g_nr           = 6,
1357         .nr_ini         = 1,
1358         .nr2            = 1,
1359         .nr_max         = 1,
1360         .nr             = {1, 1, 1},
1361         .nr_allocated   = 0,
1362         .fsize          = STATS_NET_EICMP6_SIZE,
1363         .msize          = STATS_NET_EICMP6_SIZE,
1364         .opt_flags      = 0,
1365         .buf            = {NULL, NULL, NULL},
1366         .bitmap         = NULL
1367 };
1368
1369 /* UDPv6 network traffic activity */
1370 struct activity net_udp6_act = {
1371         .id             = A_NET_UDP6,
1372         .options        = AO_NULL,
1373         .magic          = ACTIVITY_MAGIC_BASE,
1374         .group          = G_IPV6,
1375 #ifdef SOURCE_SADC
1376         .f_count_index  = -1,
1377         .f_count2_index = -1,
1378         .f_read         = wrap_read_net_udp6,
1379 #endif
1380 #ifdef SOURCE_SAR
1381         .f_print        = print_net_udp6_stats,
1382         .f_print_avg    = print_net_udp6_stats,
1383 #endif
1384 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1385         .hdr_line       = "idgm6/s;odgm6/s;noport6/s;idgmer6/s",
1386 #endif
1387         .gtypes_nr      = {STATS_NET_UDP6_ULL, STATS_NET_UDP6_UL, STATS_NET_UDP6_U},
1388         .ftypes_nr      = {0, 0, 0},
1389 #ifdef SOURCE_SADF
1390         .f_render       = render_net_udp6_stats,
1391         .f_xml_print    = xml_print_net_udp6_stats,
1392         .f_json_print   = json_print_net_udp6_stats,
1393         .f_svg_print    = svg_print_net_udp6_stats,
1394         .f_raw_print    = raw_print_net_udp6_stats,
1395         .f_pcp_print    = pcp_print_net_udp6_stats,
1396         .f_count_new    = NULL,
1397         .item_list      = NULL,
1398         .desc           = "UDPv6 traffic statistics",
1399 #endif
1400         .name           = "A_NET_UDP6",
1401         .item_list_sz   = 0,
1402         .g_nr           = 2,
1403         .nr_ini         = 1,
1404         .nr2            = 1,
1405         .nr_max         = 1,
1406         .nr             = {1, 1, 1},
1407         .nr_allocated   = 0,
1408         .fsize          = STATS_NET_UDP6_SIZE,
1409         .msize          = STATS_NET_UDP6_SIZE,
1410         .opt_flags      = 0,
1411         .buf            = {NULL, NULL, NULL},
1412         .bitmap         = NULL
1413 };
1414
1415 /* CPU frequency */
1416 struct activity pwr_cpufreq_act = {
1417         .id             = A_PWR_CPU,
1418         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1419         .magic          = ACTIVITY_MAGIC_BASE,
1420         .group          = G_POWER,
1421 #ifdef SOURCE_SADC
1422         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1423         .f_count2_index = -1,
1424         .f_read         = wrap_read_cpuinfo,
1425 #endif
1426 #ifdef SOURCE_SAR
1427         .f_print        = print_pwr_cpufreq_stats,
1428         .f_print_avg    = print_avg_pwr_cpufreq_stats,
1429 #endif
1430 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1431         .hdr_line       = "CPU;MHz",
1432 #endif
1433         .gtypes_nr      = {STATS_PWR_CPUFREQ_ULL, STATS_PWR_CPUFREQ_UL, STATS_PWR_CPUFREQ_U},
1434         .ftypes_nr      = {0, 0, 0},
1435 #ifdef SOURCE_SADF
1436         .f_render       = render_pwr_cpufreq_stats,
1437         .f_xml_print    = xml_print_pwr_cpufreq_stats,
1438         .f_json_print   = json_print_pwr_cpufreq_stats,
1439         .f_svg_print    = svg_print_pwr_cpufreq_stats,
1440         .f_raw_print    = raw_print_pwr_cpufreq_stats,
1441         .f_pcp_print    = pcp_print_pwr_cpufreq_stats,
1442         .f_count_new    = NULL,
1443         .item_list      = NULL,
1444         .desc           = "CPU clock frequency",
1445 #endif
1446         .name           = "A_PWR_CPU",
1447         .item_list_sz   = 0,
1448         .g_nr           = 1,
1449         .nr_ini         = -1,
1450         .nr2            = 1,
1451         .nr_max         = NR_CPUS + 1,
1452         .nr             = {-1, -1, -1},
1453         .nr_allocated   = 0,
1454         .fsize          = STATS_PWR_CPUFREQ_SIZE,
1455         .msize          = STATS_PWR_CPUFREQ_SIZE,
1456         .opt_flags      = 0,
1457         .buf            = {NULL, NULL, NULL},
1458         .bitmap         = &cpu_bitmap
1459 };
1460
1461 /* Fan */
1462 struct activity pwr_fan_act = {
1463         .id             = A_PWR_FAN,
1464         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1465         .magic          = ACTIVITY_MAGIC_BASE,
1466         .group          = G_POWER,
1467 #ifdef SOURCE_SADC
1468         .f_count_index  = 5,    /* wrap_get_fan_nr() */
1469         .f_count2_index = -1,
1470         .f_read         = wrap_read_fan,
1471 #endif
1472 #ifdef SOURCE_SAR
1473         .f_print        = print_pwr_fan_stats,
1474         .f_print_avg    = print_avg_pwr_fan_stats,
1475 #endif
1476 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1477         .hdr_line       = "FAN;DEVICE;rpm;drpm",
1478 #endif
1479         .gtypes_nr      = {STATS_PWR_FAN_ULL, STATS_PWR_FAN_UL, STATS_PWR_FAN_U},
1480         .ftypes_nr      = {0, 0, 0},
1481 #ifdef SOURCE_SADF
1482         .f_render       = render_pwr_fan_stats,
1483         .f_xml_print    = xml_print_pwr_fan_stats,
1484         .f_json_print   = json_print_pwr_fan_stats,
1485         .f_svg_print    = svg_print_pwr_fan_stats,
1486         .f_raw_print    = raw_print_pwr_fan_stats,
1487         .f_pcp_print    = pcp_print_pwr_fan_stats,
1488         .f_count_new    = NULL,
1489         .item_list      = NULL,
1490         .desc           = "Fans speed",
1491 #endif
1492         .name           = "A_PWR_FAN",
1493         .item_list_sz   = 0,
1494         .g_nr           = 1,
1495         .nr_ini         = -1,
1496         .nr2            = 1,
1497         .nr_max         = MAX_NR_FANS,
1498         .nr             = {-1, -1, -1},
1499         .nr_allocated   = 0,
1500         .fsize          = STATS_PWR_FAN_SIZE,
1501         .msize          = STATS_PWR_FAN_SIZE,
1502         .opt_flags      = 0,
1503         .buf            = {NULL, NULL, NULL},
1504         .bitmap         = NULL
1505 };
1506
1507 /* Temperature */
1508 struct activity pwr_temp_act = {
1509         .id             = A_PWR_TEMP,
1510         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1511         .magic          = ACTIVITY_MAGIC_BASE,
1512         .group          = G_POWER,
1513 #ifdef SOURCE_SADC
1514         .f_count_index  = 6,    /* wrap_get_temp_nr() */
1515         .f_count2_index = -1,
1516         .f_read         = wrap_read_temp,
1517 #endif
1518 #ifdef SOURCE_SAR
1519         .f_print        = print_pwr_temp_stats,
1520         .f_print_avg    = print_avg_pwr_temp_stats,
1521 #endif
1522 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1523         .hdr_line       = "TEMP;DEVICE;degC;%temp",
1524 #endif
1525         .gtypes_nr      = {STATS_PWR_TEMP_ULL, STATS_PWR_TEMP_UL, STATS_PWR_TEMP_U},
1526         .ftypes_nr      = {0, 0, 0},
1527 #ifdef SOURCE_SADF
1528         .f_render       = render_pwr_temp_stats,
1529         .f_xml_print    = xml_print_pwr_temp_stats,
1530         .f_json_print   = json_print_pwr_temp_stats,
1531         .f_svg_print    = svg_print_pwr_temp_stats,
1532         .f_raw_print    = raw_print_pwr_temp_stats,
1533         .f_pcp_print    = pcp_print_pwr_temp_stats,
1534         .f_count_new    = NULL,
1535         .item_list      = NULL,
1536         .desc           = "Devices temperature",
1537 #endif
1538         .name           = "A_PWR_TEMP",
1539         .item_list_sz   = 0,
1540         .g_nr           = 2,
1541         .nr_ini         = -1,
1542         .nr2            = 1,
1543         .nr_max         = MAX_NR_TEMP_SENSORS,
1544         .nr             = {-1, -1, -1},
1545         .nr_allocated   = 0,
1546         .fsize          = STATS_PWR_TEMP_SIZE,
1547         .msize          = STATS_PWR_TEMP_SIZE,
1548         .opt_flags      = 0,
1549         .buf            = {NULL, NULL, NULL},
1550         .bitmap         = NULL
1551 };
1552
1553 /* Voltage inputs */
1554 struct activity pwr_in_act = {
1555         .id             = A_PWR_IN,
1556         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1557         .magic          = ACTIVITY_MAGIC_BASE,
1558         .group          = G_POWER,
1559 #ifdef SOURCE_SADC
1560         .f_count_index  = 7,    /* wrap_get_in_nr() */
1561         .f_count2_index = -1,
1562         .f_read         = wrap_read_in,
1563 #endif
1564 #ifdef SOURCE_SAR
1565         .f_print        = print_pwr_in_stats,
1566         .f_print_avg    = print_avg_pwr_in_stats,
1567 #endif
1568 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1569         .hdr_line       = "IN;DEVICE;inV;%in",
1570 #endif
1571         .gtypes_nr      = {STATS_PWR_IN_ULL, STATS_PWR_IN_UL, STATS_PWR_IN_U},
1572         .ftypes_nr      = {0, 0, 0},
1573 #ifdef SOURCE_SADF
1574         .f_render       = render_pwr_in_stats,
1575         .f_xml_print    = xml_print_pwr_in_stats,
1576         .f_json_print   = json_print_pwr_in_stats,
1577         .f_svg_print    = svg_print_pwr_in_stats,
1578         .f_raw_print    = raw_print_pwr_in_stats,
1579         .f_pcp_print    = pcp_print_pwr_in_stats,
1580         .f_count_new    = NULL,
1581         .item_list      = NULL,
1582         .desc           = "Voltage inputs statistics",
1583 #endif
1584         .name           = "A_PWR_IN",
1585         .item_list_sz   = 0,
1586         .g_nr           = 2,
1587         .nr_ini         = -1,
1588         .nr2            = 1,
1589         .nr_max         = MAX_NR_IN_SENSORS,
1590         .nr             = {-1, -1, -1},
1591         .nr_allocated   = 0,
1592         .fsize          = STATS_PWR_IN_SIZE,
1593         .msize          = STATS_PWR_IN_SIZE,
1594         .opt_flags      = 0,
1595         .buf            = {NULL, NULL, NULL},
1596         .bitmap         = NULL
1597 };
1598
1599 /* Hugepages activity */
1600 struct activity huge_act = {
1601         .id             = A_HUGE,
1602         .options        = AO_COLLECTED,
1603         .magic          = ACTIVITY_MAGIC_BASE + 1,
1604         .group          = G_DEFAULT,
1605 #ifdef SOURCE_SADC
1606         .f_count_index  = -1,
1607         .f_count2_index = -1,
1608         .f_read         = wrap_read_meminfo_huge,
1609 #endif
1610 #ifdef SOURCE_SAR
1611         .f_print        = print_huge_stats,
1612         .f_print_avg    = print_avg_huge_stats,
1613 #endif
1614 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1615         .hdr_line       = "kbhugfree;kbhugused;%hugused;kbhugrsvd;kbhugsurp",
1616 #endif
1617         .gtypes_nr      = {STATS_HUGE_ULL, STATS_HUGE_UL, STATS_HUGE_U},
1618         .ftypes_nr      = {0, 0, 0},
1619 #ifdef SOURCE_SADF
1620         .f_render       = render_huge_stats,
1621         .f_xml_print    = xml_print_huge_stats,
1622         .f_json_print   = json_print_huge_stats,
1623         .f_svg_print    = svg_print_huge_stats,
1624         .f_raw_print    = raw_print_huge_stats,
1625         .f_pcp_print    = pcp_print_huge_stats,
1626         .f_count_new    = NULL,
1627         .item_list      = NULL,
1628         .desc           = "Huge pages utilization",
1629 #endif
1630         .name           = "A_HUGE",
1631         .item_list_sz   = 0,
1632         .g_nr           = 2,
1633         .nr_ini         = 1,
1634         .nr2            = 1,
1635         .nr_max         = 1,
1636         .nr             = {1, 1, 1},
1637         .nr_allocated   = 0,
1638         .fsize          = STATS_HUGE_SIZE,
1639         .msize          = STATS_HUGE_SIZE,
1640         .opt_flags      = 0,
1641         .buf            = {NULL, NULL, NULL},
1642         .bitmap         = NULL
1643 };
1644
1645 /* CPU weighted frequency */
1646 struct activity pwr_wghfreq_act = {
1647         .id             = A_PWR_FREQ,
1648         .options        = AO_COUNTED + AO_MATRIX,
1649         .magic          = ACTIVITY_MAGIC_BASE + 1,
1650         .group          = G_POWER,
1651 #ifdef SOURCE_SADC
1652         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1653         .f_count2_index = 12,   /* wrap_get_freq_nr() */
1654         .f_read         = wrap_read_cpu_wghfreq,
1655 #endif
1656 #ifdef SOURCE_SAR
1657         .f_print        = print_pwr_wghfreq_stats,
1658         .f_print_avg    = print_pwr_wghfreq_stats,
1659 #endif
1660 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1661         .hdr_line       = "CPU;wghMHz",
1662 #endif
1663         .gtypes_nr      = {STATS_PWR_WGHFREQ_ULL, STATS_PWR_WGHFREQ_UL, STATS_PWR_WGHFREQ_U},
1664         .ftypes_nr      = {0, 0, 0},
1665 #ifdef SOURCE_SADF
1666         .f_render       = render_pwr_wghfreq_stats,
1667         .f_xml_print    = xml_print_pwr_wghfreq_stats,
1668         .f_json_print   = json_print_pwr_wghfreq_stats,
1669         .f_svg_print    = NULL,
1670         .f_raw_print    = raw_print_pwr_wghfreq_stats,
1671         .f_count_new    = NULL,
1672         .item_list      = NULL,
1673         .desc           = "CPU weighted frequency",
1674 #endif
1675         .name           = "A_PWR_FREQ",
1676         .item_list_sz   = 0,
1677         .g_nr           = 0,
1678         .nr_ini         = -1,
1679         .nr2            = -1,
1680         .nr_max         = NR_CPUS + 1,
1681         .nr             = {-1, -1, -1},
1682         .nr_allocated   = 0,
1683         .fsize          = STATS_PWR_WGHFREQ_SIZE,
1684         .msize          = STATS_PWR_WGHFREQ_SIZE,
1685         .opt_flags      = 0,
1686         .buf            = {NULL, NULL, NULL},
1687         .bitmap         = &cpu_bitmap
1688 };
1689
1690 /* USB devices plugged into the system */
1691 struct activity pwr_usb_act = {
1692         .id             = A_PWR_USB,
1693         .options        = AO_COUNTED + AO_CLOSE_MARKUP,
1694         .magic          = ACTIVITY_MAGIC_BASE,
1695         .group          = G_POWER,
1696 #ifdef SOURCE_SADC
1697         .f_count_index  = 8,    /* wrap_get_usb_nr() */
1698         .f_count2_index = -1,
1699         .f_read         = wrap_read_bus_usb_dev,
1700 #endif
1701 #ifdef SOURCE_SAR
1702         .f_print        = print_pwr_usb_stats,
1703         .f_print_avg    = print_avg_pwr_usb_stats,
1704 #endif
1705 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1706         .hdr_line       = "manufact;product;BUS;idvendor;idprod;maxpower",
1707 #endif
1708         .gtypes_nr      = {STATS_PWR_USB_ULL, STATS_PWR_USB_UL, STATS_PWR_USB_U},
1709         .ftypes_nr      = {0, 0, 0},
1710 #ifdef SOURCE_SADF
1711         .f_render       = render_pwr_usb_stats,
1712         .f_xml_print    = xml_print_pwr_usb_stats,
1713         .f_json_print   = json_print_pwr_usb_stats,
1714         .f_svg_print    = NULL,
1715         .f_raw_print    = raw_print_pwr_usb_stats,
1716         .f_pcp_print    = pcp_print_pwr_usb_stats,
1717         .f_count_new    = NULL,
1718         .item_list      = NULL,
1719         .desc           = "USB devices",
1720 #endif
1721         .name           = "A_PWR_USB",
1722         .item_list_sz   = 0,
1723         .g_nr           = 0,
1724         .nr_ini         = -1,
1725         .nr2            = 1,
1726         .nr_max         = MAX_NR_USB,
1727         .nr             = {-1, -1, -1},
1728         .nr_allocated   = 0,
1729         .fsize          = STATS_PWR_USB_SIZE,
1730         .msize          = STATS_PWR_USB_SIZE,
1731         .opt_flags      = 0,
1732         .buf            = {NULL, NULL, NULL},
1733         .bitmap         = NULL
1734 };
1735
1736 /* Filesystem usage activity */
1737 struct activity filesystem_act = {
1738         .id             = A_FS,
1739         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM + AO_MULTIPLE_OUTPUTS,
1740         .magic          = ACTIVITY_MAGIC_BASE + 1,
1741         .group          = G_XDISK,
1742 #ifdef SOURCE_SADC
1743         .f_count_index  = 9,    /* wrap_get_filesystem_nr() */
1744         .f_count2_index = -1,
1745         .f_read         = wrap_read_filesystem,
1746 #endif
1747 #ifdef SOURCE_SAR
1748         .f_print        = print_filesystem_stats,
1749         .f_print_avg    = print_avg_filesystem_stats,
1750 #endif
1751 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1752         .hdr_line       = "FILESYSTEM;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused|"
1753                           "MOUNTPOINT;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused",
1754 #endif
1755         .gtypes_nr      = {STATS_FILESYSTEM_ULL, STATS_FILESYSTEM_UL, STATS_FILESYSTEM_U},
1756         .ftypes_nr      = {0, 0, 0},
1757 #ifdef SOURCE_SADF
1758         .f_render       = render_filesystem_stats,
1759         .f_xml_print    = xml_print_filesystem_stats,
1760         .f_json_print   = json_print_filesystem_stats,
1761         .f_svg_print    = svg_print_filesystem_stats,
1762         .f_raw_print    = raw_print_filesystem_stats,
1763         .f_pcp_print    = pcp_print_filesystem_stats,
1764         .f_count_new    = count_new_filesystem,
1765         .item_list      = NULL,
1766         .desc           = "Filesystems statistics",
1767 #endif
1768         .name           = "A_FS",
1769         .item_list_sz   = 0,
1770         .g_nr           = 4,
1771         .nr_ini         = -1,
1772         .nr2            = 1,
1773         .nr_max         = MAX_NR_FS,
1774         .nr             = {-1, -1, -1},
1775         .nr_allocated   = 0,
1776         .fsize          = STATS_FILESYSTEM_SIZE,
1777         .msize          = STATS_FILESYSTEM_SIZE,
1778         .opt_flags      = 0,
1779         .buf            = {NULL, NULL, NULL},
1780         .bitmap         = NULL
1781 };
1782
1783 /* Fibre Channel HBA usage activity */
1784 struct activity fchost_act = {
1785         .id             = A_NET_FC,
1786         .options        = AO_COUNTED + AO_GRAPH_PER_ITEM,
1787         .magic          = ACTIVITY_MAGIC_BASE,
1788         .group          = G_DISK,
1789 #ifdef SOURCE_SADC
1790         .f_count_index  = 10,   /* wrap_get_fchost_nr() */
1791         .f_count2_index = -1,
1792         .f_read         = wrap_read_fchost,
1793 #endif
1794 #ifdef SOURCE_SAR
1795         .f_print        = print_fchost_stats,
1796         .f_print_avg    = print_fchost_stats,
1797 #endif
1798 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1799         .hdr_line       = "FCHOST;fch_rxf/s;fch_txf/s;fch_rxw/s;fch_txw/s",
1800 #endif
1801         .gtypes_nr      = {STATS_FCHOST_ULL, STATS_FCHOST_UL, STATS_FCHOST_U},
1802         .ftypes_nr      = {0, 0, 0},
1803 #ifdef SOURCE_SADF
1804         .f_render       = render_fchost_stats,
1805         .f_xml_print    = xml_print_fchost_stats,
1806         .f_json_print   = json_print_fchost_stats,
1807         .f_svg_print    = svg_print_fchost_stats,
1808         .f_raw_print    = raw_print_fchost_stats,
1809         .f_pcp_print    = pcp_print_fchost_stats,
1810         .f_count_new    = count_new_fchost,
1811         .item_list      = NULL,
1812         .desc           = "Fibre Channel HBA statistics",
1813 #endif
1814         .name           = "A_NET_FC",
1815         .item_list_sz   = 0,
1816         .g_nr           = 2,
1817         .nr_ini         = -1,
1818         .nr2            = 1,
1819         .nr_max         = MAX_NR_FCHOSTS,
1820         .nr             = {-1, -1, -1},
1821         .nr_allocated   = 0,
1822         .fsize          = STATS_FCHOST_SIZE,
1823         .msize          = STATS_FCHOST_SIZE,
1824         .opt_flags      = 0,
1825         .buf            = {NULL, NULL, NULL},
1826         .bitmap         = NULL
1827 };
1828
1829 /* Softnet activity */
1830 struct activity softnet_act = {
1831         .id             = A_NET_SOFT,
1832         .options        = AO_COLLECTED + AO_COUNTED + AO_CLOSE_MARKUP +
1833                           AO_GRAPH_PER_ITEM + AO_PERSISTENT,
1834         .magic          = ACTIVITY_MAGIC_BASE,
1835         .group          = G_DEFAULT,
1836 #ifdef SOURCE_SADC
1837         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1838         .f_count2_index = -1,
1839         .f_read         = wrap_read_softnet,
1840 #endif
1841 #ifdef SOURCE_SAR
1842         .f_print        = print_softnet_stats,
1843         .f_print_avg    = print_softnet_stats,
1844 #endif
1845 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1846         .hdr_line       = "CPU;total/s;dropd/s;squeezd/s;rx_rps/s;flw_lim/s",
1847 #endif
1848         .gtypes_nr      = {STATS_SOFTNET_ULL, STATS_SOFTNET_UL, STATS_SOFTNET_U},
1849         .ftypes_nr      = {0, 0, 0},
1850 #ifdef SOURCE_SADF
1851         .f_render       = render_softnet_stats,
1852         .f_xml_print    = xml_print_softnet_stats,
1853         .f_json_print   = json_print_softnet_stats,
1854         .f_svg_print    = svg_print_softnet_stats,
1855         .f_raw_print    = raw_print_softnet_stats,
1856         .f_pcp_print    = pcp_print_softnet_stats,
1857         .f_count_new    = NULL,
1858         .item_list      = NULL,
1859         .desc           = "Software-based network processing statistics",
1860 #endif
1861         .name           = "A_NET_SOFT",
1862         .item_list_sz   = 0,
1863         .g_nr           = 2,
1864         .nr_ini         = -1,
1865         .nr2            = 1,
1866         .nr_max         = NR_CPUS + 1,
1867         .nr             = {-1, -1, -1},
1868         .nr_allocated   = 0,
1869         .fsize          = STATS_SOFTNET_SIZE,
1870         .msize          = STATS_SOFTNET_SIZE,
1871         .opt_flags      = 0,
1872         .buf            = {NULL, NULL, NULL},
1873         .bitmap         = &cpu_bitmap
1874 };
1875
1876 /* Pressure-stall CPU activity */
1877 struct activity psi_cpu_act = {
1878         .id             = A_PSI_CPU,
1879         .options        = AO_COLLECTED + AO_DETECTED,
1880         .magic          = ACTIVITY_MAGIC_BASE,
1881         .group          = G_DEFAULT,
1882 #ifdef SOURCE_SADC
1883         .f_count_index  = 11,   /* wrap_detect_psi() */
1884         .f_count2_index = -1,
1885         .f_read         = wrap_read_psicpu,
1886 #endif
1887 #ifdef SOURCE_SAR
1888         .f_print        = print_psicpu_stats,
1889         .f_print_avg    = print_avg_psicpu_stats,
1890 #endif
1891 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1892         .hdr_line       = "%scpu-10;%scpu-60;%scpu-300;%scpu",
1893 #endif
1894         .gtypes_nr      = {STATS_PSI_CPU_ULL, STATS_PSI_CPU_UL, STATS_PSI_CPU_U},
1895         .ftypes_nr      = {0, 0, 0},
1896 #ifdef SOURCE_SADF
1897         .f_render       = render_psicpu_stats,
1898         .f_xml_print    = xml_print_psicpu_stats,
1899         .f_json_print   = json_print_psicpu_stats,
1900         .f_svg_print    = svg_print_psicpu_stats,
1901         .f_raw_print    = raw_print_psicpu_stats,
1902         .f_pcp_print    = pcp_print_psicpu_stats,
1903         .f_count_new    = NULL,
1904         .item_list      = NULL,
1905         .desc           = "Pressure-stall CPU statistics",
1906 #endif
1907         .name           = "A_PSI_CPU",
1908         .item_list_sz   = 0,
1909         .g_nr           = 2,
1910         .nr_ini         = 1,
1911         .nr2            = 1,
1912         .nr_max         = 1,
1913         .nr             = {1, 1, 1},
1914         .nr_allocated   = 0,
1915         .fsize          = STATS_PSI_CPU_SIZE,
1916         .msize          = STATS_PSI_CPU_SIZE,
1917         .opt_flags      = 0,
1918         .buf            = {NULL, NULL, NULL},
1919         .bitmap         = NULL
1920 };
1921
1922 /* Pressure-stall I/O activity */
1923 struct activity psi_io_act = {
1924         .id             = A_PSI_IO,
1925         .options        = AO_COLLECTED + AO_DETECTED,
1926         .magic          = ACTIVITY_MAGIC_BASE,
1927         .group          = G_DEFAULT,
1928 #ifdef SOURCE_SADC
1929         .f_count_index  = 11,   /* wrap_detect_psi() */
1930         .f_count2_index = -1,
1931         .f_read         = wrap_read_psiio,
1932 #endif
1933 #ifdef SOURCE_SAR
1934         .f_print        = print_psiio_stats,
1935         .f_print_avg    = print_avg_psiio_stats,
1936 #endif
1937 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1938         .hdr_line       = "%sio-10;%sio-60;%sio-300;%sio;%fio-10;%fio-60;%fio-300;%fio",
1939 #endif
1940         .gtypes_nr      = {STATS_PSI_IO_ULL, STATS_PSI_IO_UL, STATS_PSI_IO_U},
1941         .ftypes_nr      = {0, 0, 0},
1942 #ifdef SOURCE_SADF
1943         .f_render       = render_psiio_stats,
1944         .f_xml_print    = xml_print_psiio_stats,
1945         .f_json_print   = json_print_psiio_stats,
1946         .f_svg_print    = svg_print_psiio_stats,
1947         .f_raw_print    = raw_print_psiio_stats,
1948         .f_pcp_print    = pcp_print_psiio_stats,
1949         .f_count_new    = NULL,
1950         .item_list      = NULL,
1951         .desc           = "Pressure-stall I/O statistics",
1952 #endif
1953         .name           = "A_PSI_IO",
1954         .item_list_sz   = 0,
1955         .g_nr           = 4,
1956         .nr_ini         = 1,
1957         .nr2            = 1,
1958         .nr_max         = 1,
1959         .nr             = {1, 1, 1},
1960         .nr_allocated   = 0,
1961         .fsize          = STATS_PSI_IO_SIZE,
1962         .msize          = STATS_PSI_IO_SIZE,
1963         .opt_flags      = 0,
1964         .buf            = {NULL, NULL, NULL},
1965         .bitmap         = NULL
1966 };
1967
1968 /* Pressure-stall memory activity */
1969 struct activity psi_mem_act = {
1970         .id             = A_PSI_MEM,
1971         .options        = AO_COLLECTED + AO_DETECTED + AO_CLOSE_MARKUP,
1972         .magic          = ACTIVITY_MAGIC_BASE,
1973         .group          = G_DEFAULT,
1974 #ifdef SOURCE_SADC
1975         .f_count_index  = 11,   /* wrap_detect_psi() */
1976         .f_count2_index = -1,
1977         .f_read         = wrap_read_psimem,
1978 #endif
1979 #ifdef SOURCE_SAR
1980         .f_print        = print_psimem_stats,
1981         .f_print_avg    = print_avg_psimem_stats,
1982 #endif
1983 #if defined(SOURCE_SAR) || defined(SOURCE_SADF)
1984         .hdr_line       = "%smem-10;%smem-60;%smem-300;%smem;%fmem-10;%fmem-60;%fmem-300;%fmem",
1985 #endif
1986         .gtypes_nr      = {STATS_PSI_MEM_ULL, STATS_PSI_MEM_UL, STATS_PSI_MEM_U},
1987         .ftypes_nr      = {0, 0, 0},
1988 #ifdef SOURCE_SADF
1989         .f_render       = render_psimem_stats,
1990         .f_xml_print    = xml_print_psimem_stats,
1991         .f_json_print   = json_print_psimem_stats,
1992         .f_svg_print    = svg_print_psimem_stats,
1993         .f_raw_print    = raw_print_psimem_stats,
1994         .f_pcp_print    = pcp_print_psimem_stats,
1995         .f_count_new    = NULL,
1996         .item_list      = NULL,
1997         .desc           = "Pressure-stall memory statistics",
1998 #endif
1999         .name           = "A_PSI_MEM",
2000         .item_list_sz   = 0,
2001         .g_nr           = 4,
2002         .nr_ini         = 1,
2003         .nr2            = 1,
2004         .nr_max         = 1,
2005         .nr             = {1, 1, 1},
2006         .nr_allocated   = 0,
2007         .fsize          = STATS_PSI_MEM_SIZE,
2008         .msize          = STATS_PSI_MEM_SIZE,
2009         .opt_flags      = 0,
2010         .buf            = {NULL, NULL, NULL},
2011         .bitmap         = NULL
2012 };
2013 /* wrap_detect_psi */
2014 #ifdef SOURCE_SADC
2015 /*
2016  * Array of functions used to count number of items.
2017  */
2018 __nr_t (*f_count[NR_F_COUNT]) (struct activity *) = {
2019         wrap_get_cpu_nr,        /* 0 */
2020         wrap_get_irq_nr,        /* 1 */
2021         wrap_get_serial_nr,     /* 2 */
2022         wrap_get_disk_nr,       /* 3 */
2023         wrap_get_iface_nr,      /* 4 */
2024         wrap_get_fan_nr,        /* 5 */
2025         wrap_get_temp_nr,       /* 6 */
2026         wrap_get_in_nr,         /* 7 */
2027         wrap_get_usb_nr,        /* 8 */
2028         wrap_get_filesystem_nr, /* 9 */
2029         wrap_get_fchost_nr,     /* 10 */
2030         wrap_detect_psi,        /* 11 */
2031         wrap_get_freq_nr        /* 12 */
2032 };
2033 #endif
2034
2035 /*
2036  * Array of activities.
2037  * (Order of activities doesn't matter for daily data files).
2038  */
2039 struct activity *act[NR_ACT] = {
2040         &cpu_act,
2041         &pcsw_act,
2042         &irq_act,
2043         &swap_act,
2044         &paging_act,
2045         &io_act,
2046         &memory_act,
2047         &huge_act,
2048         &ktables_act,
2049         &queue_act,
2050         &serial_act,
2051         &disk_act,
2052         /* <network> */
2053         &net_dev_act,
2054         &net_edev_act,
2055         &net_nfs_act,
2056         &net_nfsd_act,
2057         &net_sock_act,
2058         &net_ip_act,
2059         &net_eip_act,
2060         &net_icmp_act,
2061         &net_eicmp_act,
2062         &net_tcp_act,
2063         &net_etcp_act,
2064         &net_udp_act,
2065         &net_sock6_act,
2066         &net_ip6_act,
2067         &net_eip6_act,
2068         &net_icmp6_act,
2069         &net_eicmp6_act,
2070         &net_udp6_act,
2071         &fchost_act,
2072         &softnet_act,   /* AO_CLOSE_MARKUP */
2073         /* </network> */
2074         /* <power-management> */
2075         &pwr_cpufreq_act,
2076         &pwr_fan_act,
2077         &pwr_temp_act,
2078         &pwr_in_act,
2079         &pwr_wghfreq_act,
2080         &pwr_usb_act,   /* AO_CLOSE_MARKUP */
2081         /* </power-management> */
2082         &filesystem_act,
2083         /* <psi> */
2084         &psi_cpu_act,
2085         &psi_io_act,
2086         &psi_mem_act    /* AO_CLOSE_MARKUP */
2087         /* </psi> */
2088 };