Skip to content

Commit a6fb36d

Browse files
committed
perf parse-events filter: Use evsel__find_pmu
JIRA: https://issues.redhat.com/browse/RHEL-78200 upstream ======== commit 8b99e2f Author: Ian Rogers <irogers@google.com> Date: Wed Jun 4 10:45:35 2025 -0700 description =========== Rather than manually scanning PMUs, use evsel__find_pmu that can use the PMU set during event parsing. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250604174545.2853620-2-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
1 parent 14c3cf9 commit a6fb36d

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tools/perf/util/parse-events.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,9 +2559,8 @@ foreach_evsel_in_last_glob(struct evlist *evlist,
25592559
static int set_filter(struct evsel *evsel, const void *arg)
25602560
{
25612561
const char *str = arg;
2562-
bool found = false;
25632562
int nr_addr_filters = 0;
2564-
struct perf_pmu *pmu = NULL;
2563+
struct perf_pmu *pmu;
25652564

25662565
if (evsel == NULL) {
25672566
fprintf(stderr,
@@ -2579,16 +2578,11 @@ static int set_filter(struct evsel *evsel, const void *arg)
25792578
return 0;
25802579
}
25812580

2582-
while ((pmu = perf_pmus__scan(pmu)) != NULL)
2583-
if (pmu->type == evsel->core.attr.type) {
2584-
found = true;
2585-
break;
2586-
}
2587-
2588-
if (found)
2581+
pmu = evsel__find_pmu(evsel);
2582+
if (pmu) {
25892583
perf_pmu__scan_file(pmu, "nr_addr_filters",
25902584
"%d", &nr_addr_filters);
2591-
2585+
}
25922586
if (!nr_addr_filters)
25932587
return perf_bpf_filter__parse(&evsel->bpf_filters, str);
25942588

0 commit comments

Comments
 (0)