summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2017-03-20 23:17:01 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-03-21 22:07:00 +0300
commitb4229e9d4cac2295f8f04ec26acd571a391c6c37 (patch)
tree45eb3027e03c82927b7412163084db6d07d7d4c9 /tools
parent430daf2dc7aff16096a137347e6fd03d4af609e9 (diff)
downloadlinux-b4229e9d4cac2295f8f04ec26acd571a391c6c37.tar.xz
perf stat: Handle partially bad results with merging
When any result that is being merged is bad, mark them all bad to give consistent output in interval mode. No before/after, because the issue was only found in theoretical review and it is hard to reproduce Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20170320201711.14142-4-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a4da10a506dd..cd7dc3b648ca 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1237,6 +1237,16 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first)
if (first)
ad->nr++;
counts = perf_counts(counter->counts, cpu, 0);
+ /*
+ * When any result is bad, make them all to give
+ * consistent output in interval mode.
+ */
+ if (counts->ena == 0 || counts->run == 0 ||
+ counter->counts->scaled == -1) {
+ ad->ena = 0;
+ ad->run = 0;
+ break;
+ }
ad->val += counts->val;
ad->ena += counts->ena;
ad->run += counts->run;