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