linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf stat: Reset aggr stats for each run
@ 2023-06-16  7:32 Namhyung Kim
  2023-06-16  7:32 ` [PATCH 2/2] perf stat: Show average value on multiple runs Namhyung Kim
  2023-06-17 18:45 ` [PATCH 1/2] perf stat: Reset aggr stats for each run Jiri Olsa
  0 siblings, 2 replies; 6+ messages in thread
From: Namhyung Kim @ 2023-06-16  7:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Kan Liang, Andi Kleen

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: 91f85f98da7a ("perf stat: Display event stats using aggr counts")
Reported-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-stat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c87c6897edc9..e549862f90f0 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -725,6 +725,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;
 
-- 
2.41.0.162.gfafddb0af9-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-19 20:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16  7:32 [PATCH 1/2] perf stat: Reset aggr stats for each run Namhyung Kim
2023-06-16  7:32 ` [PATCH 2/2] perf stat: Show average value on multiple runs Namhyung Kim
2023-06-17 18:45   ` Jiri Olsa
2023-06-19 20:00     ` Namhyung Kim
2023-06-17 18:45 ` [PATCH 1/2] perf stat: Reset aggr stats for each run Jiri Olsa
2023-06-19 19:53   ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).