[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fXwAbaqqYVE_9y6JbkQ8rkU-f38ZB0gbpZdg10HLtyYzQ@mail.gmail.com>
Date: Mon, 16 Oct 2023 14:04:30 -0700
From: Ian Rogers <irogers@...gle.com>
To: Yang Jihong <yangjihong1@...wei.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, namhyung@...nel.org, adrian.hunter@...el.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf pmu: Filter out search events table of software pmu
in perf_pmu__lookup()
On Mon, Oct 16, 2023 at 2:35 AM Yang Jihong <yangjihong1@...wei.com> wrote:
>
> For software pmu, the events_table is empty, reducing unnecessary search.
>
> Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
I'd rather that all PMUs behaved in the same manner without ifs that
will catch people/me out later on. perf_pmu__is_software tells whether
the kernel context is software and therefore whether events can be
grouped with a hardware event. As a test for whether json exists or
not I'd rather stick to values derived from the json.
Thanks,
Ian
> ---
> tools/perf/util/pmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 6428e2648289..59c8394a4efa 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -1033,7 +1033,8 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char
> pmu->id = pmu_id(name);
> pmu->max_precise = pmu_max_precise(dirfd, pmu);
> pmu->alias_name = pmu_find_alias_name(pmu, dirfd);
> - pmu->events_table = perf_pmu__find_events_table(pmu);
> + if (!perf_pmu__is_software(pmu))
> + pmu->events_table = perf_pmu__find_events_table(pmu);
> pmu_add_sys_aliases(pmu);
> list_add_tail(&pmu->list, pmus);
>
> --
> 2.34.1
>
Powered by blists - more mailing lists