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