linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf jevents: return potentially empty metrics table
@ 2024-05-31 19:44 Lucas Stach
  2024-07-01 17:19 ` Lucas Stach
  0 siblings, 1 reply; 7+ messages in thread
From: Lucas Stach @ 2024-05-31 19:44 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Ian Rogers
  Cc: Jiri Olsa, Mark Rutland, Alexander Shishkin, Kan Liang,
	linux-perf-users, kernel, patchwork-lst

Don't return NULL when a empty (num_pmus = 0) metrics table is encountered,
as this causes many of the users to bail out, which will skip matching any
potentially existing sys metrics later on. Instead return the empty table
which will be handled properly by the iterators and allows matching to
continue.

This fixes metrics reporting on systems where only the sys, but not the
core PMUs have metrics defined.

Fixes: f20c15d13f01 ("perf pmu-events: Remember the perf_events_map for a PMU")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 tools/perf/pmu-events/jevents.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
index e42efc16723e..0a1ed9ee1429 100755
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -1081,7 +1081,7 @@ const struct pmu_metrics_table *perf_pmu__find_metrics_table(struct perf_pmu *pm
         if (!map)
                 return NULL;
 
-        if (!pmu)
+        if (!pmu || !map->metric_table.num_pmus)
                 return &map->metric_table;
 
         for (size_t i = 0; i < map->metric_table.num_pmus; i++) {
-- 
2.39.2


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

end of thread, other threads:[~2024-07-15 21:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 19:44 [PATCH] perf jevents: return potentially empty metrics table Lucas Stach
2024-07-01 17:19 ` Lucas Stach
2024-07-03 22:33   ` Namhyung Kim
2024-07-12 21:54     ` Ian Rogers
2024-07-15 15:12       ` James Clark
2024-07-15 15:54         ` Lucas Stach
2024-07-15 21:43           ` Ian Rogers

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