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