Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf stat: Fix uniquify for hybrid systems
@ 2025-02-28 19:53 Thomas Falcon
  2025-03-01  0:09 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Falcon @ 2025-02-28 19:53 UTC (permalink / raw)
  To: linux-perf-users
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, linux-kernel, Thomas Falcon

Currently, perf stat is omitting the pmu name for legacy events
on hybrid systems. git bisect indicated commit 357b965deba9 as the cause:

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[357b965deba9fb71467413e473764ec4e1694d8d] perf stat: Changes to event
name uniquification

Include an additional check for hybrid architectures when determining
whether to uniquify legacy events.

Before:

$ sudo ./perf stat -e cycles -a sleep 1

 Performance counter stats for 'system wide':

       173,903,751      cycles
       666,423,950      cycles

       1.006615048 seconds time elapsed

After:

$ sudo ./perf stat -e cycles -a sleep 1

 Performance counter stats for 'system wide':

       841,496,603      cpu_atom/cycles/
     3,308,929,412      cpu_core/cycles/

       1.002483283 seconds time elapsed

Fixes: 357b965deba9 ("perf stat: Changes to event name uniquification")
Signed-off-by: Thomas Falcon <thomas.falcon@intel.com>
---
 tools/perf/util/stat-display.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index e65c7e9f15d1..df9f68080ec9 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -1676,6 +1676,7 @@ static bool evlist__disable_uniquify(const struct evlist *evlist)
 
 static void evsel__set_needs_uniquify(struct evsel *counter, const struct perf_stat_config *config)
 {
+	bool hybrid = (!config->hybrid_merge && evsel__is_hybrid(counter));
 	struct evsel *evsel;
 
 	if (counter->merged_stat) {
@@ -1688,7 +1689,8 @@ static void evsel__set_needs_uniquify(struct evsel *counter, const struct perf_s
 		return;
 	}
 
-	if  (counter->core.attr.type < PERF_TYPE_MAX && counter->core.attr.type != PERF_TYPE_RAW) {
+	if (!hybrid && counter->core.attr.type < PERF_TYPE_MAX &&
+		counter->core.attr.type != PERF_TYPE_RAW) {
 		/* Legacy event, don't uniquify. */
 		return;
 	}
@@ -1705,7 +1707,7 @@ static void evsel__set_needs_uniquify(struct evsel *counter, const struct perf_s
 		return;
 	}
 
-	if (!config->hybrid_merge && evsel__is_hybrid(counter)) {
+	if (hybrid) {
 		/* Unique hybrid counters necessary. */
 		counter->needs_uniquify = true;
 		return;
-- 
2.48.1


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

end of thread, other threads:[~2025-03-03 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 19:53 [PATCH] perf stat: Fix uniquify for hybrid systems Thomas Falcon
2025-03-01  0:09 ` Namhyung Kim
2025-03-03 17:14   ` Falcon, Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox