summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2017-08-31 12:40:29 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-09-13 09:49:13 -0300
commit4ed962eb38c8a33b8b6ded911410afaefa1ca48c (patch)
tree020efdbb4e22d19fa2b5b271a0e3f4ea9a312f10
parentbba49af87393ebc8960bf8abdcbb9af53bf1aba1 (diff)
perf stat: Print generic metric header even for failed expressions
Print the generic metric header even when the expression evaluation failed. Otherwise an expression that fails on the first collections due to division by zero may suddenly reappear later without an header. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20170831194036.30146-5-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/stat-shadow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 96aa6cbf24d6..8c7ab29169b9 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -662,7 +662,9 @@ static void generic_metric(const char *metric_expr,
out->force_header ? name : "",
ratio);
else
- print_metric(ctxp, NULL, NULL, "", 0);
+ print_metric(ctxp, NULL, NULL,
+ out->force_header ?
+ (metric_name ? metric_name : name) : "", 0);
} else
print_metric(ctxp, NULL, NULL, "", 0);
}