Re: [PATCH v1] perf arm_spe: Add a macro definition to handle offset value
From: tanze <hidden>
Date: 2025-10-17 01:07:56
Also in:
linux-perf-users, lkml
Hi, Leo Yan Thank you for your advice,I should have done better. 在 2025/10/16 17:09, Leo Yan 写道:
On Thu, Oct 16, 2025 at 04:30:19PM +0800, tanze wrote:quoted
Add a macro definition SPE_SYNTH_ID_OFFSET to handle the offset value and improve readability. Signed-off-by: tanze <redacted> --- tools/perf/util/arm-spe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 71be979f5077..645048ac7708 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c@@ -36,6 +36,7 @@ #include "../../arch/arm64/include/asm/cputype.h" #define MAX_TIMESTAMP (~0ULL) +#define SPE_SYNTH_ID_OFFSET (1000000000ULL) #define is_ldst_op(op) (!!((op) & ARM_SPE_OP_LDST))@@ -1732,7 +1733,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) attr.sample_period = spe->synth_opts.period; /* create new id val to be a fixed offset from evsel id */ - id = evsel->core.id[0] + 1000000000; + id = evsel->core.id[0] + SPE_SYNTH_ID_OFFSET;If really want to improve a bit for this, I'd define a macro in util/synthetic-events.h: #define PERF_SYNTH_EVENT_ID_OFFSET (1000000000ULL) Then, apply the new macro in files: $ git grep "core.id.*1000000000" util/arm-spe.c: id = evsel->core.id[0] + 1000000000; util/cs-etm.c: id = evsel->core.id[0] + 1000000000; util/intel-bts.c: id = evsel->core.id[0] + 1000000000; util/intel-pt.c: id = evsel->core.id[0] + 1000000000; util/powerpc-vpadtl.c: id = evsel->core.id[0] + 1000000000; Thanks, Leo
Thank you, Ze Tan