* [PATCH] perf ftrace: Make system wide the default target for latency subcommand
@ 2023-03-24 3:27 Yang Jihong
2023-03-25 1:39 ` Namhyung Kim
0 siblings, 1 reply; 6+ messages in thread
From: Yang Jihong @ 2023-03-24 3:27 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, irogers, adrian.hunter, linux-perf-users, linux-kernel
Cc: yangjihong1
If no target is specified for 'latency' subcommand, the execution fails
because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
Make system wide the default target, which is the same as the default
behavior of 'trace' subcommand.
Before the fix:
# perf ftrace latency -T schedule
failed to set ftrace pid
After the fix:
# perf ftrace latency -T schedule
^C# DURATION | COUNT | GRAPH |
0 - 1 us | 0 | |
1 - 2 us | 0 | |
2 - 4 us | 0 | |
4 - 8 us | 2828 | #### |
8 - 16 us | 23953 | ######################################## |
16 - 32 us | 408 | |
32 - 64 us | 318 | |
64 - 128 us | 4 | |
128 - 256 us | 3 | |
256 - 512 us | 0 | |
512 - 1024 us | 1 | |
1 - 2 ms | 4 | |
2 - 4 ms | 0 | |
4 - 8 ms | 0 | |
8 - 16 ms | 0 | |
16 - 32 ms | 0 | |
32 - 64 ms | 0 | |
64 - 128 ms | 0 | |
128 - 256 ms | 4 | |
256 - 512 ms | 2 | |
512 - 1024 ms | 0 | |
1 - ... s | 0 | |
Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
tools/perf/builtin-ftrace.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index d7fe00f66b83..fb1b66ef2e16 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
goto out_delete_filters;
}
+ /* Make system wide (-a) the default target. */
+ if (!argc && target__none(&ftrace.target))
+ ftrace.target.system_wide = true;
+
switch (subcmd) {
case PERF_FTRACE_TRACE:
- if (!argc && target__none(&ftrace.target))
- ftrace.target.system_wide = true;
cmd_func = __cmd_ftrace;
break;
case PERF_FTRACE_LATENCY:
--
2.30.GIT
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand
2023-03-24 3:27 [PATCH] perf ftrace: Make system wide the default target for latency subcommand Yang Jihong
@ 2023-03-25 1:39 ` Namhyung Kim
2023-03-25 3:29 ` Yang Jihong
2023-03-27 11:34 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 6+ messages in thread
From: Namhyung Kim @ 2023-03-25 1:39 UTC (permalink / raw)
To: Yang Jihong
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, linux-perf-users, linux-kernel
Hello,
On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong <yangjihong1@huawei.com> wrote:
>
> If no target is specified for 'latency' subcommand, the execution fails
> because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
> Make system wide the default target, which is the same as the default
> behavior of 'trace' subcommand.
I followed the convention to use -a for system-wide profiling.
Not sure if it's ok to make it default, but I don't object. :)
Thanks,
Namhyung
>
> Before the fix:
>
> # perf ftrace latency -T schedule
> failed to set ftrace pid
>
> After the fix:
>
> # perf ftrace latency -T schedule
> ^C# DURATION | COUNT | GRAPH |
> 0 - 1 us | 0 | |
> 1 - 2 us | 0 | |
> 2 - 4 us | 0 | |
> 4 - 8 us | 2828 | #### |
> 8 - 16 us | 23953 | ######################################## |
> 16 - 32 us | 408 | |
> 32 - 64 us | 318 | |
> 64 - 128 us | 4 | |
> 128 - 256 us | 3 | |
> 256 - 512 us | 0 | |
> 512 - 1024 us | 1 | |
> 1 - 2 ms | 4 | |
> 2 - 4 ms | 0 | |
> 4 - 8 ms | 0 | |
> 8 - 16 ms | 0 | |
> 16 - 32 ms | 0 | |
> 32 - 64 ms | 0 | |
> 64 - 128 ms | 0 | |
> 128 - 256 ms | 4 | |
> 256 - 512 ms | 2 | |
> 512 - 1024 ms | 0 | |
> 1 - ... s | 0 | |
>
> Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
> tools/perf/builtin-ftrace.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index d7fe00f66b83..fb1b66ef2e16 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
> goto out_delete_filters;
> }
>
> + /* Make system wide (-a) the default target. */
> + if (!argc && target__none(&ftrace.target))
> + ftrace.target.system_wide = true;
> +
> switch (subcmd) {
> case PERF_FTRACE_TRACE:
> - if (!argc && target__none(&ftrace.target))
> - ftrace.target.system_wide = true;
> cmd_func = __cmd_ftrace;
> break;
> case PERF_FTRACE_LATENCY:
> --
> 2.30.GIT
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand
2023-03-25 1:39 ` Namhyung Kim
@ 2023-03-25 3:29 ` Yang Jihong
2023-03-27 11:34 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2023-03-25 3:29 UTC (permalink / raw)
To: Namhyung Kim
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, linux-perf-users, linux-kernel
Hello,
On 2023/3/25 9:39, Namhyung Kim wrote:
> Hello,
>
> On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong <yangjihong1@huawei.com> wrote:
>>
>> If no target is specified for 'latency' subcommand, the execution fails
>> because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
>> Make system wide the default target, which is the same as the default
>> behavior of 'trace' subcommand.
>
> I followed the convention to use -a for system-wide profiling.
> Not sure if it's ok to make it default, but I don't object. :)
>
Thanks for the reply.
Yes, "perf ftrace latency" supports -a for system wide profiles.
Because "perf ftrace trace" defaults to system wide when no target is
specified. Therefore, I sent the patch to check whether "latency" is
consistent with the behavior of the "trace". :)
Thanks,
Yang.
> Thanks,
> Namhyung
>
>>
>> Before the fix:
>>
>> # perf ftrace latency -T schedule
>> failed to set ftrace pid
>>
>> After the fix:
>>
>> # perf ftrace latency -T schedule
>> ^C# DURATION | COUNT | GRAPH |
>> 0 - 1 us | 0 | |
>> 1 - 2 us | 0 | |
>> 2 - 4 us | 0 | |
>> 4 - 8 us | 2828 | #### |
>> 8 - 16 us | 23953 | ######################################## |
>> 16 - 32 us | 408 | |
>> 32 - 64 us | 318 | |
>> 64 - 128 us | 4 | |
>> 128 - 256 us | 3 | |
>> 256 - 512 us | 0 | |
>> 512 - 1024 us | 1 | |
>> 1 - 2 ms | 4 | |
>> 2 - 4 ms | 0 | |
>> 4 - 8 ms | 0 | |
>> 8 - 16 ms | 0 | |
>> 16 - 32 ms | 0 | |
>> 32 - 64 ms | 0 | |
>> 64 - 128 ms | 0 | |
>> 128 - 256 ms | 4 | |
>> 256 - 512 ms | 2 | |
>> 512 - 1024 ms | 0 | |
>> 1 - ... s | 0 | |
>>
>> Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
>> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
>> ---
>> tools/perf/builtin-ftrace.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
>> index d7fe00f66b83..fb1b66ef2e16 100644
>> --- a/tools/perf/builtin-ftrace.c
>> +++ b/tools/perf/builtin-ftrace.c
>> @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
>> goto out_delete_filters;
>> }
>>
>> + /* Make system wide (-a) the default target. */
>> + if (!argc && target__none(&ftrace.target))
>> + ftrace.target.system_wide = true;
>> +
>> switch (subcmd) {
>> case PERF_FTRACE_TRACE:
>> - if (!argc && target__none(&ftrace.target))
>> - ftrace.target.system_wide = true;
>> cmd_func = __cmd_ftrace;
>> break;
>> case PERF_FTRACE_LATENCY:
>> --
>> 2.30.GIT
>>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand
2023-03-25 1:39 ` Namhyung Kim
2023-03-25 3:29 ` Yang Jihong
@ 2023-03-27 11:34 ` Arnaldo Carvalho de Melo
2023-03-27 14:58 ` Namhyung Kim
1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-03-27 11:34 UTC (permalink / raw)
To: Namhyung Kim
Cc: Yang Jihong, peterz, mingo, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, linux-perf-users, linux-kernel
Em Fri, Mar 24, 2023 at 06:39:25PM -0700, Namhyung Kim escreveu:
> Hello,
>
> On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong <yangjihong1@huawei.com> wrote:
> >
> > If no target is specified for 'latency' subcommand, the execution fails
> > because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
> > Make system wide the default target, which is the same as the default
> > behavior of 'trace' subcommand.
>
> I followed the convention to use -a for system-wide profiling.
> Not sure if it's ok to make it default, but I don't object. :)
I'll make that an Acked-by, ok?
- Arnaldo
> Thanks,
> Namhyung
>
> >
> > Before the fix:
> >
> > # perf ftrace latency -T schedule
> > failed to set ftrace pid
> >
> > After the fix:
> >
> > # perf ftrace latency -T schedule
> > ^C# DURATION | COUNT | GRAPH |
> > 0 - 1 us | 0 | |
> > 1 - 2 us | 0 | |
> > 2 - 4 us | 0 | |
> > 4 - 8 us | 2828 | #### |
> > 8 - 16 us | 23953 | ######################################## |
> > 16 - 32 us | 408 | |
> > 32 - 64 us | 318 | |
> > 64 - 128 us | 4 | |
> > 128 - 256 us | 3 | |
> > 256 - 512 us | 0 | |
> > 512 - 1024 us | 1 | |
> > 1 - 2 ms | 4 | |
> > 2 - 4 ms | 0 | |
> > 4 - 8 ms | 0 | |
> > 8 - 16 ms | 0 | |
> > 16 - 32 ms | 0 | |
> > 32 - 64 ms | 0 | |
> > 64 - 128 ms | 0 | |
> > 128 - 256 ms | 4 | |
> > 256 - 512 ms | 2 | |
> > 512 - 1024 ms | 0 | |
> > 1 - ... s | 0 | |
> >
> > Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
> > Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> > ---
> > tools/perf/builtin-ftrace.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> > index d7fe00f66b83..fb1b66ef2e16 100644
> > --- a/tools/perf/builtin-ftrace.c
> > +++ b/tools/perf/builtin-ftrace.c
> > @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
> > goto out_delete_filters;
> > }
> >
> > + /* Make system wide (-a) the default target. */
> > + if (!argc && target__none(&ftrace.target))
> > + ftrace.target.system_wide = true;
> > +
> > switch (subcmd) {
> > case PERF_FTRACE_TRACE:
> > - if (!argc && target__none(&ftrace.target))
> > - ftrace.target.system_wide = true;
> > cmd_func = __cmd_ftrace;
> > break;
> > case PERF_FTRACE_LATENCY:
> > --
> > 2.30.GIT
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand
2023-03-27 11:34 ` Arnaldo Carvalho de Melo
@ 2023-03-27 14:58 ` Namhyung Kim
2023-03-27 17:45 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2023-03-27 14:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Yang Jihong, peterz, mingo, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, linux-perf-users, linux-kernel
On Mon, Mar 27, 2023 at 4:34 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Fri, Mar 24, 2023 at 06:39:25PM -0700, Namhyung Kim escreveu:
> > Hello,
> >
> > On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong <yangjihong1@huawei.com> wrote:
> > >
> > > If no target is specified for 'latency' subcommand, the execution fails
> > > because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
> > > Make system wide the default target, which is the same as the default
> > > behavior of 'trace' subcommand.
> >
> > I followed the convention to use -a for system-wide profiling.
> > Not sure if it's ok to make it default, but I don't object. :)
>
> I'll make that an Acked-by, ok?
Sure.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> > >
> > > Before the fix:
> > >
> > > # perf ftrace latency -T schedule
> > > failed to set ftrace pid
> > >
> > > After the fix:
> > >
> > > # perf ftrace latency -T schedule
> > > ^C# DURATION | COUNT | GRAPH |
> > > 0 - 1 us | 0 | |
> > > 1 - 2 us | 0 | |
> > > 2 - 4 us | 0 | |
> > > 4 - 8 us | 2828 | #### |
> > > 8 - 16 us | 23953 | ######################################## |
> > > 16 - 32 us | 408 | |
> > > 32 - 64 us | 318 | |
> > > 64 - 128 us | 4 | |
> > > 128 - 256 us | 3 | |
> > > 256 - 512 us | 0 | |
> > > 512 - 1024 us | 1 | |
> > > 1 - 2 ms | 4 | |
> > > 2 - 4 ms | 0 | |
> > > 4 - 8 ms | 0 | |
> > > 8 - 16 ms | 0 | |
> > > 16 - 32 ms | 0 | |
> > > 32 - 64 ms | 0 | |
> > > 64 - 128 ms | 0 | |
> > > 128 - 256 ms | 4 | |
> > > 256 - 512 ms | 2 | |
> > > 512 - 1024 ms | 0 | |
> > > 1 - ... s | 0 | |
> > >
> > > Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
> > > Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> > > ---
> > > tools/perf/builtin-ftrace.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> > > index d7fe00f66b83..fb1b66ef2e16 100644
> > > --- a/tools/perf/builtin-ftrace.c
> > > +++ b/tools/perf/builtin-ftrace.c
> > > @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
> > > goto out_delete_filters;
> > > }
> > >
> > > + /* Make system wide (-a) the default target. */
> > > + if (!argc && target__none(&ftrace.target))
> > > + ftrace.target.system_wide = true;
> > > +
> > > switch (subcmd) {
> > > case PERF_FTRACE_TRACE:
> > > - if (!argc && target__none(&ftrace.target))
> > > - ftrace.target.system_wide = true;
> > > cmd_func = __cmd_ftrace;
> > > break;
> > > case PERF_FTRACE_LATENCY:
> > > --
> > > 2.30.GIT
> > >
>
> --
>
> - Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf ftrace: Make system wide the default target for latency subcommand
2023-03-27 14:58 ` Namhyung Kim
@ 2023-03-27 17:45 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-03-27 17:45 UTC (permalink / raw)
To: Namhyung Kim
Cc: Yang Jihong, peterz, mingo, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, linux-perf-users, linux-kernel
Em Mon, Mar 27, 2023 at 07:58:43AM -0700, Namhyung Kim escreveu:
> On Mon, Mar 27, 2023 at 4:34 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Em Fri, Mar 24, 2023 at 06:39:25PM -0700, Namhyung Kim escreveu:
> > > Hello,
> > >
> > > On Thu, Mar 23, 2023 at 8:29 PM Yang Jihong <yangjihong1@huawei.com> wrote:
> > > >
> > > > If no target is specified for 'latency' subcommand, the execution fails
> > > > because - 1 (invalid value) is written to set_ftrace_pid tracefs file.
> > > > Make system wide the default target, which is the same as the default
> > > > behavior of 'trace' subcommand.
> > >
> > > I followed the convention to use -a for system-wide profiling.
> > > Not sure if it's ok to make it default, but I don't object. :)
> >
> > I'll make that an Acked-by, ok?
>
> Sure.
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks!
- Arnaldo
> Thanks,
> Namhyung
>
>
> > > >
> > > > Before the fix:
> > > >
> > > > # perf ftrace latency -T schedule
> > > > failed to set ftrace pid
> > > >
> > > > After the fix:
> > > >
> > > > # perf ftrace latency -T schedule
> > > > ^C# DURATION | COUNT | GRAPH |
> > > > 0 - 1 us | 0 | |
> > > > 1 - 2 us | 0 | |
> > > > 2 - 4 us | 0 | |
> > > > 4 - 8 us | 2828 | #### |
> > > > 8 - 16 us | 23953 | ######################################## |
> > > > 16 - 32 us | 408 | |
> > > > 32 - 64 us | 318 | |
> > > > 64 - 128 us | 4 | |
> > > > 128 - 256 us | 3 | |
> > > > 256 - 512 us | 0 | |
> > > > 512 - 1024 us | 1 | |
> > > > 1 - 2 ms | 4 | |
> > > > 2 - 4 ms | 0 | |
> > > > 4 - 8 ms | 0 | |
> > > > 8 - 16 ms | 0 | |
> > > > 16 - 32 ms | 0 | |
> > > > 32 - 64 ms | 0 | |
> > > > 64 - 128 ms | 0 | |
> > > > 128 - 256 ms | 4 | |
> > > > 256 - 512 ms | 2 | |
> > > > 512 - 1024 ms | 0 | |
> > > > 1 - ... s | 0 | |
> > > >
> > > > Fixes: 53be50282269 ("perf ftrace: Add 'latency' subcommand")
> > > > Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> > > > ---
> > > > tools/perf/builtin-ftrace.c | 6 ++++--
> > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> > > > index d7fe00f66b83..fb1b66ef2e16 100644
> > > > --- a/tools/perf/builtin-ftrace.c
> > > > +++ b/tools/perf/builtin-ftrace.c
> > > > @@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv)
> > > > goto out_delete_filters;
> > > > }
> > > >
> > > > + /* Make system wide (-a) the default target. */
> > > > + if (!argc && target__none(&ftrace.target))
> > > > + ftrace.target.system_wide = true;
> > > > +
> > > > switch (subcmd) {
> > > > case PERF_FTRACE_TRACE:
> > > > - if (!argc && target__none(&ftrace.target))
> > > > - ftrace.target.system_wide = true;
> > > > cmd_func = __cmd_ftrace;
> > > > break;
> > > > case PERF_FTRACE_LATENCY:
> > > > --
> > > > 2.30.GIT
> > > >
> >
> > --
> >
> > - Arnaldo
--
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-27 17:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 3:27 [PATCH] perf ftrace: Make system wide the default target for latency subcommand Yang Jihong
2023-03-25 1:39 ` Namhyung Kim
2023-03-25 3:29 ` Yang Jihong
2023-03-27 11:34 ` Arnaldo Carvalho de Melo
2023-03-27 14:58 ` Namhyung Kim
2023-03-27 17:45 ` 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.