blob: 79124bba713e5f0d8254c020e66df86668df656e [file] [log] [blame]
John Garrye126bef2021-04-07 18:32:47 +08001// SPDX-License-Identifier: GPL-2.0
2
Ian Rogersb96da022021-04-16 14:41:13 -07003#include "../../../util/cpumap.h"
4#include "../../../util/pmu.h"
John Garrye126bef2021-04-07 18:32:47 +08005
Ian Rogers0ec43c02021-10-15 10:21:13 -07006const struct pmu_events_map *pmu_events_map__find(void)
John Garrye126bef2021-04-07 18:32:47 +08007{
8 struct perf_pmu *pmu = NULL;
9
10 while ((pmu = perf_pmu__scan(pmu))) {
11 if (!is_pmu_core(pmu->name))
12 continue;
13
14 /*
15 * The cpumap should cover all CPUs. Otherwise, some CPUs may
16 * not support some events or have different event IDs.
17 */
Ian Rogers6d188042022-01-04 22:13:51 -080018 if (pmu->cpus->nr != cpu__max_cpu().cpu)
John Garrye126bef2021-04-07 18:32:47 +080019 return NULL;
20
21 return perf_pmu__find_map(pmu);
22 }
23
24 return NULL;
25}