Skip to content

Commit

Permalink
perf stat: Handle partially bad results with merging
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen authored and Arnaldo Carvalho de Melo committed Mar 21, 2017
1 parent 430daf2 commit b4229e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b4229e9

Please sign in to comment.