[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231016093309.726436-1-yangjihong1@huawei.com>
Date: Mon, 16 Oct 2023 09:33:09 +0000
From: Yang Jihong <yangjihong1@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...nel.org>, <namhyung@...nel.org>, <irogers@...gle.com>,
<adrian.hunter@...el.com>, <linux-perf-users@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: <yangjihong1@...wei.com>
Subject: [PATCH] perf pmu: Filter out search events table of software pmu in perf_pmu__lookup()
For software pmu, the events_table is empty, reducing unnecessary search.
Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
---
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