]> granicus.if.org Git - sysstat/commitdiff
SVG: A_PWR_CPU activity: Fix for offline CPU
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 7 Feb 2018 15:40:27 +0000 (16:40 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 7 Feb 2018 15:40:27 +0000 (16:40 +0100)
Offline CPU should be ignored only when graphs are drawn and if they
have been offline on the whole period.
When graphs are created, offline CPU are useful: Their frequency value
(0) is used to make the graph go through 0.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
svg_stats.c

index e2867af0ef573350e0c7bc55b375d888362f4d3e..53262f73ae7e81c3af31d4580a701dd80ebe8a94 100644 (file)
@@ -4188,15 +4188,16 @@ __print_funct_t svg_print_pwr_cpufreq_stats(struct activity *a, int curr, int ac
                        spc = (struct stats_pwr_cpufreq *) ((char *) a->buf[curr]  + i * a->msize);
                        spp = (struct stats_pwr_cpufreq *) ((char *) a->buf[!curr] + i * a->msize);
 
-                       if (!spc->cpufreq)
-                               /* This CPU is offline: Don't display it */
-                               continue;
-
                        /* Should current CPU (including CPU "all") be displayed? */
                        if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
                                /* No */
                                continue;
 
+                       /*
+                        * Note: Don't skip offline CPU here as it is needed
+                        * to make the graph go though 0.
+                        */
+
                        /* MHz */
                        recappend(record_hdr->ust_time - svg_p->ust_time_ref,
                                  ((double) spp->cpufreq) / 100,
@@ -4219,6 +4220,14 @@ __print_funct_t svg_print_pwr_cpufreq_stats(struct activity *a, int curr, int ac
                                strcpy(item_name, "all");
                        }
                        else {
+                               /*
+                                * If the maximum frequency reached by the CPU is 0, then
+                                * the CPU has been offline on the whole period.
+                                * => Don't display it.
+                                */
+                               if (*(spmax + i) == 0)
+                                       continue;
+
                                sprintf(item_name, "%d", i - 1);
                        }