提交 b4229e9d 编写于 作者: A Andi Kleen 提交者: Arnaldo Carvalho de Melo

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: NAndi Kleen <ak@linux.intel.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170320201711.14142-4-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 430daf2d
...@@ -1237,6 +1237,16 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first) ...@@ -1237,6 +1237,16 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first)
if (first) if (first)
ad->nr++; ad->nr++;
counts = perf_counts(counter->counts, cpu, 0); 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->val += counts->val;
ad->ena += counts->ena; ad->ena += counts->ena;
ad->run += counts->run; ad->run += counts->run;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册