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