linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: tanze <tanze@kylinos.cn>
Cc: james.clark@linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	graham.woodward@arm.com
Subject: Re: [PATCH v1] perf arm_spe: Add a macro definition to handle offset value
Date: Thu, 16 Oct 2025 10:09:58 +0100	[thread overview]
Message-ID: <20251016090958.GE109737@e132581.arm.com> (raw)
In-Reply-To: <20251016083019.27935-1-tanze@kylinos.cn>

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@kylinos.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

  reply	other threads:[~2025-10-16  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16  8:30 [PATCH v1] perf arm_spe: Add a macro definition to handle offset value tanze
2025-10-16  9:09 ` Leo Yan [this message]
     [not found] ` <1760620322251982.15.seg@mailgw.kylinos.cn>
2025-10-17  1:07   ` tanze
2025-10-17  2:15 ` [PATCH v2] " tanze
2025-10-17 10:09   ` Leo Yan
2025-10-19  3:05   ` Namhyung Kim
2025-10-24  6:27   ` Adrian Hunter
2025-10-24  8:10     ` Leo Yan
  -- strict thread matches above, loose matches on Subject: below --
2025-10-16  8:41 [PATCH v1] " tanze

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=20251016090958.GE109737@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=graham.woodward@arm.com \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=tanze@kylinos.cn \
    /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;
as well as URLs for NNTP newsgroup(s).