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