From ee112d819eb480bb0b708def934f40c7ca6b3533 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 16 Sep 2017 16:30:46 +0200 Subject: [PATCH] sa.h: Add new gtypes_nr field in activity structure This field describes the corresponding structure containing statistics (as defined in rd_stats.h or rd_sensors.h): Number of fields of type "long long", number of fields of type "long", number of fields of type "int". This field will be used for various purposes, e.g., big/little endian conversion. Signed-off-by: Sebastien GODARD --- activity.c | 39 +++++++++++++++++++++++++++++++++++++++ sa.h | 9 +++++++++ 2 files changed, 48 insertions(+) diff --git a/activity.c b/activity.c index dc28642..751de4d 100644 --- a/activity.c +++ b/activity.c @@ -88,6 +88,7 @@ struct activity cpu_act = { .hdr_line = "CPU;%user;%nice;%system;%iowait;%steal;%idle|" "CPU;%usr;%nice;%sys;%iowait;%steal;%irq;%soft;%guest;%gnice;%idle", #endif + .gtypes_nr = {10, 0, 0}, #ifdef SOURCE_SADF .f_render = render_cpu_stats, .f_xml_print = xml_print_cpu_stats, @@ -125,6 +126,7 @@ struct activity pcsw_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "proc/s;cswch/s", #endif + .gtypes_nr = {1, 1, 0}, #ifdef SOURCE_SADF .f_render = render_pcsw_stats, .f_xml_print = xml_print_pcsw_stats, @@ -162,6 +164,7 @@ struct activity irq_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "INTR;intr/s", #endif + .gtypes_nr = {1, 0, 0}, #ifdef SOURCE_SADF .f_render = render_irq_stats, .f_xml_print = xml_print_irq_stats, @@ -199,6 +202,7 @@ struct activity swap_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "pswpin/s;pswpout/s", #endif + .gtypes_nr = {0, 2, 0}, #ifdef SOURCE_SADF .f_render = render_swap_stats, .f_xml_print = xml_print_swap_stats, @@ -237,6 +241,7 @@ struct activity paging_act = { .hdr_line = "pgpgin/s;pgpgout/s;fault/s;majflt/s;" "pgfree/s;pgscank/s;pgscand/s;pgsteal/s;%vmeff", #endif + .gtypes_nr = {0, 8, 0}, #ifdef SOURCE_SADF .f_render = render_paging_stats, .f_xml_print = xml_print_paging_stats, @@ -274,6 +279,7 @@ struct activity io_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "tps;rtps;wtps;bread/s;bwrtn/s", #endif + .gtypes_nr = {5, 0, 0}, #ifdef SOURCE_SADF .f_render = render_io_stats, .f_xml_print = xml_print_io_stats, @@ -312,6 +318,7 @@ struct activity memory_act = { .hdr_line = "kbmemfree;kbavail;kbmemused;%memused;kbbuffers;kbcached;kbcommit;%commit;kbactive;kbinact;kbdirty&kbanonpg;kbslab;kbkstack;kbpgtbl;kbvmused|" "kbswpfree;kbswpused;%swpused;kbswpcad;%swpcad", #endif + .gtypes_nr = {0, 17, 0}, #ifdef SOURCE_SADF .f_render = render_memory_stats, .f_xml_print = xml_print_memory_stats, @@ -349,6 +356,7 @@ struct activity ktables_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "dentunusd;file-nr;inode-nr;pty-nr", #endif + .gtypes_nr = {0, 0, 4}, #ifdef SOURCE_SADF .f_render = render_ktables_stats, .f_xml_print = xml_print_ktables_stats, @@ -386,6 +394,7 @@ struct activity queue_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15;blocked", #endif + .gtypes_nr = {0, 2, 4}, #ifdef SOURCE_SADF .f_render = render_queue_stats, .f_xml_print = xml_print_queue_stats, @@ -423,6 +432,7 @@ struct activity serial_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "TTY;rcvin/s;txmtin/s;framerr/s;prtyerr/s;brk/s;ovrun/s", #endif + .gtypes_nr = {0, 0, 7}, #ifdef SOURCE_SADF .f_render = render_serial_stats, .f_xml_print = xml_print_serial_stats, @@ -460,6 +470,7 @@ struct activity disk_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "DEV;tps;rkB/s;wkB/s;areq-sz;aqu-sz;await;svctm;%util", #endif + .gtypes_nr = {1, 2, 6}, #ifdef SOURCE_SADF .f_render = render_disk_stats, .f_xml_print = xml_print_disk_stats, @@ -497,6 +508,7 @@ struct activity net_dev_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "IFACE;rxpck/s;txpck/s;rxkB/s;txkB/s;rxcmp/s;txcmp/s;rxmcst/s;%ifutil", #endif + .gtypes_nr = {7, 0, 1}, #ifdef SOURCE_SADF .f_render = render_net_dev_stats, .f_xml_print = xml_print_net_dev_stats, @@ -535,6 +547,7 @@ struct activity net_edev_act = { .hdr_line = "IFACE;rxerr/s;txerr/s;coll/s;rxdrop/s;txdrop/s;" "txcarr/s;rxfram/s;rxfifo/s;txfifo/s", #endif + .gtypes_nr = {9, 0, 0}, #ifdef SOURCE_SADF .f_render = render_net_edev_stats, .f_xml_print = xml_print_net_edev_stats, @@ -572,6 +585,7 @@ struct activity net_nfs_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "call/s;retrans/s;read/s;write/s;access/s;getatt/s", #endif + .gtypes_nr = {0, 0, 6}, #ifdef SOURCE_SADF .f_render = render_net_nfs_stats, .f_xml_print = xml_print_net_nfs_stats, @@ -610,6 +624,7 @@ struct activity net_nfsd_act = { .hdr_line = "scall/s;badcall/s;packet/s;udp/s;tcp/s;hit/s;miss/s;" "sread/s;swrite/s;saccess/s;sgetatt/s", #endif + .gtypes_nr = {0, 0, 11}, #ifdef SOURCE_SADF .f_render = render_net_nfsd_stats, .f_xml_print = xml_print_net_nfsd_stats, @@ -647,6 +662,7 @@ struct activity net_sock_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "totsck;tcpsck;udpsck;rawsck;ip-frag;tcp-tw", #endif + .gtypes_nr = {0, 0, 6}, #ifdef SOURCE_SADF .f_render = render_net_sock_stats, .f_xml_print = xml_print_net_sock_stats, @@ -684,6 +700,7 @@ struct activity net_ip_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "irec/s;fwddgm/s;idel/s;orq/s;asmrq/s;asmok/s;fragok/s;fragcrt/s", #endif + .gtypes_nr = {8, 0, 0}, #ifdef SOURCE_SADF .f_render = render_net_ip_stats, .f_xml_print = xml_print_net_ip_stats, @@ -721,6 +738,7 @@ struct activity net_eip_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "ihdrerr/s;iadrerr/s;iukwnpr/s;idisc/s;odisc/s;onort/s;asmf/s;fragf/s", #endif + .gtypes_nr = {8, 0, 0}, #ifdef SOURCE_SADF .f_render = render_net_eip_stats, .f_xml_print = xml_print_net_eip_stats, @@ -759,6 +777,7 @@ struct activity net_icmp_act = { .hdr_line = "imsg/s;omsg/s;iech/s;iechr/s;oech/s;oechr/s;itm/s;itmr/s;otm/s;" "otmr/s;iadrmk/s;iadrmkr/s;oadrmk/s;oadrmkr/s", #endif + .gtypes_nr = {0, 14, 0}, #ifdef SOURCE_SADF .f_render = render_net_icmp_stats, .f_xml_print = xml_print_net_icmp_stats, @@ -797,6 +816,7 @@ struct activity net_eicmp_act = { .hdr_line = "ierr/s;oerr/s;idstunr/s;odstunr/s;itmex/s;otmex/s;" "iparmpb/s;oparmpb/s;isrcq/s;osrcq/s;iredir/s;oredir/s", #endif + .gtypes_nr = {0, 12, 0}, #ifdef SOURCE_SADF .f_render = render_net_eicmp_stats, .f_xml_print = xml_print_net_eicmp_stats, @@ -834,6 +854,7 @@ struct activity net_tcp_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "active/s;passive/s;iseg/s;oseg/s", #endif + .gtypes_nr = {0, 4, 0}, #ifdef SOURCE_SADF .f_render = render_net_tcp_stats, .f_xml_print = xml_print_net_tcp_stats, @@ -871,6 +892,7 @@ struct activity net_etcp_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s", #endif + .gtypes_nr = {0, 5, 0}, #ifdef SOURCE_SADF .f_render = render_net_etcp_stats, .f_xml_print = xml_print_net_etcp_stats, @@ -908,6 +930,7 @@ struct activity net_udp_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "idgm/s;odgm/s;noport/s;idgmerr/s", #endif + .gtypes_nr = {0, 4, 0}, #ifdef SOURCE_SADF .f_render = render_net_udp_stats, .f_xml_print = xml_print_net_udp_stats, @@ -945,6 +968,7 @@ struct activity net_sock6_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "tcp6sck;udp6sck;raw6sck;ip6-frag", #endif + .gtypes_nr = {0, 0, 4}, #ifdef SOURCE_SADF .f_render = render_net_sock6_stats, .f_xml_print = xml_print_net_sock6_stats, @@ -983,6 +1007,7 @@ struct activity net_ip6_act = { .hdr_line = "irec6/s;fwddgm6/s;idel6/s;orq6/s;asmrq6/s;asmok6/s;" "imcpck6/s;omcpck6/s;fragok6/s;fragcr6/s", #endif + .gtypes_nr = {10, 0, 0}, #ifdef SOURCE_SADF .f_render = render_net_ip6_stats, .f_xml_print = xml_print_net_ip6_stats, @@ -1021,6 +1046,7 @@ struct activity net_eip6_act = { .hdr_line = "ihdrer6/s;iadrer6/s;iukwnp6/s;i2big6/s;idisc6/s;odisc6/s;" "inort6/s;onort6/s;asmf6/s;fragf6/s;itrpck6/s", #endif + .gtypes_nr = {11, 0, 0}, #ifdef SOURCE_SADF .f_render = render_net_eip6_stats, .f_xml_print = xml_print_net_eip6_stats, @@ -1060,6 +1086,7 @@ struct activity net_icmp6_act = { "igmbrd6/s;ogmbrd6/s;irtsol6/s;ortsol6/s;irtad6/s;inbsol6/s;onbsol6/s;" "inbad6/s;onbad6/s", #endif + .gtypes_nr = {0, 17, 0}, #ifdef SOURCE_SADF .f_render = render_net_icmp6_stats, .f_xml_print = xml_print_net_icmp6_stats, @@ -1098,6 +1125,7 @@ struct activity net_eicmp6_act = { .hdr_line = "ierr6/s;idtunr6/s;odtunr6/s;itmex6/s;otmex6/s;" "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s", #endif + .gtypes_nr = {0, 11, 0}, #ifdef SOURCE_SADF .f_render = render_net_eicmp6_stats, .f_xml_print = xml_print_net_eicmp6_stats, @@ -1135,6 +1163,7 @@ struct activity net_udp6_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "idgm6/s;odgm6/s;noport6/s;idgmer6/s", #endif + .gtypes_nr = {0, 4, 0}, #ifdef SOURCE_SADF .f_render = render_net_udp6_stats, .f_xml_print = xml_print_net_udp6_stats, @@ -1172,6 +1201,7 @@ struct activity pwr_cpufreq_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "CPU;MHz", #endif + .gtypes_nr = {0, 1, 0}, #ifdef SOURCE_SADF .f_render = render_pwr_cpufreq_stats, .f_xml_print = xml_print_pwr_cpufreq_stats, @@ -1209,6 +1239,7 @@ struct activity pwr_fan_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "FAN;DEVICE;rpm;drpm", #endif + .gtypes_nr = {2, 0, 0}, #ifdef SOURCE_SADF .f_render = render_pwr_fan_stats, .f_xml_print = xml_print_pwr_fan_stats, @@ -1246,6 +1277,7 @@ struct activity pwr_temp_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "TEMP;DEVICE;degC;%temp", #endif + .gtypes_nr = {3, 0, 0}, #ifdef SOURCE_SADF .f_render = render_pwr_temp_stats, .f_xml_print = xml_print_pwr_temp_stats, @@ -1283,6 +1315,7 @@ struct activity pwr_in_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "IN;DEVICE;inV;%in", #endif + .gtypes_nr = {3, 0, 0}, #ifdef SOURCE_SADF .f_render = render_pwr_in_stats, .f_xml_print = xml_print_pwr_in_stats, @@ -1320,6 +1353,7 @@ struct activity huge_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "kbhugfree;kbhugused;%hugused", #endif + .gtypes_nr = {0, 2, 0}, #ifdef SOURCE_SADF .f_render = render_huge_stats, .f_xml_print = xml_print_huge_stats, @@ -1357,6 +1391,7 @@ struct activity pwr_wghfreq_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "CPU;wghMHz", #endif + .gtypes_nr = {1, 1, 0}, #ifdef SOURCE_SADF .f_render = render_pwr_wghfreq_stats, .f_xml_print = xml_print_pwr_wghfreq_stats, @@ -1394,6 +1429,7 @@ struct activity pwr_usb_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "manufact;product;BUS;idvendor;idprod;maxpower", #endif + .gtypes_nr = {0, 0, 4}, #ifdef SOURCE_SADF .f_render = render_pwr_usb_stats, .f_xml_print = xml_print_pwr_usb_stats, @@ -1432,6 +1468,7 @@ struct activity filesystem_act = { .hdr_line = "FILESYSTEM;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused|" "MOUNTPOINT;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused", #endif + .gtypes_nr = {5, 0, 0}, #ifdef SOURCE_SADF .f_render = render_filesystem_stats, .f_xml_print = xml_print_filesystem_stats, @@ -1469,6 +1506,7 @@ struct activity fchost_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "FCHOST;fch_rxf/s;fch_txf/s;fch_rxw/s;fch_txw/s", #endif + .gtypes_nr = {0, 4, 0}, #ifdef SOURCE_SADF .f_render = render_fchost_stats, .f_xml_print = xml_print_fchost_stats, @@ -1506,6 +1544,7 @@ struct activity softnet_act = { #if defined(SOURCE_SAR) || defined(SOURCE_SADF) .hdr_line = "CPU;total/s;dropd/s;squeezd/s;rx_rps/s;flw_lim/s", #endif + .gtypes_nr = {0, 0, 5}, #ifdef SOURCE_SADF .f_render = render_softnet_stats, .f_xml_print = xml_print_softnet_stats, diff --git a/sa.h b/sa.h index 44136da..f83314c 100644 --- a/sa.h +++ b/sa.h @@ -723,6 +723,15 @@ struct activity { * Name of activity. */ char *name; + /* + * Description of the corresponding structure containing statistics (as defined + * in rd_stats.h or rd_sensors.h). Such a structure has 0+ fields of type + * "long long", followed by 0+ fields of type "long", followed by 0+ fields of + * type "int", followed by 0+ other fields (e.g. of type char). The array below + * gives the number of "long long" fields composing the structure, then the number + * of "long" fields, then the number of "int" fields. + */ + int gtypes_nr[3]; /* * Number of SVG graphs for this activity. The total number of graphs for * the activity can be greater though if flag AO_GRAPH_PER_ITEM is set, in -- 2.40.0