]> granicus.if.org Git - sysstat/blob - activity.c
SVG: Add SVG output for voltage inputs 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         .f_svg_print    = svg_print_net_sock_stats,
601         .hdr_line       = "totsck;tcpsck;udpsck;rawsck;ip-frag;tcp-tw",
602         .name           = "A_NET_SOCK",
603         .g_nr           = 2,
604 #endif
605         .nr             = 1,
606         .nr2            = 1,
607         .nr_max         = 1,
608         .fsize          = STATS_NET_SOCK_SIZE,
609         .msize          = STATS_NET_SOCK_SIZE,
610         .opt_flags      = 0,
611         .buf            = {NULL, NULL, NULL},
612         .bitmap         = NULL
613 };
614
615 /* IP network traffic activity */
616 struct activity net_ip_act = {
617         .id             = A_NET_IP,
618         .options        = AO_NULL,
619         .magic          = ACTIVITY_MAGIC_BASE + 1,
620         .group          = G_SNMP,
621 #ifdef SOURCE_SADC
622         .f_count_index  = -1,
623         .f_count2       = NULL,
624         .f_read         = wrap_read_net_ip,
625 #endif
626 #ifdef SOURCE_SAR
627         .f_print        = print_net_ip_stats,
628         .f_print_avg    = print_net_ip_stats,
629 #endif
630 #ifdef SOURCE_SADF
631         .f_render       = render_net_ip_stats,
632         .f_xml_print    = xml_print_net_ip_stats,
633         .f_json_print   = json_print_net_ip_stats,
634         .f_svg_print    = svg_print_net_ip_stats,
635         .hdr_line       = "irec/s;fwddgm/s;idel/s;orq/s;asmrq/s;asmok/s;fragok/s;fragcrt/s",
636         .name           = "A_NET_IP",
637         .g_nr           = 3,
638 #endif
639         .nr             = 1,
640         .nr2            = 1,
641         .nr_max         = 1,
642         .fsize          = STATS_NET_IP_SIZE,
643         .msize          = STATS_NET_IP_SIZE,
644         .opt_flags      = 0,
645         .buf            = {NULL, NULL, NULL},
646         .bitmap         = NULL
647 };
648
649 /* IP network traffic (errors) activity */
650 struct activity net_eip_act = {
651         .id             = A_NET_EIP,
652         .options        = AO_NULL,
653         .magic          = ACTIVITY_MAGIC_BASE + 1,
654         .group          = G_SNMP,
655 #ifdef SOURCE_SADC
656         .f_count_index  = -1,
657         .f_count2       = NULL,
658         .f_read         = wrap_read_net_eip,
659 #endif
660 #ifdef SOURCE_SAR
661         .f_print        = print_net_eip_stats,
662         .f_print_avg    = print_net_eip_stats,
663 #endif
664 #ifdef SOURCE_SADF
665         .f_render       = render_net_eip_stats,
666         .f_xml_print    = xml_print_net_eip_stats,
667         .f_json_print   = json_print_net_eip_stats,
668         .f_svg_print    = svg_print_net_eip_stats,
669         .hdr_line       = "ihdrerr/s;iadrerr/s;iukwnpr/s;idisc/s;odisc/s;onort/s;asmf/s;fragf/s",
670         .name           = "A_NET_EIP",
671         .g_nr           = 3,
672 #endif
673         .nr             = 1,
674         .nr2            = 1,
675         .nr_max         = 1,
676         .fsize          = STATS_NET_EIP_SIZE,
677         .msize          = STATS_NET_EIP_SIZE,
678         .opt_flags      = 0,
679         .buf            = {NULL, NULL, NULL},
680         .bitmap         = NULL
681 };
682
683 /* ICMP network traffic activity */
684 struct activity net_icmp_act = {
685         .id             = A_NET_ICMP,
686         .options        = AO_NULL,
687         .magic          = ACTIVITY_MAGIC_BASE,
688         .group          = G_SNMP,
689 #ifdef SOURCE_SADC
690         .f_count_index  = -1,
691         .f_count2       = NULL,
692         .f_read         = wrap_read_net_icmp,
693 #endif
694 #ifdef SOURCE_SAR
695         .f_print        = print_net_icmp_stats,
696         .f_print_avg    = print_net_icmp_stats,
697 #endif
698 #ifdef SOURCE_SADF
699         .f_render       = render_net_icmp_stats,
700         .f_xml_print    = xml_print_net_icmp_stats,
701         .f_json_print   = json_print_net_icmp_stats,
702         .f_svg_print    = svg_print_net_icmp_stats,
703         .hdr_line       = "imsg/s;omsg/s;iech/s;iechr/s;oech/s;oechr/s;itm/s;itmr/s;otm/s;"
704                           "otmr/s;iadrmk/s;iadrmkr/s;oadrmk/s;oadrmkr/s",
705         .name           = "A_NET_ICMP",
706         .g_nr           = 4,
707 #endif
708         .nr             = 1,
709         .nr2            = 1,
710         .nr_max         = 1,
711         .fsize          = STATS_NET_ICMP_SIZE,
712         .msize          = STATS_NET_ICMP_SIZE,
713         .opt_flags      = 0,
714         .buf            = {NULL, NULL, NULL},
715         .bitmap         = NULL
716 };
717
718 /* ICMP network traffic (errors) activity */
719 struct activity net_eicmp_act = {
720         .id             = A_NET_EICMP,
721         .options        = AO_NULL,
722         .magic          = ACTIVITY_MAGIC_BASE,
723         .group          = G_SNMP,
724 #ifdef SOURCE_SADC
725         .f_count_index  = -1,
726         .f_count2       = NULL,
727         .f_read         = wrap_read_net_eicmp,
728 #endif
729 #ifdef SOURCE_SAR
730         .f_print        = print_net_eicmp_stats,
731         .f_print_avg    = print_net_eicmp_stats,
732 #endif
733 #ifdef SOURCE_SADF
734         .f_render       = render_net_eicmp_stats,
735         .f_xml_print    = xml_print_net_eicmp_stats,
736         .f_json_print   = json_print_net_eicmp_stats,
737         .f_svg_print    = svg_print_net_eicmp_stats,
738         .hdr_line       = "ierr/s;oerr/s;idstunr/s;odstunr/s;itmex/s;otmex/s;"
739                           "iparmpb/s;oparmpb/s;isrcq/s;osrcq/s;iredir/s;oredir/s",
740         .name           = "A_NET_EICMP",
741         .g_nr           = 6,
742 #endif
743         .nr             = 1,
744         .nr2            = 1,
745         .nr_max         = 1,
746         .fsize          = STATS_NET_EICMP_SIZE,
747         .msize          = STATS_NET_EICMP_SIZE,
748         .opt_flags      = 0,
749         .buf            = {NULL, NULL, NULL},
750         .bitmap         = NULL
751 };
752
753 /* TCP network traffic activity */
754 struct activity net_tcp_act = {
755         .id             = A_NET_TCP,
756         .options        = AO_NULL,
757         .magic          = ACTIVITY_MAGIC_BASE,
758         .group          = G_SNMP,
759 #ifdef SOURCE_SADC
760         .f_count_index  = -1,
761         .f_count2       = NULL,
762         .f_read         = wrap_read_net_tcp,
763 #endif
764 #ifdef SOURCE_SAR
765         .f_print        = print_net_tcp_stats,
766         .f_print_avg    = print_net_tcp_stats,
767 #endif
768 #ifdef SOURCE_SADF
769         .f_render       = render_net_tcp_stats,
770         .f_xml_print    = xml_print_net_tcp_stats,
771         .f_json_print   = json_print_net_tcp_stats,
772         .f_svg_print    = svg_print_net_tcp_stats,
773         .hdr_line       = "active/s;passive/s;iseg/s;oseg/s",
774         .name           = "A_NET_TCP",
775         .g_nr           = 2,
776 #endif
777         .nr             = 1,
778         .nr2            = 1,
779         .nr_max         = 1,
780         .fsize          = STATS_NET_TCP_SIZE,
781         .msize          = STATS_NET_TCP_SIZE,
782         .opt_flags      = 0,
783         .buf            = {NULL, NULL, NULL},
784         .bitmap         = NULL
785 };
786
787 /* TCP network traffic (errors) activity */
788 struct activity net_etcp_act = {
789         .id             = A_NET_ETCP,
790         .options        = AO_NULL,
791         .magic          = ACTIVITY_MAGIC_BASE,
792         .group          = G_SNMP,
793 #ifdef SOURCE_SADC
794         .f_count_index  = -1,
795         .f_count2       = NULL,
796         .f_read         = wrap_read_net_etcp,
797 #endif
798 #ifdef SOURCE_SAR
799         .f_print        = print_net_etcp_stats,
800         .f_print_avg    = print_net_etcp_stats,
801 #endif
802 #ifdef SOURCE_SADF
803         .f_render       = render_net_etcp_stats,
804         .f_xml_print    = xml_print_net_etcp_stats,
805         .f_json_print   = json_print_net_etcp_stats,
806         .f_svg_print    = svg_print_net_etcp_stats,
807         .hdr_line       = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s",
808         .name           = "A_NET_ETCP",
809         .g_nr           = 2,
810 #endif
811         .nr             = 1,
812         .nr2            = 1,
813         .nr_max         = 1,
814         .fsize          = STATS_NET_ETCP_SIZE,
815         .msize          = STATS_NET_ETCP_SIZE,
816         .opt_flags      = 0,
817         .buf            = {NULL, NULL, NULL},
818         .bitmap         = NULL
819 };
820
821 /* UDP network traffic activity */
822 struct activity net_udp_act = {
823         .id             = A_NET_UDP,
824         .options        = AO_NULL,
825         .magic          = ACTIVITY_MAGIC_BASE,
826         .group          = G_SNMP,
827 #ifdef SOURCE_SADC
828         .f_count_index  = -1,
829         .f_count2       = NULL,
830         .f_read         = wrap_read_net_udp,
831 #endif
832 #ifdef SOURCE_SAR
833         .f_print        = print_net_udp_stats,
834         .f_print_avg    = print_net_udp_stats,
835 #endif
836 #ifdef SOURCE_SADF
837         .f_render       = render_net_udp_stats,
838         .f_xml_print    = xml_print_net_udp_stats,
839         .f_json_print   = json_print_net_udp_stats,
840         .f_svg_print    = svg_print_net_udp_stats,
841         .hdr_line       = "idgm/s;odgm/s;noport/s;idgmerr/s",
842         .name           = "A_NET_UDP",
843         .g_nr           = 2,
844 #endif
845         .nr             = 1,
846         .nr2            = 1,
847         .nr_max         = 1,
848         .fsize          = STATS_NET_UDP_SIZE,
849         .msize          = STATS_NET_UDP_SIZE,
850         .opt_flags      = 0,
851         .buf            = {NULL, NULL, NULL},
852         .bitmap         = NULL
853 };
854
855 /* IPv6 sockets activity */
856 struct activity net_sock6_act = {
857         .id             = A_NET_SOCK6,
858         .options        = AO_NULL,
859         .magic          = ACTIVITY_MAGIC_BASE,
860         .group          = G_IPV6,
861 #ifdef SOURCE_SADC
862         .f_count_index  = -1,
863         .f_count2       = NULL,
864         .f_read         = wrap_read_net_sock6,
865 #endif
866 #ifdef SOURCE_SAR
867         .f_print        = print_net_sock6_stats,
868         .f_print_avg    = print_avg_net_sock6_stats,
869 #endif
870 #ifdef SOURCE_SADF
871         .f_render       = render_net_sock6_stats,
872         .f_xml_print    = xml_print_net_sock6_stats,
873         .f_json_print   = json_print_net_sock6_stats,
874         .f_svg_print    = svg_print_net_sock6_stats,
875         .hdr_line       = "tcp6sck;udp6sck;raw6sck;ip6-frag",
876         .name           = "A_NET_SOCK6",
877         .g_nr           = 1,
878 #endif
879         .nr             = 1,
880         .nr2            = 1,
881         .nr_max         = 1,
882         .fsize          = STATS_NET_SOCK6_SIZE,
883         .msize          = STATS_NET_SOCK6_SIZE,
884         .opt_flags      = 0,
885         .buf            = {NULL, NULL, NULL},
886         .bitmap         = NULL
887 };
888
889 /* IPv6 network traffic activity */
890 struct activity net_ip6_act = {
891         .id             = A_NET_IP6,
892         .options        = AO_NULL,
893         .magic          = ACTIVITY_MAGIC_BASE + 1,
894         .group          = G_IPV6,
895 #ifdef SOURCE_SADC
896         .f_count_index  = -1,
897         .f_count2       = NULL,
898         .f_read         = wrap_read_net_ip6,
899 #endif
900 #ifdef SOURCE_SAR
901         .f_print        = print_net_ip6_stats,
902         .f_print_avg    = print_net_ip6_stats,
903 #endif
904 #ifdef SOURCE_SADF
905         .f_render       = render_net_ip6_stats,
906         .f_xml_print    = xml_print_net_ip6_stats,
907         .f_json_print   = json_print_net_ip6_stats,
908         .f_svg_print    = svg_print_net_ip6_stats,
909         .hdr_line       = "irec6/s;fwddgm6/s;idel6/s;orq6/s;asmrq6/s;asmok6/s;"
910                           "imcpck6/s;omcpck6/s;fragok6/s;fragcr6/s",
911         .name           = "A_NET_IP6",
912         .g_nr           = 4,
913 #endif
914         .nr             = 1,
915         .nr2            = 1,
916         .nr_max         = 1,
917         .fsize          = STATS_NET_IP6_SIZE,
918         .msize          = STATS_NET_IP6_SIZE,
919         .opt_flags      = 0,
920         .buf            = {NULL, NULL, NULL},
921         .bitmap         = NULL
922 };
923
924 /* IPv6 network traffic (errors) activity */
925 struct activity net_eip6_act = {
926         .id             = A_NET_EIP6,
927         .options        = AO_NULL,
928         .magic          = ACTIVITY_MAGIC_BASE + 1,
929         .group          = G_IPV6,
930 #ifdef SOURCE_SADC
931         .f_count_index  = -1,
932         .f_count2       = NULL,
933         .f_read         = wrap_read_net_eip6,
934 #endif
935 #ifdef SOURCE_SAR
936         .f_print        = print_net_eip6_stats,
937         .f_print_avg    = print_net_eip6_stats,
938 #endif
939 #ifdef SOURCE_SADF
940         .f_render       = render_net_eip6_stats,
941         .f_xml_print    = xml_print_net_eip6_stats,
942         .f_json_print   = json_print_net_eip6_stats,
943         .f_svg_print    = svg_print_net_eip6_stats,
944         .hdr_line       = "ihdrer6/s;iadrer6/s;iukwnp6/s;i2big6/s;idisc6/s;odisc6/s;"
945                           "inort6/s;onort6/s;asmf6/s;fragf6/s;itrpck6/s",
946         .name           = "A_NET_EIP6",
947         .g_nr           = 4,
948 #endif
949         .nr             = 1,
950         .nr2            = 1,
951         .nr_max         = 1,
952         .fsize          = STATS_NET_EIP6_SIZE,
953         .msize          = STATS_NET_EIP6_SIZE,
954         .opt_flags      = 0,
955         .buf            = {NULL, NULL, NULL},
956         .bitmap         = NULL
957 };
958
959 /* ICMPv6 network traffic activity */
960 struct activity net_icmp6_act = {
961         .id             = A_NET_ICMP6,
962         .options        = AO_NULL,
963         .magic          = ACTIVITY_MAGIC_BASE,
964         .group          = G_IPV6,
965 #ifdef SOURCE_SADC
966         .f_count_index  = -1,
967         .f_count2       = NULL,
968         .f_read         = wrap_read_net_icmp6,
969 #endif
970 #ifdef SOURCE_SAR
971         .f_print        = print_net_icmp6_stats,
972         .f_print_avg    = print_net_icmp6_stats,
973 #endif
974 #ifdef SOURCE_SADF
975         .f_render       = render_net_icmp6_stats,
976         .f_xml_print    = xml_print_net_icmp6_stats,
977         .f_json_print   = json_print_net_icmp6_stats,
978         .f_svg_print    = svg_print_net_icmp6_stats,
979         .hdr_line       = "imsg6/s;omsg6/s;iech6/s;iechr6/s;oechr6/s;igmbq6/s;igmbr6/s;ogmbr6/s;"
980                           "igmbrd6/s;ogmbrd6/s;irtsol6/s;ortsol6/s;irtad6/s;inbsol6/s;onbsol6/s;"
981                           "inbad6/s;onbad6/s",
982         .name           = "A_NET_ICMP6",
983         .g_nr           = 5,
984 #endif
985         .nr             = 1,
986         .nr2            = 1,
987         .nr_max         = 1,
988         .fsize          = STATS_NET_ICMP6_SIZE,
989         .msize          = STATS_NET_ICMP6_SIZE,
990         .opt_flags      = 0,
991         .buf            = {NULL, NULL, NULL},
992         .bitmap         = NULL
993 };
994
995 /* ICMPv6 network traffic (errors) activity */
996 struct activity net_eicmp6_act = {
997         .id             = A_NET_EICMP6,
998         .options        = AO_NULL,
999         .magic          = ACTIVITY_MAGIC_BASE,
1000         .group          = G_IPV6,
1001 #ifdef SOURCE_SADC
1002         .f_count_index  = -1,
1003         .f_count2       = NULL,
1004         .f_read         = wrap_read_net_eicmp6,
1005 #endif
1006 #ifdef SOURCE_SAR
1007         .f_print        = print_net_eicmp6_stats,
1008         .f_print_avg    = print_net_eicmp6_stats,
1009 #endif
1010 #ifdef SOURCE_SADF
1011         .f_render       = render_net_eicmp6_stats,
1012         .f_xml_print    = xml_print_net_eicmp6_stats,
1013         .f_json_print   = json_print_net_eicmp6_stats,
1014         .f_svg_print    = svg_print_net_eicmp6_stats,
1015         .hdr_line       = "ierr6/s;idtunr6/s;odtunr6/s;itmex6/s;otmex6/s;"
1016                           "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s",
1017         .name           = "A_NET_EICMP6",
1018         .g_nr           = 6,
1019 #endif
1020         .nr             = 1,
1021         .nr2            = 1,
1022         .nr_max         = 1,
1023         .fsize          = STATS_NET_EICMP6_SIZE,
1024         .msize          = STATS_NET_EICMP6_SIZE,
1025         .opt_flags      = 0,
1026         .buf            = {NULL, NULL, NULL},
1027         .bitmap         = NULL
1028 };
1029
1030 /* UDPv6 network traffic activity */
1031 struct activity net_udp6_act = {
1032         .id             = A_NET_UDP6,
1033         .options        = AO_NULL,
1034         .magic          = ACTIVITY_MAGIC_BASE,
1035         .group          = G_IPV6,
1036 #ifdef SOURCE_SADC
1037         .f_count_index  = -1,
1038         .f_count2       = NULL,
1039         .f_read         = wrap_read_net_udp6,
1040 #endif
1041 #ifdef SOURCE_SAR
1042         .f_print        = print_net_udp6_stats,
1043         .f_print_avg    = print_net_udp6_stats,
1044 #endif
1045 #ifdef SOURCE_SADF
1046         .f_render       = render_net_udp6_stats,
1047         .f_xml_print    = xml_print_net_udp6_stats,
1048         .f_json_print   = json_print_net_udp6_stats,
1049         .f_svg_print    = svg_print_net_udp6_stats,
1050         .hdr_line       = "idgm6/s;odgm6/s;noport6/s;idgmer6/s",
1051         .name           = "A_NET_UDP6",
1052         .g_nr           = 2,
1053 #endif
1054         .nr             = 1,
1055         .nr2            = 1,
1056         .nr_max         = 1,
1057         .fsize          = STATS_NET_UDP6_SIZE,
1058         .msize          = STATS_NET_UDP6_SIZE,
1059         .opt_flags      = 0,
1060         .buf            = {NULL, NULL, NULL},
1061         .bitmap         = NULL
1062 };
1063
1064 /* CPU frequency */
1065 struct activity pwr_cpufreq_act = {
1066         .id             = A_PWR_CPUFREQ,
1067         .options        = AO_VOLATILE + AO_GRAPH_PER_ITEM,
1068         .magic          = ACTIVITY_MAGIC_BASE,
1069         .group          = G_POWER,
1070 #ifdef SOURCE_SADC
1071         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1072         .f_count2       = NULL,
1073         .f_read         = wrap_read_cpuinfo,
1074 #endif
1075 #ifdef SOURCE_SAR
1076         .f_print        = print_pwr_cpufreq_stats,
1077         .f_print_avg    = print_avg_pwr_cpufreq_stats,
1078 #endif
1079 #ifdef SOURCE_SADF
1080         .f_render       = render_pwr_cpufreq_stats,
1081         .f_xml_print    = xml_print_pwr_cpufreq_stats,
1082         .f_json_print   = json_print_pwr_cpufreq_stats,
1083         .f_svg_print    = svg_print_pwr_cpufreq_stats,
1084         .hdr_line       = "CPU;MHz",
1085         .name           = "A_PWR_CPUFREQ",
1086         .g_nr           = 1,
1087 #endif
1088         .nr             = -1,
1089         .nr2            = 1,
1090         .nr_max         = NR_CPUS + 1,
1091         .fsize          = STATS_PWR_CPUFREQ_SIZE,
1092         .msize          = STATS_PWR_CPUFREQ_SIZE,
1093         .opt_flags      = 0,
1094         .buf            = {NULL, NULL, NULL},
1095         .bitmap         = &cpu_bitmap
1096 };
1097
1098 /* Fan */
1099 struct activity pwr_fan_act = {
1100         .id             = A_PWR_FAN,
1101         .options        = AO_GRAPH_PER_ITEM,
1102         .magic          = ACTIVITY_MAGIC_BASE,
1103         .group          = G_POWER,
1104 #ifdef SOURCE_SADC
1105         .f_count_index  = 5,    /* wrap_get_fan_nr() */
1106         .f_count2       = NULL,
1107         .f_read         = wrap_read_fan,
1108 #endif
1109 #ifdef SOURCE_SAR
1110         .f_print        = print_pwr_fan_stats,
1111         .f_print_avg    = print_avg_pwr_fan_stats,
1112 #endif
1113 #ifdef SOURCE_SADF
1114         .f_render       = render_pwr_fan_stats,
1115         .f_xml_print    = xml_print_pwr_fan_stats,
1116         .f_json_print   = json_print_pwr_fan_stats,
1117         .f_svg_print    = svg_print_pwr_fan_stats,
1118         .hdr_line       = "FAN;DEVICE;rpm;drpm",
1119         .name           = "A_PWR_FAN",
1120         .g_nr           = 1,
1121 #endif
1122         .nr             = -1,
1123         .nr2            = 1,
1124         .nr_max         = MAX_NR_FANS,
1125         .fsize          = STATS_PWR_FAN_SIZE,
1126         .msize          = STATS_PWR_FAN_SIZE,
1127         .opt_flags      = 0,
1128         .buf            = {NULL, NULL, NULL},
1129         .bitmap         = NULL
1130 };
1131
1132 /* Temperature */
1133 struct activity pwr_temp_act = {
1134         .id             = A_PWR_TEMP,
1135         .options        = AO_GRAPH_PER_ITEM,
1136         .magic          = ACTIVITY_MAGIC_BASE,
1137         .group          = G_POWER,
1138 #ifdef SOURCE_SADC
1139         .f_count_index  = 6,    /* wrap_get_temp_nr() */
1140         .f_count2       = NULL,
1141         .f_read         = wrap_read_temp,
1142 #endif
1143 #ifdef SOURCE_SAR
1144         .f_print        = print_pwr_temp_stats,
1145         .f_print_avg    = print_avg_pwr_temp_stats,
1146 #endif
1147 #ifdef SOURCE_SADF
1148         .f_render       = render_pwr_temp_stats,
1149         .f_xml_print    = xml_print_pwr_temp_stats,
1150         .f_json_print   = json_print_pwr_temp_stats,
1151         .f_svg_print    = svg_print_pwr_temp_stats,
1152         .hdr_line       = "TEMP;DEVICE;degC;%temp",
1153         .name           = "A_PWR_TEMP",
1154         .g_nr           = 2,
1155 #endif
1156         .nr             = -1,
1157         .nr2            = 1,
1158         .nr_max         = MAX_NR_TEMP_SENSORS,
1159         .fsize          = STATS_PWR_TEMP_SIZE,
1160         .msize          = STATS_PWR_TEMP_SIZE,
1161         .opt_flags      = 0,
1162         .buf            = {NULL, NULL, NULL},
1163         .bitmap         = NULL
1164 };
1165
1166 /* Voltage inputs */
1167 struct activity pwr_in_act = {
1168         .id             = A_PWR_IN,
1169         .options        = AO_GRAPH_PER_ITEM,
1170         .magic          = ACTIVITY_MAGIC_BASE,
1171         .group          = G_POWER,
1172 #ifdef SOURCE_SADC
1173         .f_count_index  = 7,    /* wrap_get_in_nr() */
1174         .f_count2       = NULL,
1175         .f_read         = wrap_read_in,
1176 #endif
1177 #ifdef SOURCE_SAR
1178         .f_print        = print_pwr_in_stats,
1179         .f_print_avg    = print_avg_pwr_in_stats,
1180 #endif
1181 #ifdef SOURCE_SADF
1182         .f_render       = render_pwr_in_stats,
1183         .f_xml_print    = xml_print_pwr_in_stats,
1184         .f_json_print   = json_print_pwr_in_stats,
1185         .f_svg_print    = svg_print_pwr_in_stats,
1186         .hdr_line       = "IN;DEVICE;inV;%in",
1187         .name           = "A_PWR_IN",
1188         .g_nr           = 2,
1189 #endif
1190         .nr             = -1,
1191         .nr2            = 1,
1192         .nr_max         = MAX_NR_IN_SENSORS,
1193         .fsize          = STATS_PWR_IN_SIZE,
1194         .msize          = STATS_PWR_IN_SIZE,
1195         .opt_flags      = 0,
1196         .buf            = {NULL, NULL, NULL},
1197         .bitmap         = NULL
1198 };
1199
1200 /* Hugepages activity */
1201 struct activity huge_act = {
1202         .id             = A_HUGE,
1203         .options        = AO_COLLECTED,
1204         .magic          = ACTIVITY_MAGIC_BASE,
1205         .group          = G_DEFAULT,
1206 #ifdef SOURCE_SADC
1207         .f_count_index  = -1,
1208         .f_count2       = NULL,
1209         .f_read         = wrap_read_meminfo_huge,
1210 #endif
1211 #ifdef SOURCE_SAR
1212         .f_print        = print_huge_stats,
1213         .f_print_avg    = print_avg_huge_stats,
1214 #endif
1215 #ifdef SOURCE_SADF
1216         .f_render       = render_huge_stats,
1217         .f_xml_print    = xml_print_huge_stats,
1218         .f_json_print   = json_print_huge_stats,
1219         .f_svg_print    = svg_print_huge_stats,
1220         .hdr_line       = "kbhugfree;kbhugused;%hugused",
1221         .name           = "A_HUGE",
1222         .g_nr           = 2,
1223 #endif
1224         .nr             = 1,
1225         .nr2            = 1,
1226         .nr_max         = 1,
1227         .fsize          = STATS_HUGE_SIZE,
1228         .msize          = STATS_HUGE_SIZE,
1229         .opt_flags      = 0,
1230         .buf            = {NULL, NULL, NULL},
1231         .bitmap         = NULL
1232 };
1233
1234 /* CPU weighted frequency */
1235 struct activity pwr_wghfreq_act = {
1236         .id             = A_PWR_WGHFREQ,
1237         .options        = AO_VOLATILE,
1238         .magic          = ACTIVITY_MAGIC_BASE,
1239         .group          = G_POWER,
1240 #ifdef SOURCE_SADC
1241         .f_count_index  = 0,    /* wrap_get_cpu_nr() */
1242         .f_count2       = wrap_get_freq_nr,
1243         .f_read         = wrap_read_time_in_state,
1244 #endif
1245 #ifdef SOURCE_SAR
1246         .f_print        = print_pwr_wghfreq_stats,
1247         .f_print_avg    = print_pwr_wghfreq_stats,
1248 #endif
1249 #ifdef SOURCE_SADF
1250         .f_render       = render_pwr_wghfreq_stats,
1251         .f_xml_print    = xml_print_pwr_wghfreq_stats,
1252         .f_json_print   = json_print_pwr_wghfreq_stats,
1253         .hdr_line       = "CPU;wghMHz",
1254         .name           = "A_PWR_WGHFREQ",
1255         .g_nr           = 0,
1256 #endif
1257         .nr             = -1,
1258         .nr2            = -1,
1259         .nr_max         = NR_CPUS + 1,
1260         .fsize          = STATS_PWR_WGHFREQ_SIZE,
1261         .msize          = STATS_PWR_WGHFREQ_SIZE,
1262         .opt_flags      = 0,
1263         .buf            = {NULL, NULL, NULL},
1264         .bitmap         = &cpu_bitmap
1265 };
1266
1267 /* USB devices plugged into the system */
1268 struct activity pwr_usb_act = {
1269         .id             = A_PWR_USB,
1270         .options        = AO_CLOSE_MARKUP,
1271         .magic          = ACTIVITY_MAGIC_BASE,
1272         .group          = G_POWER,
1273 #ifdef SOURCE_SADC
1274         .f_count_index  = 8,    /* wrap_get_usb_nr() */
1275         .f_count2       = NULL,
1276         .f_read         = wrap_read_bus_usb_dev,
1277 #endif
1278 #ifdef SOURCE_SAR
1279         .f_print        = print_pwr_usb_stats,
1280         .f_print_avg    = print_avg_pwr_usb_stats,
1281 #endif
1282 #ifdef SOURCE_SADF
1283         .f_render       = render_pwr_usb_stats,
1284         .f_xml_print    = xml_print_pwr_usb_stats,
1285         .f_json_print   = json_print_pwr_usb_stats,
1286         .hdr_line       = "manufact;product;BUS;idvendor;idprod;maxpower",
1287         .name           = "A_PWR_USB",
1288         .g_nr           = 0,
1289 #endif
1290         .nr             = -1,
1291         .nr2            = 1,
1292         .nr_max         = MAX_NR_USB,
1293         .fsize          = STATS_PWR_USB_SIZE,
1294         .msize          = STATS_PWR_USB_SIZE,
1295         .opt_flags      = 0,
1296         .buf            = {NULL, NULL, NULL},
1297         .bitmap         = NULL
1298 };
1299
1300 /* Filesystem usage activity */
1301 struct activity filesystem_act = {
1302         .id             = A_FILESYSTEM,
1303         .options        = AO_NULL,
1304         .magic          = ACTIVITY_MAGIC_BASE,
1305         .group          = G_XDISK,
1306 #ifdef SOURCE_SADC
1307         .f_count_index  = 9,    /* wrap_get_filesystem_nr() */
1308         .f_count2       = NULL,
1309         .f_read         = wrap_read_filesystem,
1310 #endif
1311 #ifdef SOURCE_SAR
1312         .f_print        = print_filesystem_stats,
1313         .f_print_avg    = print_avg_filesystem_stats,
1314 #endif
1315 #ifdef SOURCE_SADF
1316         .f_render       = render_filesystem_stats,
1317         .f_xml_print    = xml_print_filesystem_stats,
1318         .f_json_print   = json_print_filesystem_stats,
1319         .hdr_line       = "FILESYSTEM;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused",
1320         .name           = "A_FILESYSTEM",
1321         .g_nr           = 0,
1322 #endif
1323         .nr             = -1,
1324         .nr2            = 1,
1325         .nr_max         = MAX_NR_FS,
1326         .fsize          = STATS_FILESYSTEM_SIZE,
1327         .msize          = STATS_FILESYSTEM_SIZE,
1328         .opt_flags      = 0,
1329         .buf            = {NULL, NULL, NULL},
1330         .bitmap         = NULL
1331 };
1332
1333 /* Fibre Channel HBA usage activity */
1334 struct activity fchost_act = {
1335         .id             = A_NET_FC,
1336         .options        = AO_CLOSE_MARKUP,
1337         .magic          = ACTIVITY_MAGIC_BASE,
1338         .group          = G_DISK,
1339 #ifdef SOURCE_SADC
1340         .f_count_index  = 10,   /* wrap_get_fchost_nr() */
1341         .f_count2       = NULL,
1342         .f_read         = wrap_read_fchost,
1343 #endif
1344 #ifdef SOURCE_SAR
1345         .f_print        = print_fchost_stats,
1346         .f_print_avg    = print_fchost_stats,
1347 #endif
1348 #ifdef SOURCE_SADF
1349         .f_render       = render_fchost_stats,
1350         .f_xml_print    = xml_print_fchost_stats,
1351         .f_json_print   = json_print_fchost_stats,
1352         .hdr_line       = "FCHOST;fch_rxf/s;fch_txf/s;fch_rxw/s;fch_txw/s",
1353         .name           = "A_FCHOST",
1354         .g_nr           = 0,
1355 #endif
1356         .nr             = -1,
1357         .nr2            = 1,
1358         .nr_max         = MAX_NR_FCHOSTS,
1359         .fsize          = STATS_FCHOST_SIZE,
1360         .msize          = STATS_FCHOST_SIZE,
1361         .opt_flags      = 0,
1362         .buf            = {NULL, NULL, NULL},
1363         .bitmap         = NULL
1364 };
1365
1366 #ifdef SOURCE_SADC
1367 /*
1368  * Array of functions used to count number of items.
1369  */
1370 __nr_t (*f_count[NR_F_COUNT]) (struct activity *) = {
1371         wrap_get_cpu_nr,
1372         wrap_get_irq_nr,
1373         wrap_get_serial_nr,
1374         wrap_get_disk_nr,
1375         wrap_get_iface_nr,
1376         wrap_get_fan_nr,
1377         wrap_get_temp_nr,
1378         wrap_get_in_nr,
1379         wrap_get_usb_nr,
1380         wrap_get_filesystem_nr,
1381         wrap_get_fchost_nr
1382 };
1383 #endif
1384
1385 /*
1386  * Array of activities.
1387  * (Order of activities doesn't matter for daily data files).
1388  */
1389 struct activity *act[NR_ACT] = {
1390         &cpu_act,
1391         &pcsw_act,
1392         &irq_act,
1393         &swap_act,
1394         &paging_act,
1395         &io_act,
1396         &memory_act,
1397         &huge_act,
1398         &ktables_act,
1399         &queue_act,
1400         &serial_act,
1401         &disk_act,
1402         /* <network> */
1403         &net_dev_act,
1404         &net_edev_act,
1405         &net_nfs_act,
1406         &net_nfsd_act,
1407         &net_sock_act,
1408         &net_ip_act,
1409         &net_eip_act,
1410         &net_icmp_act,
1411         &net_eicmp_act,
1412         &net_tcp_act,
1413         &net_etcp_act,
1414         &net_udp_act,
1415         &net_sock6_act,
1416         &net_ip6_act,
1417         &net_eip6_act,
1418         &net_icmp6_act,
1419         &net_eicmp6_act,
1420         &net_udp6_act,
1421         &fchost_act,            /* AO_CLOSE_MARKUP */
1422         /* </network> */
1423         /* <power-management> */
1424         &pwr_cpufreq_act,
1425         &pwr_fan_act,
1426         &pwr_temp_act,
1427         &pwr_in_act,
1428         &pwr_wghfreq_act,
1429         &pwr_usb_act,           /* AO_CLOSE_MARKUP */
1430         /* </power-management> */
1431         &filesystem_act
1432 };