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