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