From: Sebastien GODARD Date: Wed, 7 Feb 2018 15:40:27 +0000 (+0100) Subject: SVG: A_PWR_CPU activity: Fix for offline CPU X-Git-Tag: v11.7.2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8c7cc4e4dc9730d6234d3fb7273da78e7e7c678;p=sysstat SVG: A_PWR_CPU activity: Fix for offline CPU 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 --- diff --git a/svg_stats.c b/svg_stats.c index e2867af..53262f7 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -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); }