[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230524221831.1741381-7-irogers@google.com>
Date: Wed, 24 May 2023 15:18:02 -0700
From: Ian Rogers <irogers@...gle.com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
John Garry <john.g.garry@...cle.com>,
Will Deacon <will@...nel.org>,
James Clark <james.clark@....com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Kajol Jain <kjain@...ux.ibm.com>,
Jing Zhang <renyu.zj@...ux.alibaba.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Zhengjun Xing <zhengjun.xing@...ux.intel.com>,
Ravi Bangoria <ravi.bangoria@....com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Ming Wang <wangming01@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>,
Sandipan Das <sandipan.das@....com>,
Dmitrii Dolgov <9erthalion6@...il.com>,
Sean Christopherson <seanjc@...gle.com>,
Ali Saidi <alisaidi@...zon.com>, Rob Herring <robh@...nel.org>,
Thomas Richter <tmricht@...ux.ibm.com>,
Kang Minchul <tegongkang@...il.com>,
linux-kernel@...r.kernel.org, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org
Subject: [PATCH v3 06/35] perf pmu: Add is_core to pmu
Cache is_pmu_core in the pmu to avoid recomputation.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/perf/util/pmu.c | 7 ++++---
tools/perf/util/pmu.h | 7 +++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7392cec725bf..e8c0762c311a 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -952,6 +952,7 @@ static struct perf_pmu *pmu_lookup(int dirfd, const char *lookup_name)
}
pmu->type = type;
+ pmu->is_core = is_pmu_core(name);
pmu->is_uncore = pmu_is_uncore(dirfd, name);
if (pmu->is_uncore)
pmu->id = pmu_id(name);
@@ -1659,12 +1660,12 @@ bool is_pmu_hybrid(const char *name)
bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu)
{
- return is_pmu_core(pmu->name);
+ return pmu->is_core;
}
bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu)
{
- return is_pmu_core(pmu->name);
+ return pmu->is_core;
}
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu)
@@ -1723,7 +1724,7 @@ void print_pmu_events(const struct print_callbacks *print_cb, void *print_state)
pmu = NULL;
j = 0;
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
- bool is_cpu = is_pmu_core(pmu->name);
+ bool is_cpu = pmu->is_core;
list_for_each_entry(event, &pmu->aliases, list) {
aliases[j].event = event;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index f50919f1b34c..96236a79c6fd 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -59,6 +59,13 @@ struct perf_pmu {
* @selectable: Can the PMU name be selected as if it were an event?
*/
bool selectable;
+ /**
+ * @is_core: Is the PMU the core CPU PMU? Determined by the name being
+ * "cpu" or by the presence of
+ * <sysfs>/bus/event_source/devices/<name>/cpus. There may be >1 core
+ * PMU on systems like Intel hybrid.
+ */
+ bool is_core;
/**
* @is_uncore: Is the PMU not within the CPU core? Determined by the
* presence of <sysfs>/bus/event_source/devices/<name>/cpumask.
--
2.40.1.698.g37aff9b760-goog
Powered by blists - more mailing lists