[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6y1dbyF1xY1FvsB@x1>
Date: Wed, 12 Feb 2025 15:51:33 +0100
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, Hao Ge <gehao@...inos.cn>,
James Clark <james.clark@...aro.org>,
Howard Chu <howardchu95@...il.com>,
Dominique Martinet <asmadeus@...ewreck.org>,
Levi Yun <yeoreum.yun@....com>, Xu Yang <xu.yang_2@....com>,
Tengda Wu <wutengda@...weicloud.com>,
Yang Jihong <yangjihong1@...wei.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 02/10] perf parse-events filter: Use evsel__find_pmu
On Sat, Jan 11, 2025 at 11:01:35AM -0800, Ian Rogers wrote:
> Rather than manually scanning PMUs, use evsel__find_pmu that can use
> the PMU set during event parsing.
Right, and then evsel__find_pmu() also does some extra checks to call
pmu_read_sysfs() more selectively, right?
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/util/parse-events.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 1e23faa364b1..f147e13a7017 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -2406,9 +2406,8 @@ foreach_evsel_in_last_glob(struct evlist *evlist,
> static int set_filter(struct evsel *evsel, const void *arg)
> {
> const char *str = arg;
> - bool found = false;
> int nr_addr_filters = 0;
> - struct perf_pmu *pmu = NULL;
> + struct perf_pmu *pmu;
>
> if (evsel == NULL) {
> fprintf(stderr,
> @@ -2426,16 +2425,11 @@ static int set_filter(struct evsel *evsel, const void *arg)
> return 0;
> }
>
> - while ((pmu = perf_pmus__scan(pmu)) != NULL)
> - if (pmu->type == evsel->core.attr.type) {
> - found = true;
> - break;
> - }
> -
> - if (found)
> + pmu = evsel__find_pmu(evsel);
> + if (pmu) {
> perf_pmu__scan_file(pmu, "nr_addr_filters",
> "%d", &nr_addr_filters);
> -
> + }
> if (!nr_addr_filters)
> return perf_bpf_filter__parse(&evsel->bpf_filters, str);
>
> --
> 2.47.1.613.gc27f4b7a9f-goog
Powered by blists - more mailing lists