summaryrefslogtreecommitdiff
path: root/tools/perf/util/pmu.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-09-24 23:23:23 -0700
committerNamhyung Kim <namhyung@kernel.org>2023-09-29 22:50:42 -0700
commitb1f05622fef39dded385f9e360e859846c1ddaf1 (patch)
treeb56a5033daaca05810721527d02ebb88043ded33 /tools/perf/util/pmu.h
parentee33a0ef8468063b34eed4330b0023c1a8d62f8f (diff)
downloadlwn-b1f05622fef39dded385f9e360e859846c1ddaf1.tar.gz
lwn-b1f05622fef39dded385f9e360e859846c1ddaf1.zip
perf pmus: Make PMU alias name loading lazy
PMU alias names were computed when the first perf_pmu is created, scanning all PMUs in event sources for a file called alias that generally doesn't exist. Switch to trying to load the file when all PMU related files are loaded in lookup. This would cause a PMU name lookup of an alias name to fail if no PMUs were loaded, so in that case all PMUs are loaded and the find repeated. The overhead is similar but in the (very) general case not all PMUs are scanned for the alias file. As the overhead occurs once per invocation it doesn't show in perf bench internals pmu-scan. On a tigerlake machine, the number of openat system calls for an event of cpu/cycles/ with perf stat reduces from 94 to 69 (ie 25 fewer openat calls). Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: James Clark <james.clark@arm.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Kan Liang <kan.liang@linux.intel.com> Link: https://lore.kernel.org/r/20230925062323.840799-1-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/pmu.h')
-rw-r--r--tools/perf/util/pmu.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index a682c6bc0fce..85190d058852 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -252,8 +252,6 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu);
int perf_pmu__match(const char *pattern, const char *name, const char *tok);
-const char *pmu_find_real_name(const char *name);
-const char *pmu_find_alias_name(const char *name);
double perf_pmu__cpu_slots_per_cycle(void);
int perf_pmu__event_source_devices_scnprintf(char *pathname, size_t size);
int perf_pmu__pathname_scnprintf(char *buf, size_t size,