[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251016090958.GE109737@e132581.arm.com>
Date: Thu, 16 Oct 2025 10:09:58 +0100
From: Leo Yan <leo.yan@....com>
To: tanze <tanze@...inos.cn>
Cc: james.clark@...aro.org, linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
graham.woodward@....com
Subject: Re: [PATCH v1] perf arm_spe: Add a macro definition to handle offset
value
On Thu, Oct 16, 2025 at 04:30:19PM +0800, tanze wrote:
> Add a macro definition SPE_SYNTH_ID_OFFSET to handle the offset value
> and improve readability.
>
> Signed-off-by: tanze <tanze@...inos.cn>
> ---
> 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
Powered by blists - more mailing lists