From: Sebastien GODARD Date: Tue, 15 Nov 2016 14:44:07 +0000 (+0100) Subject: SVG: Add new option: "showidle" X-Git-Tag: v11.5.3~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69f1f981cb701062efc690443bd631d7cc8af18f;p=sysstat SVG: Add new option: "showidle" Add a new option ("showidle", which can be selected with sadf's switch -O) that tells sadf to also display idle values in CPU SVG graphs. Eg.: sadf -g -O showidle -P ALL /var/log/sa/saDD -- -u ALL > graph.svg Signed-off-by: Sebastien GODARD --- diff --git a/sa.h b/sa.h index 591cf85..d542869 100644 --- a/sa.h +++ b/sa.h @@ -101,6 +101,7 @@ #define S_F_SVG_SKIP 0x00010000 #define S_F_SVG_AUTOSCALE 0x00020000 #define S_F_SVG_ONE_DAY 0x00040000 +#define S_F_SVG_SHOW_IDLE 0x00080000 #define WANT_SINCE_BOOT(m) (((m) & S_F_SINCE_BOOT) == S_F_SINCE_BOOT) #define WANT_SA_ROTAT(m) (((m) & S_F_SA_ROTAT) == S_F_SA_ROTAT) @@ -121,6 +122,7 @@ #define SKIP_EMPTY_VIEWS(m) (((m) & S_F_SVG_SKIP) == S_F_SVG_SKIP) #define AUTOSCALE_ON(m) (((m) & S_F_SVG_AUTOSCALE) == S_F_SVG_AUTOSCALE) #define DISPLAY_ONE_DAY(m) (((m) & S_F_SVG_ONE_DAY) == S_F_SVG_ONE_DAY) +#define DISPLAY_IDLE(m) (((m) & S_F_SVG_SHOW_IDLE) == S_F_SVG_SHOW_IDLE) #define AO_F_NULL 0x00000000 @@ -201,6 +203,7 @@ #define K_SKIP_EMPTY "skipempty" #define K_AUTOSCALE "autoscale" #define K_ONEDAY "oneday" +#define K_SHOWIDLE "showidle" /* Groups of activities */ #define G_DEFAULT 0x00 diff --git a/sadf.c b/sadf.c index 4b05a8b..655ac66 100644 --- a/sadf.c +++ b/sadf.c @@ -1490,6 +1490,9 @@ int main(int argc, char **argv) else if (!strcmp(t, K_ONEDAY)) { flags |= S_F_SVG_ONE_DAY; } + else if (!strcmp(t, K_SHOWIDLE)) { + flags |= S_F_SVG_SHOW_IDLE; + } else { usage(argv[0]); } diff --git a/svg_stats.c b/svg_stats.c index a3f0f73..15ec995 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -1184,6 +1184,12 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st } if (action & F_END) { + if (DISPLAY_IDLE(flags)) { + /* Include additional %idle field */ + group1[0]++; + group2[0]++; + } + for (i = 0; (i < a->nr) && (i < a->bitmap->b_size + 1); i++) { /* Should current CPU (including CPU "all") be displayed? */