Skip to content

Commit

Permalink
perf stat: Print generic metric header even for failed expressions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen authored and Arnaldo Carvalho de Melo committed Sep 13, 2017
1 parent bba49af commit 4ed962e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/util/stat-shadow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4ed962e

Please sign in to comment.