]> granicus.if.org Git - sysstat/commitdiff
SVG: Add new option: "showidle"
authorSebastien GODARD <sysstat@users.noreply.github.com>
Tue, 15 Nov 2016 14:44:07 +0000 (15:44 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Tue, 15 Nov 2016 14:44:07 +0000 (15:44 +0100)
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 <sysstat@users.noreply.github.com>
sa.h
sadf.c
svg_stats.c

diff --git a/sa.h b/sa.h
index 591cf856b059ce33fee79fb296f0959bb3821e83..d542869e343e23f990966f0322b423e4d15dae23 100644 (file)
--- a/sa.h
+++ b/sa.h
 #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)
 #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
 
 #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 4b05a8b17301ca6c3a442e4b4666143b852d89e9..655ac66a1abc89d60fc2e25f1be87e2ab253b4dc 100644 (file)
--- 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]);
                                }
index a3f0f73a3cf9ebc3a8a3f30f36c2721e04dd93ad..15ec995c5e4b892d0230ac78cd114be82a887ac8 100644 (file)
@@ -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? */