linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf stat: Fix uncore aggregation number
@ 2025-06-11 23:32 Chun-Tse Shao
  2025-06-11 23:43 ` Namhyung Kim
  2025-06-12  0:16 ` Ian Rogers
  0 siblings, 2 replies; 10+ messages in thread
From: Chun-Tse Shao @ 2025-06-11 23:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chun-Tse Shao, Ian Rogers, peterz, mingo, acme, namhyung,
	mark.rutland, alexander.shishkin, jolsa, adrian.hunter, kan.liang,
	linux-perf-users

Follow up:
lore.kernel.org/CAP-5=fVDF4-qYL1Lm7efgiHk7X=_nw_nEFMBZFMcsnOOJgX4Kg@mail.gmail.com/

The patch adds unit aggregation during evsel merge the aggregated uncore
counters.

Tested on a 2-socket machine with SNC3, uncore_imc_[0-11] and
cpumask="0,120"
Before:
  perf stat -e clockticks -I 1000 --per-socket
  #           time socket cpus             counts unit events
       1.001085024 S0        1         9615386315      clockticks
       1.001085024 S1        1         9614287448      clockticks
  perf stat -e clockticks -I 1000 --per-node
  #           time node   cpus             counts unit events
       1.001029867 N0        1         3205726984      clockticks
       1.001029867 N1        1         3205444421      clockticks
       1.001029867 N2        1         3205234018      clockticks
       1.001029867 N3        1         3205224660      clockticks
       1.001029867 N4        1         3205207213      clockticks
       1.001029867 N5        1         3205528246      clockticks
After:
  perf stat -e clockticks -I 1000 --per-socket
  #           time socket cpus             counts unit events
       1.001022937 S0       12         9621463177      clockticks
       1.001022937 S1       12         9619804949      clockticks
  perf stat -e clockticks -I 1000 --per-node
  #           time node   cpus             counts unit events
       1.001029867 N0        4         3206782080      clockticks
       1.001029867 N1        4         3207025354      clockticks
       1.001029867 N2        4         3207067946      clockticks
       1.001029867 N3        4         3206871733      clockticks
       1.001029867 N4        4         3206199005      clockticks
       1.001029867 N5        4         3205525058      clockticks

Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
---
 tools/perf/util/stat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 355a7d5c8ab8..52266d773353 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -527,6 +527,7 @@ static int evsel__merge_aggr_counters(struct evsel *evsel, struct evsel *alias)
 		struct perf_counts_values *aggr_counts_b = &ps_b->aggr[i].counts;
 
 		/* NB: don't increase aggr.nr for aliases */
+		ps_a->aggr[i].nr += ps_b->aggr[i].nr;
 
 		aggr_counts_a->val += aggr_counts_b->val;
 		aggr_counts_a->ena += aggr_counts_b->ena;
-- 
2.50.0.rc1.591.g9c95f17f64-goog


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

end of thread, other threads:[~2025-06-24 22:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 23:32 [PATCH v1] perf stat: Fix uncore aggregation number Chun-Tse Shao
2025-06-11 23:43 ` Namhyung Kim
2025-06-12  0:16 ` Ian Rogers
2025-06-12  3:18   ` Chun-Tse Shao
2025-06-12  5:12     ` Ian Rogers
2025-06-12 22:55       ` Chun-Tse Shao
2025-06-20 22:12         ` Namhyung Kim
2025-06-23 18:17           ` Ian Rogers
2025-06-23 23:31             ` Namhyung Kim
2025-06-24 22:24               ` Chun-Tse Shao

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).