]> git.hungrycats.org Git - linux/commitdiff
perf stat: Reset aggr stats for each run
authorNamhyung Kim <namhyung@kernel.org>
Fri, 16 Jun 2023 07:32:10 +0000 (00:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:48 +0000 (19:39 +0200)
[ Upstream commit ed4090a22c123b9b33368741253edddc6ff8d18f ]

When it runs multiple times with -r option, it missed to reset the
aggregation counters and the values were added up.  The aggregation
count has the values to be printed in the end.  It should reset the
counters at the beginning of each run.  But the current code does that
only when -I/--interval-print option is given.

Fixes: 91f85f98da7ab8c3 ("perf stat: Display event stats using aggr counts")
Reported-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230616073211.1057936-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/builtin-stat.c

index eeba93ae3b584750a42c6aeb4761b43428deeaf7..f5a6d08cf07f6cbca43187518b1d58cb5a6ec026 100644 (file)
@@ -777,6 +777,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
                        all_counters_use_bpf = false;
        }
 
+       evlist__reset_aggr_stats(evsel_list);
+
        evlist__for_each_cpu(evlist_cpu_itr, evsel_list, affinity) {
                counter = evlist_cpu_itr.evsel;