* [PATCH] perf script: Fix error when printing 'weight' field
@ 2022-02-21 17:17 German Gomez
2022-02-21 19:46 ` Jiri Olsa
0 siblings, 1 reply; 3+ messages in thread
From: German Gomez @ 2022-02-21 17:17 UTC (permalink / raw)
To: linux-kernel, linux-perf-users, acme
Cc: German Gomez, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Namhyung Kim
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf script: Fix error when printing 'weight' field
2022-02-21 17:17 [PATCH] perf script: Fix error when printing 'weight' field German Gomez
@ 2022-02-21 19:46 ` Jiri Olsa
2022-02-23 0:18 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Olsa @ 2022-02-21 19:46 UTC (permalink / raw)
To: German Gomez
Cc: linux-kernel, linux-perf-users, acme, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf script: Fix error when printing 'weight' field
2022-02-21 19:46 ` Jiri Olsa
@ 2022-02-23 0:18 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-23 0:18 UTC (permalink / raw)
To: Jiri Olsa
Cc: German Gomez, linux-kernel, linux-perf-users, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim
Em Mon, Feb 21, 2022 at 08:46:32PM +0100, Jiri Olsa escreveu:
> 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, applied to perf/urgent.
- Arnaldo
> 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
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-23 0:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 17:17 [PATCH] perf script: Fix error when printing 'weight' field German Gomez
2022-02-21 19:46 ` Jiri Olsa
2022-02-23 0:18 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.