perf stat: Print generic metric header even for failed expressions
authorAndi Kleen <ak@linux.intel.com>
Thu, 31 Aug 2017 19:40:29 +0000 (12:40 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 13 Sep 2017 12:49:13 +0000 (09:49 -0300)
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>
tools/perf/util/stat-shadow.c

index 96aa6cb..8c7ab29 100644 (file)
@@ -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);
 }