diff options
| author | Ian Rogers <irogers@google.com> | 2025-10-05 21:24:22 +0300 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-10-15 17:59:11 +0300 |
| commit | 5bf6291113d2aaa559455a04ecc2c5e6396d05a0 (patch) | |
| tree | a7c87455c93b8815666e601a024965e6ed8ef7c9 | |
| parent | 468071acfc05135b9e24ed0beb535ac5c6cff945 (diff) | |
| download | linux-5bf6291113d2aaa559455a04ecc2c5e6396d05a0.tar.xz | |
perf evlist: Avoid scanning all PMUs for evlist__new_default
Rather than wildcard matching the cycles event specify only the core
PMUs. This avoids potentially loading unnecessary uncore PMUs.
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
| -rw-r--r-- | tools/perf/util/evlist.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 80d8387e6b97..e8217efdda53 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -101,16 +101,24 @@ struct evlist *evlist__new_default(void) { struct evlist *evlist = evlist__new(); bool can_profile_kernel; - int err; + struct perf_pmu *pmu = NULL; if (!evlist) return NULL; can_profile_kernel = perf_event_paranoid_check(1); - err = parse_event(evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu"); - if (err) { - evlist__delete(evlist); - return NULL; + + while ((pmu = perf_pmus__scan_core(pmu)) != NULL) { + char buf[256]; + int err; + + snprintf(buf, sizeof(buf), "%s/cycles/%s", pmu->name, + can_profile_kernel ? "P" : "Pu"); + err = parse_event(evlist, buf); + if (err) { + evlist__delete(evlist); + return NULL; + } } if (evlist->core.nr_entries > 1) { |
