// SPDX-License-Identifier: GPL-2.0 #include #include #include "pmus.h" #include "pmu.h" LIST_HEAD(pmus); const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str) { struct perf_pmu *pmu = NULL; while ((pmu = perf_pmu__scan(pmu)) != NULL) { if (!strcmp(pmu->name, str)) return pmu; /* Ignore "uncore_" prefix. */ if (!strncmp(pmu->name, "uncore_", 7)) { if (!strcmp(pmu->name + 7, str)) return pmu; } /* Ignore "cpu_" prefix on Intel hybrid PMUs. */ if (!strncmp(pmu->name, "cpu_", 4)) { if (!strcmp(pmu->name + 4, str)) return pmu; } } return NULL; }