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