diff options
author | Kan Liang <kan.liang@linux.intel.com> | 2024-01-23 10:50:36 -0800 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-01-24 14:05:22 -0800 |
commit | 821aca20be503a6ce96ebda68c09fbcb1f7c51ba (patch) | |
tree | 655bf293686f0feac2f8ea9450aba46a218597fd /tools/perf/util/mem-events.c | |
parent | 70f4b20d07df94916230b6783097358703c90113 (diff) | |
download | linux-stable-821aca20be503a6ce96ebda68c09fbcb1f7c51ba.tar.gz linux-stable-821aca20be503a6ce96ebda68c09fbcb1f7c51ba.tar.bz2 linux-stable-821aca20be503a6ce96ebda68c09fbcb1f7c51ba.zip |
perf mem: Clean up perf_pmus__num_mem_pmus()
The number of mem PMUs can be calculated by searching the
perf_pmus__scan_mem().
Remove the ARCH specific perf_pmus__num_mem_pmus()
Tested-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: ravi.bangoria@amd.com
Cc: james.clark@arm.com
Cc: will@kernel.org
Cc: mike.leach@linaro.org
Cc: renyu.zj@linux.alibaba.com
Cc: yuhaixin.yhx@linux.alibaba.com
Cc: tmricht@linux.ibm.com
Cc: atrajeev@linux.vnet.ibm.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: john.g.garry@oracle.com
Link: https://lore.kernel.org/r/20240123185036.3461837-8-kan.liang@linux.intel.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/mem-events.c')
-rw-r--r-- | tools/perf/util/mem-events.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index a20611b4fb1b..637cbd4a7bfb 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -62,6 +62,20 @@ struct perf_pmu *perf_mem_events_find_pmu(void) return perf_pmus__scan_mem(NULL); } +/** + * perf_pmu__mem_events_num_mem_pmus - Get the number of mem PMUs since the given pmu + * @pmu: Start pmu. If it's NULL, search the entire PMU list. + */ +int perf_pmu__mem_events_num_mem_pmus(struct perf_pmu *pmu) +{ + int num = 0; + + while ((pmu = perf_pmus__scan_mem(pmu)) != NULL) + num++; + + return num; +} + static const char *perf_pmu__mem_events_name(int i, struct perf_pmu *pmu) { struct perf_mem_event *e; |