perf pmus: Allow just core PMU scanning
Scanning all PMUs is expensive as all PMUs sysfs entries are loaded, benchmarking shows more than 4x the cost: ``` $ perf bench internals pmu-scan -i 1000 Computing performance of sysfs PMU event scan for 1000 times Average core PMU scanning took: 989.231 usec (+- 1.535 usec) Average PMU scanning took: 4309.425 usec (+- 74.322 usec) ``` Add new perf_pmus__scan_core routine that scans just core PMUs. Replace perf_pmus__scan calls with perf_pmus__scan_core when non-core PMUs are being ignored. Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ali Saidi <alisaidi@amazon.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Dmitrii Dolgov <9erthalion6@gmail.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kang Minchul <tegongkang@gmail.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Ming Wang <wangming01@loongson.cn> 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: Sandipan Das <sandipan.das@amd.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20230527072210.2900565-30-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
15c57a8037
commit
9d6a1df9b2
|
@ -11,10 +11,7 @@ static struct perf_pmu *pmu__find_core_pmu(void)
|
||||||
{
|
{
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu))) {
|
while ((pmu = perf_pmus__scan_core(pmu))) {
|
||||||
if (!is_pmu_core(pmu->name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The cpumap should cover all CPUs. Otherwise, some CPUs may
|
* The cpumap should cover all CPUs. Otherwise, some CPUs may
|
||||||
* not support some events or have different event IDs.
|
* not support some events or have different event IDs.
|
||||||
|
|
|
@ -33,13 +33,10 @@ static int ___evlist__add_default_attrs(struct evlist *evlist,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
struct perf_cpu_map *cpus;
|
struct perf_cpu_map *cpus;
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
evsel = evsel__new(attrs + i);
|
evsel = evsel__new(attrs + i);
|
||||||
if (evsel == NULL)
|
if (evsel == NULL)
|
||||||
goto out_delete_partial_list;
|
goto out_delete_partial_list;
|
||||||
|
|
|
@ -300,11 +300,9 @@ uint64_t arch__intr_reg_mask(void)
|
||||||
* The same register set is supported among different hybrid PMUs.
|
* The same register set is supported among different hybrid PMUs.
|
||||||
* Only check the first available one.
|
* Only check the first available one.
|
||||||
*/
|
*/
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (pmu->is_core) {
|
type = pmu->type;
|
||||||
type = pmu->type;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
attr.config |= type << PERF_PMU_TYPE_SHIFT;
|
attr.config |= type << PERF_PMU_TYPE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ struct pmu_scan_result {
|
||||||
int nr_aliases;
|
int nr_aliases;
|
||||||
int nr_formats;
|
int nr_formats;
|
||||||
int nr_caps;
|
int nr_caps;
|
||||||
|
bool is_core;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
|
@ -53,6 +54,7 @@ static int save_result(void)
|
||||||
r = results + nr_pmus;
|
r = results + nr_pmus;
|
||||||
|
|
||||||
r->name = strdup(pmu->name);
|
r->name = strdup(pmu->name);
|
||||||
|
r->is_core = pmu->is_core;
|
||||||
r->nr_caps = pmu->nr_caps;
|
r->nr_caps = pmu->nr_caps;
|
||||||
|
|
||||||
r->nr_aliases = 0;
|
r->nr_aliases = 0;
|
||||||
|
@ -72,7 +74,7 @@ static int save_result(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_result(void)
|
static int check_result(bool core_only)
|
||||||
{
|
{
|
||||||
struct pmu_scan_result *r;
|
struct pmu_scan_result *r;
|
||||||
struct perf_pmu *pmu;
|
struct perf_pmu *pmu;
|
||||||
|
@ -81,6 +83,9 @@ static int check_result(void)
|
||||||
|
|
||||||
for (int i = 0; i < nr_pmus; i++) {
|
for (int i = 0; i < nr_pmus; i++) {
|
||||||
r = &results[i];
|
r = &results[i];
|
||||||
|
if (core_only && !r->is_core)
|
||||||
|
continue;
|
||||||
|
|
||||||
pmu = perf_pmus__find(r->name);
|
pmu = perf_pmus__find(r->name);
|
||||||
if (pmu == NULL) {
|
if (pmu == NULL) {
|
||||||
pr_err("Cannot find PMU %s\n", r->name);
|
pr_err("Cannot find PMU %s\n", r->name);
|
||||||
|
@ -130,7 +135,6 @@ static int run_pmu_scan(void)
|
||||||
struct timeval start, end, diff;
|
struct timeval start, end, diff;
|
||||||
double time_average, time_stddev;
|
double time_average, time_stddev;
|
||||||
u64 runtime_us;
|
u64 runtime_us;
|
||||||
unsigned int i;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
init_stats(&stats);
|
init_stats(&stats);
|
||||||
|
@ -142,26 +146,30 @@ static int run_pmu_scan(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < iterations; i++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
gettimeofday(&start, NULL);
|
bool core_only = (j == 0);
|
||||||
perf_pmus__scan(NULL);
|
|
||||||
gettimeofday(&end, NULL);
|
|
||||||
|
|
||||||
timersub(&end, &start, &diff);
|
for (unsigned int i = 0; i < iterations; i++) {
|
||||||
runtime_us = diff.tv_sec * USEC_PER_SEC + diff.tv_usec;
|
gettimeofday(&start, NULL);
|
||||||
update_stats(&stats, runtime_us);
|
if (core_only)
|
||||||
|
perf_pmus__scan_core(NULL);
|
||||||
|
else
|
||||||
|
perf_pmus__scan(NULL);
|
||||||
|
gettimeofday(&end, NULL);
|
||||||
|
timersub(&end, &start, &diff);
|
||||||
|
runtime_us = diff.tv_sec * USEC_PER_SEC + diff.tv_usec;
|
||||||
|
update_stats(&stats, runtime_us);
|
||||||
|
|
||||||
ret = check_result();
|
ret = check_result(core_only);
|
||||||
perf_pmus__destroy();
|
perf_pmus__destroy();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
time_average = avg_stats(&stats);
|
||||||
|
time_stddev = stddev_stats(&stats);
|
||||||
|
pr_info(" Average%s PMU scanning took: %.3f usec (+- %.3f usec)\n",
|
||||||
|
core_only ? " core" : "", time_average, time_stddev);
|
||||||
}
|
}
|
||||||
|
|
||||||
time_average = avg_stats(&stats);
|
|
||||||
time_stddev = stddev_stats(&stats);
|
|
||||||
pr_info(" Average PMU scanning took: %.3f usec (+- %.3f usec)\n",
|
|
||||||
time_average, time_stddev);
|
|
||||||
|
|
||||||
delete_result();
|
delete_result();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -709,12 +709,9 @@ static int test__aliases(struct test_suite *test __maybe_unused,
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (!is_pmu_core(pmu->name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (list_empty(&pmu->format)) {
|
if (list_empty(&pmu->format)) {
|
||||||
pr_debug2("skipping testing core PMU %s\n", pmu->name);
|
pr_debug2("skipping testing core PMU %s\n", pmu->name);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -477,10 +477,9 @@ struct hybrid_topology *hybrid_topology__new(void)
|
||||||
if (!perf_pmus__has_hybrid())
|
if (!perf_pmus__has_hybrid())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL)
|
||||||
if (pmu->is_core)
|
nr++;
|
||||||
nr++;
|
|
||||||
}
|
|
||||||
if (nr == 0)
|
if (nr == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -489,10 +488,7 @@ struct hybrid_topology *hybrid_topology__new(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tp->nr = nr;
|
tp->nr = nr;
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (load_hybrid_node(&tp->nodes[i], pmu)) {
|
if (load_hybrid_node(&tp->nodes[i], pmu)) {
|
||||||
hybrid_topology__delete(tp);
|
hybrid_topology__delete(tp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1607,10 +1607,7 @@ static int write_pmu_caps(struct feat_fd *ff,
|
||||||
*/
|
*/
|
||||||
if (perf_pmus__has_hybrid()) {
|
if (perf_pmus__has_hybrid()) {
|
||||||
pmu = NULL;
|
pmu = NULL;
|
||||||
while ((pmu = perf_pmus__scan(pmu))) {
|
while ((pmu = perf_pmus__scan_core(pmu))) {
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ret = __write_pmu_caps(ff, pmu, true);
|
ret = __write_pmu_caps(ff, pmu, true);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -136,10 +136,7 @@ int perf_mem_events__init(void)
|
||||||
} else {
|
} else {
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
scnprintf(sysfs_name, sizeof(sysfs_name),
|
scnprintf(sysfs_name, sizeof(sysfs_name),
|
||||||
e->sysfs_name, pmu->name);
|
e->sysfs_name, pmu->name);
|
||||||
e->supported |= perf_mem_event__supported(mnt, sysfs_name);
|
e->supported |= perf_mem_event__supported(mnt, sysfs_name);
|
||||||
|
@ -176,10 +173,7 @@ static void perf_mem_events__print_unsupport_hybrid(struct perf_mem_event *e,
|
||||||
char sysfs_name[100];
|
char sysfs_name[100];
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name,
|
scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name,
|
||||||
pmu->name);
|
pmu->name);
|
||||||
if (!perf_mem_event__supported(mnt, sysfs_name)) {
|
if (!perf_mem_event__supported(mnt, sysfs_name)) {
|
||||||
|
@ -217,9 +211,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (!pmu->is_core)
|
|
||||||
continue;
|
|
||||||
rec_argv[i++] = "-e";
|
rec_argv[i++] = "-e";
|
||||||
s = perf_mem_events__name(j, pmu->name);
|
s = perf_mem_events__name(j, pmu->name);
|
||||||
if (s) {
|
if (s) {
|
||||||
|
|
|
@ -453,15 +453,12 @@ int parse_events_add_cache(struct list_head *list, int *idx, const char *name,
|
||||||
const char *config_name = get_config_name(head_config);
|
const char *config_name = get_config_name(head_config);
|
||||||
const char *metric_id = get_config_metric_id(head_config);
|
const char *metric_id = get_config_metric_id(head_config);
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
/* Legacy cache events are only supported by core PMUs. */
|
||||||
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
LIST_HEAD(config_terms);
|
LIST_HEAD(config_terms);
|
||||||
struct perf_event_attr attr;
|
struct perf_event_attr attr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Skip unsupported PMUs. */
|
|
||||||
if (!perf_pmu__supports_legacy_cache(pmu))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (parse_events__filter_pmu(parse_state, pmu))
|
if (parse_events__filter_pmu(parse_state, pmu))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1481,12 +1478,10 @@ int parse_events_add_numeric(struct parse_events_state *parse_state,
|
||||||
return __parse_events_add_numeric(parse_state, list, /*pmu=*/NULL,
|
return __parse_events_add_numeric(parse_state, list, /*pmu=*/NULL,
|
||||||
type, config, head_config);
|
type, config, head_config);
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
/* Wildcards on numeric values are only supported by core PMUs. */
|
||||||
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!perf_pmu__supports_wildcard_numeric(pmu))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (parse_events__filter_pmu(parse_state, pmu))
|
if (parse_events__filter_pmu(parse_state, pmu))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -1427,21 +1427,11 @@ bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu)
|
||||||
return pmu->is_core;
|
return pmu->is_core;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu)
|
|
||||||
{
|
|
||||||
return pmu->is_core;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu)
|
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu)
|
||||||
{
|
{
|
||||||
return !is_pmu_hybrid(pmu->name);
|
return !is_pmu_hybrid(pmu->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool perf_pmu__is_mem_pmu(const struct perf_pmu *pmu)
|
|
||||||
{
|
|
||||||
return pmu->is_core;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool perf_pmu__have_event(const struct perf_pmu *pmu, const char *name)
|
bool perf_pmu__have_event(const struct perf_pmu *pmu, const char *name)
|
||||||
{
|
{
|
||||||
struct perf_pmu_alias *alias;
|
struct perf_pmu_alias *alias;
|
||||||
|
|
|
@ -223,9 +223,7 @@ void perf_pmu__del_formats(struct list_head *formats);
|
||||||
bool is_pmu_core(const char *name);
|
bool is_pmu_core(const char *name);
|
||||||
bool is_pmu_hybrid(const char *name);
|
bool is_pmu_hybrid(const char *name);
|
||||||
bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu);
|
bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu);
|
||||||
bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu);
|
|
||||||
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu);
|
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu);
|
||||||
bool perf_pmu__is_mem_pmu(const struct perf_pmu *pmu);
|
|
||||||
bool perf_pmu__have_event(const struct perf_pmu *pmu, const char *name);
|
bool perf_pmu__have_event(const struct perf_pmu *pmu, const char *name);
|
||||||
|
|
||||||
FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name);
|
FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name);
|
||||||
|
|
|
@ -87,7 +87,7 @@ static struct perf_pmu *perf_pmu__find2(int dirfd, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add all pmus in sysfs to pmu list: */
|
/* Add all pmus in sysfs to pmu list: */
|
||||||
static void pmu_read_sysfs(void)
|
static void pmu_read_sysfs(bool core_only)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
@ -104,6 +104,8 @@ static void pmu_read_sysfs(void)
|
||||||
while ((dent = readdir(dir))) {
|
while ((dent = readdir(dir))) {
|
||||||
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
if (core_only && !is_pmu_core(dent->d_name))
|
||||||
|
continue;
|
||||||
/* add to static LIST_HEAD(core_pmus) or LIST_HEAD(other_pmus): */
|
/* add to static LIST_HEAD(core_pmus) or LIST_HEAD(other_pmus): */
|
||||||
perf_pmu__find2(fd, dent->d_name);
|
perf_pmu__find2(fd, dent->d_name);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +137,7 @@ struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu)
|
||||||
bool use_core_pmus = !pmu || pmu->is_core;
|
bool use_core_pmus = !pmu || pmu->is_core;
|
||||||
|
|
||||||
if (!pmu) {
|
if (!pmu) {
|
||||||
pmu_read_sysfs();
|
pmu_read_sysfs(/*core_only=*/false);
|
||||||
pmu = list_prepare_entry(pmu, &core_pmus, list);
|
pmu = list_prepare_entry(pmu, &core_pmus, list);
|
||||||
}
|
}
|
||||||
if (use_core_pmus) {
|
if (use_core_pmus) {
|
||||||
|
@ -150,6 +152,18 @@ struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct perf_pmu *perf_pmus__scan_core(struct perf_pmu *pmu)
|
||||||
|
{
|
||||||
|
if (!pmu) {
|
||||||
|
pmu_read_sysfs(/*core_only=*/true);
|
||||||
|
pmu = list_prepare_entry(pmu, &core_pmus, list);
|
||||||
|
}
|
||||||
|
list_for_each_entry_continue(pmu, &core_pmus, list)
|
||||||
|
return pmu;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str)
|
const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str)
|
||||||
{
|
{
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
|
@ -176,10 +190,10 @@ int perf_pmus__num_mem_pmus(void)
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
/* All core PMUs are for mem events. */
|
||||||
if (perf_pmu__is_mem_pmu(pmu))
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL)
|
||||||
count++;
|
count++;
|
||||||
}
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,8 +435,8 @@ bool perf_pmus__has_hybrid(void)
|
||||||
if (!hybrid_scanned) {
|
if (!hybrid_scanned) {
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
if (pmu->is_core && is_pmu_hybrid(pmu->name)) {
|
if (is_pmu_hybrid(pmu->name)) {
|
||||||
has_hybrid = true;
|
has_hybrid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ struct perf_pmu *perf_pmus__find(const char *name);
|
||||||
struct perf_pmu *perf_pmus__find_by_type(unsigned int type);
|
struct perf_pmu *perf_pmus__find_by_type(unsigned int type);
|
||||||
|
|
||||||
struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu);
|
struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu);
|
||||||
|
struct perf_pmu *perf_pmus__scan_core(struct perf_pmu *pmu);
|
||||||
|
|
||||||
const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str);
|
const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str);
|
||||||
|
|
||||||
|
|
|
@ -272,12 +272,11 @@ int print_hwcache_events(const struct print_callbacks *print_cb, void *print_sta
|
||||||
struct perf_pmu *pmu = NULL;
|
struct perf_pmu *pmu = NULL;
|
||||||
const char *event_type_descriptor = event_type_descriptors[PERF_TYPE_HW_CACHE];
|
const char *event_type_descriptor = event_type_descriptors[PERF_TYPE_HW_CACHE];
|
||||||
|
|
||||||
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
|
/*
|
||||||
/*
|
* Only print core PMUs, skipping uncore for performance and
|
||||||
* Skip uncore PMUs for performance. PERF_TYPE_HW_CACHE type
|
* PERF_TYPE_SOFTWARE that can succeed in opening legacy cache evenst.
|
||||||
* attributes can accept software PMUs in the extended type, so
|
*/
|
||||||
* also skip.
|
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
|
||||||
*/
|
|
||||||
if (pmu->is_uncore || pmu->type == PERF_TYPE_SOFTWARE)
|
if (pmu->is_uncore || pmu->type == PERF_TYPE_SOFTWARE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue