Skip to contentSkip to conversation

perf stat: Fix aggreate counter reading accounting

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Feb 3, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  52bcd9947bffae88bb1758f19277d678aaebc2ec
Gitweb:     http://git.kernel.org/tip/52bcd9947bffae88bb1758f19277d678aaebc2ec
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 3 Feb 2011 17:26:06 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 3 Feb 2011 17:26:06 -0200

perf stat: Fix aggreate counter reading accounting

Introduced in: c52b12ed, when this sequence:

  count[0] = count[1] = count[2] = 0;

Was replaced with:

  aggr->val = 0;

Which is equivalent to zeroing just the first entry in the 'count' array.

Fix it by zeroing the three entries with:

  aggr->val = aggr->ena = aggr->run = 0;
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Tom Zanussi <[email protected]>

LKML-Reference: <new-submission>

---
 tools/perf/util/evsel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/evsel.c +1 -1
index f5cfed6..d8575d3 100644
@@ -90,7 +90,7 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 	int cpu, thread;
 	struct perf_counts_values *aggr = &evsel->counts->aggr, count;
 
-	aggr->val = 0;
+	aggr->val = aggr->ena = aggr->run = 0;
 
 	for (cpu = 0; cpu < ncpus; cpu++) {
 		for (thread = 0; thread < nthreads; thread++) {