[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d0020748-1738-4b83-bcad-ad12f122e4e4@kylinos.cn>
Date: Fri, 17 Oct 2025 09:07:49 +0800
From: tanze <tanze@...inos.cn>
To: Leo Yan <leo.yan@....com>
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
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:
>> 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
Thank you,
Ze Tan
Powered by blists - more mailing lists