diff options
author | Ian Rogers <irogers@google.com> | 2023-04-06 16:52:55 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-06 21:54:01 -0300 |
commit | 240e6fd0a923933493192e71f191d9326ba53f0b (patch) | |
tree | 58814bdb16abbee2f7756c4325f2657aeb3a7bc4 /tools/perf/util/pmu.h | |
parent | 330f40a0d951d7f23995ccbfeea9be7282942e93 (diff) |
perf pmu: Improve name/comments, avoid a memory allocation
Improve documentation around perf_pmu_alias pmu_name and on
functions.
Reduce the scope of pmu_uncore_alias_match to just file.
Rename perf_pmu__valid_suffix to the more revealing
perf_pmu__match_ignoring_suffix.
Add a short-cut to perf_pmu__match_ignoring_suffix for PMU names that
don't also have a socket value, and can therefore avoid a memory
allocation.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230406235256.2768773-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/pmu.h')
-rw-r--r-- | tools/perf/util/pmu.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index d53618c65c92..b9a02dedd473 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -35,7 +35,7 @@ struct perf_pmu_caps { }; /** - * struct perf_pmu - hi + * struct perf_pmu */ struct perf_pmu { /** @name: The name of the PMU such as "cpu". */ @@ -186,7 +186,10 @@ struct perf_pmu_alias { * default. */ bool deprecated; - /** @pmu_name: The name copied from struct perf_pmu. */ + /** + * @pmu_name: The name copied from the json struct pmu_event. This can + * differ from the PMU name as it won't have suffixes. + */ char *pmu_name; }; @@ -238,7 +241,6 @@ void pmu_add_cpu_aliases_table(struct list_head *head, struct perf_pmu *pmu, char *perf_pmu__getcpuid(struct perf_pmu *pmu); const struct pmu_events_table *pmu_events_table__find(void); const struct pmu_metrics_table *pmu_metrics_table__find(void); -bool pmu_uncore_alias_match(const char *pmu_name, const char *name); void perf_pmu_free_alias(struct perf_pmu_alias *alias); int perf_pmu__convert_scale(const char *scale, char **end, double *sval); |