Skip to content

Commit 340c345

Browse files
captain5050namhyung
authored andcommitted
perf evsel: Reduce scanning core PMUs in is_hybrid
evsel__is_hybrid returns true if there are multiple core PMUs and the evsel is for a core PMU. Determining the number of core PMUs can require loading/scanning PMUs. There's no point doing the scanning if evsel for the is_hybrid test isn't core so reorder the tests to reduce PMU scanning. Signed-off-by: Ian Rogers <[email protected]> Reviewed-by: Kan Liang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 888751e commit 340c345

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/evsel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,10 +3866,10 @@ void evsel__zero_per_pkg(struct evsel *evsel)
38663866
*/
38673867
bool evsel__is_hybrid(const struct evsel *evsel)
38683868
{
3869-
if (perf_pmus__num_core_pmus() == 1)
3869+
if (!evsel->core.is_pmu_core)
38703870
return false;
38713871

3872-
return evsel->core.is_pmu_core;
3872+
return perf_pmus__num_core_pmus() > 1;
38733873
}
38743874

38753875
struct evsel *evsel__leader(const struct evsel *evsel)

0 commit comments

Comments
 (0)