lkml.org 
[lkml]   [2023]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@huawei.com> wrote:
>
> For software pmu, the events_table is empty, reducing unnecessary search.
>
> Signed-off-by: Yang Jihong <yangjihong1@huawei.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
>

\
 
 \ /
  Last update: 2023-10-16 23:05    [W:4.565 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site