From: kan.liang@linux.intel.com
To: acme@kernel.org, irogers@google.com, peterz@infradead.org,
mingo@redhat.com, namhyung@kernel.org, jolsa@kernel.org,
adrian.hunter@intel.com, john.g.garry@oracle.com,
will@kernel.org, james.clark@arm.com, mike.leach@linaro.org,
leo.yan@linaro.org, yuhaixin.yhx@linux.alibaba.com,
renyu.zj@linux.alibaba.com, tmricht@linux.ibm.com,
ravi.bangoria@amd.com, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH 5/6] perf mem: Clean up is_mem_loads_aux_event()
Date: Wed, 6 Dec 2023 12:13:23 -0800 [thread overview]
Message-ID: <20231206201324.184059-6-kan.liang@linux.intel.com> (raw)
In-Reply-To: <20231206201324.184059-1-kan.liang@linux.intel.com>
From: Kan Liang <kan.liang@linux.intel.com>
The aux_event can be retrieved from the perf_pmu now. Implement a
generic support.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
tools/perf/arch/x86/util/mem-events.c | 13 -------------
tools/perf/util/mem-events.c | 14 ++++++++++++--
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/tools/perf/arch/x86/util/mem-events.c b/tools/perf/arch/x86/util/mem-events.c
index b776d849fc64..71ffe16de751 100644
--- a/tools/perf/arch/x86/util/mem-events.c
+++ b/tools/perf/arch/x86/util/mem-events.c
@@ -28,16 +28,3 @@ struct perf_mem_event perf_mem_events_amd[PERF_MEM_EVENTS__MAX] = {
E(NULL, NULL, NULL, false, 0),
E("mem-ldst", "%s//", NULL, false, 0),
};
-
-bool is_mem_loads_aux_event(struct evsel *leader)
-{
- struct perf_pmu *pmu = perf_pmus__find("cpu");
-
- if (!pmu)
- pmu = perf_pmus__find("cpu_core");
-
- if (pmu && !perf_pmu__have_event(pmu, "mem-loads-aux"))
- return false;
-
- return leader->core.attr.config == MEM_LOADS_AUX;
-}
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 9ea9e9a868c4..336d1109b3a5 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -103,9 +103,19 @@ static const char *perf_mem_events__name(int i, struct perf_pmu *pmu)
return NULL;
}
-__weak bool is_mem_loads_aux_event(struct evsel *leader __maybe_unused)
+bool is_mem_loads_aux_event(struct evsel *leader)
{
- return false;
+ struct perf_pmu *pmu = leader->pmu;
+ struct perf_mem_event *e;
+
+ if (!pmu || !pmu->mem_events)
+ return false;
+
+ e = &pmu->mem_events[PERF_MEM_EVENTS__LOAD];
+ if (!e->aux_event)
+ return false;
+
+ return leader->core.attr.config == e->aux_event;
}
int perf_mem_events__parse(struct perf_pmu *pmu, const char *str)
--
2.35.1
next prev parent reply other threads:[~2023-12-06 20:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 20:13 [PATCH 0/6] Clean up perf mem kan.liang
2023-12-06 20:13 ` [PATCH 1/6] perf mem: Add mem_events into the supported perf_pmu kan.liang
2023-12-06 21:01 ` Ian Rogers
2023-12-07 14:21 ` Ravi Bangoria
2023-12-07 14:27 ` Liang, Kan
2023-12-06 20:13 ` [PATCH 2/6] perf mem: Clean up perf_mem_events__ptr() kan.liang
2023-12-06 21:04 ` Ian Rogers
2023-12-07 14:42 ` Liang, Kan
2023-12-06 20:13 ` [PATCH 3/6] perf mem: Clean up perf_mem_events__name() kan.liang
2023-12-06 21:07 ` Ian Rogers
2023-12-06 21:52 ` Liang, Kan
2023-12-06 20:13 ` [PATCH 4/6] perf mem: Clean up perf_mem_event__supported() kan.liang
2023-12-06 21:08 ` Ian Rogers
2023-12-06 20:13 ` kan.liang [this message]
2023-12-06 21:10 ` [PATCH 5/6] perf mem: Clean up is_mem_loads_aux_event() Ian Rogers
2023-12-06 20:13 ` [PATCH 6/6] perf mem: Remove useless header files for X86 kan.liang
2023-12-06 20:38 ` Arnaldo Carvalho de Melo
2023-12-06 21:53 ` Liang, Kan
2023-12-07 14:44 ` [PATCH 0/6] Clean up perf mem Ravi Bangoria
2023-12-07 15:05 ` Liang, Kan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231206201324.184059-6-kan.liang@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=renyu.zj@linux.alibaba.com \
--cc=tmricht@linux.ibm.com \
--cc=will@kernel.org \
--cc=yuhaixin.yhx@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox