Re: [PATCH v5 03/17] perf ftrace: add option -t/--tid to filter by thread id

From: Arnaldo Carvalho de Melo
Date: Thu Jul 16 2020 - 11:36:35 EST


Em Sat, Jul 11, 2020 at 08:40:21PM +0800, Changbin Du escreveu:
> This allows us to trace single thread instead of the whole process.
>
> Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
> ---
> tools/perf/Documentation/perf-ftrace.txt | 4 ++++
> tools/perf/builtin-ftrace.c | 2 ++
> 2 files changed, 6 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt
> index d79560dea19f..e204bf6d50d8 100644
> --- a/tools/perf/Documentation/perf-ftrace.txt
> +++ b/tools/perf/Documentation/perf-ftrace.txt
> @@ -38,6 +38,10 @@ OPTIONS
> --pid=::
> Trace on existing process id (comma separated list).
>
> +-t::
> +--tid=::
> + Trace on existing thread id (comma separated list).
> +


Humm, I just tried:

[root@five ~]# yes > /dev/null &
[1] 18265
[root@five ~]# perf ftrace --tid 18265
^C[root@five ~]#

After waiting for a while, nothing, what am I doing wrong?

- Arnaldo


> -a::
> --all-cpus::
> Force system-wide collection. Scripts run without a <command>
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index 244cc8e6bd60..1188b82c6541 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -515,6 +515,8 @@ int cmd_ftrace(int argc, const char **argv)
> "Show available functions to filter"),
> OPT_STRING('p', "pid", &ftrace.target.pid, "pid",
> "trace on existing process id"),
> + OPT_STRING('t', "tid", &ftrace.target.tid, "tid",
> + "trace on existing thread id (exclusive to --pid)"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose"),
> OPT_BOOLEAN('a', "all-cpus", &ftrace.target.system_wide,
> --
> 2.25.1
>

--

- Arnaldo