linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: German Gomez <german.gomez@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org, Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH] perf script: Fix error when printing 'weight' field
Date: Mon, 21 Feb 2022 20:46:32 +0100	[thread overview]
Message-ID: <YhPh5pHMGeP8Arx6@krava> (raw)
In-Reply-To: <20220221171707.62960-1-german.gomez@arm.com>

On Mon, Feb 21, 2022 at 05:17:06PM +0000, German Gomez wrote:
> In SPE traces the 'weight' field can't be printed in perf-script because
> the 'dummy:u' event doesn't have the WEIGHT attribute set.
> 
> Use evsel__do_check_stype(..) to check this field, as it's done with
> other fields such as "phys_addr".
> 
> Before:
> 
> $ perf record -e arm_spe_0// -- sleep 1
> $ perf script -F event,ip,weight
> Samples for 'dummy:u' event do not have WEIGHT attribute set. Cannot print 'weight' field.
> 
> After:
> 
> $ perf script -F event,ip,weight
>    l1d-access:               12 ffffaf629d4cb320
>    tlb-access:               12 ffffaf629d4cb320
>        memory:               12 ffffaf629d4cb320
> 
> Fixes: b0fde9c6e291 ("perf arm-spe: Add SPE total latency as PERF_SAMPLE_WEIGHT")
> Signed-off-by: German Gomez <german.gomez@arm.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/builtin-script.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 9e032343f..6ce581067 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -463,7 +463,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
>  		return -EINVAL;
>  
>  	if (PRINT_FIELD(WEIGHT) &&
> -	    evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT))
> +	    evsel__do_check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT, allow_user_set))
>  		return -EINVAL;
>  
>  	if (PRINT_FIELD(SYM) &&
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-02-21 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 17:17 [PATCH] perf script: Fix error when printing 'weight' field German Gomez
2022-02-21 19:46 ` Jiri Olsa [this message]
2022-02-23  0:18   ` Arnaldo Carvalho de Melo

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=YhPh5pHMGeP8Arx6@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=german.gomez@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    /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).