Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1429623 > unrolled thread

[PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert'

Started byWang Nan <wangnan0@huawei.com>
First post2016-06-23 11:20 +0200
Last post2016-06-24 09:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert' Wang Nan <wangnan0@huawei.com> - 2016-06-23 11:20 +0200
    Re: [PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert' Jiri Olsa <jolsa@redhat.com> - 2016-06-24 09:10 +0200

#1429623 — [PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert'

FromWang Nan <wangnan0@huawei.com>
Date2016-06-23 11:20 +0200
Subject[PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert'
Message-ID<rN8XL-7PN-9@gated-at.bofh.it>
After this patch, 'perf data convert' convert comm events to output
CTF stream.

Result:

 # perf record -a sleep 1
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.771 MB perf.data (79 samples) ]

 # perf data convert --to-ctf ./out.ctf
 [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
 [ perf data convert: Converted and wrote 0.004 MB (79 samples) ]

 # babeltrace ./out.ctf/
 [20:59:41.942633169] (+?.?????????) cycles:ppp: { cpu_id = 0 }, { perf_ip = 0xFFFFFFFF81065AF4, perf_tid = 0, perf_pid = 0, perf_period = 1 }
 [20:59:41.942636194] (+0.000003025) cycles:ppp: { cpu_id = 0 }, { perf_ip = 0xFFFFFFFF81065AF4, perf_tid = 0, perf_pid = 0, perf_period = 1 }
 ...    // only sample event is converted

 # perf data convert --all --to-ctf ./out.ctf
 [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
 [ perf data convert: Converted and wrote 0.004 MB (79 samples) ]

 # babeltrace ./out.ctf/
 [00:00:00.000000000] (+?.?????????) perf_comm: { cpu_id = 0 }, { comm = "init", pid = 1, tid = 1 }
 [00:00:00.000000000] (+0.000000000) perf_comm: { cpu_id = 0 }, { comm = "kthreadd", pid = 2, tid = 2 }
 [00:00:00.000000000] (+0.000000000) perf_comm: { cpu_id = 0 }, { comm = "ksoftirqd/0", pid = 3, tid = 3 }
 ...    // comm events are converted

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/Documentation/perf-data.txt | 5 ++++-
 tools/perf/builtin-data.c              | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-data.txt b/tools/perf/Documentation/perf-data.txt
index be8fa1a..f8ada39 100644
--- a/tools/perf/Documentation/perf-data.txt
+++ b/tools/perf/Documentation/perf-data.txt
@@ -34,7 +34,10 @@ OPTIONS for 'convert'
 --verbose::
         Be more verbose (show counter open errors, etc).
 
-SEE ALSO
+--all::
+	Convert all events, including non-sample events (comm, fork, ...), to output.
+	Default is off, only convert samples.
+
 --------
 linkperf:perf[1]
 [1] Common Trace Format - http://www.efficios.com/ctf
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index a011a56..a87c964 100644
--- a/tools/perf/builtin-data.c
+++ b/tools/perf/builtin-data.c
@@ -65,6 +65,7 @@ static int cmd_data_convert(int argc, const char **argv,
 		OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"),
 #endif
 		OPT_BOOLEAN('f', "force", &opts.force, "don't complain, do it"),
+		OPT_BOOLEAN(0, "all", &opts.non_sample, "Convert all events"),
 		OPT_END()
 	};
 
-- 
1.8.3.4

[toc] | [next] | [standalone]


#1430409

FromJiri Olsa <jolsa@redhat.com>
Date2016-06-24 09:10 +0200
Message-ID<rNtpw-4ZY-5@gated-at.bofh.it>
In reply to#1429623
On Thu, Jun 23, 2016 at 09:16:22AM +0000, Wang Nan wrote:
> After this patch, 'perf data convert' convert comm events to output
> CTF stream.
> 
> Result:
> 
>  # perf record -a sleep 1
>  [ perf record: Woken up 1 times to write data ]
>  [ perf record: Captured and wrote 0.771 MB perf.data (79 samples) ]
> 
>  # perf data convert --to-ctf ./out.ctf
>  [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
>  [ perf data convert: Converted and wrote 0.004 MB (79 samples) ]
> 
>  # babeltrace ./out.ctf/
>  [20:59:41.942633169] (+?.?????????) cycles:ppp: { cpu_id = 0 }, { perf_ip = 0xFFFFFFFF81065AF4, perf_tid = 0, perf_pid = 0, perf_period = 1 }
>  [20:59:41.942636194] (+0.000003025) cycles:ppp: { cpu_id = 0 }, { perf_ip = 0xFFFFFFFF81065AF4, perf_tid = 0, perf_pid = 0, perf_period = 1 }
>  ...    // only sample event is converted
> 
>  # perf data convert --all --to-ctf ./out.ctf
>  [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
>  [ perf data convert: Converted and wrote 0.004 MB (79 samples) ]
> 
>  # babeltrace ./out.ctf/
>  [00:00:00.000000000] (+?.?????????) perf_comm: { cpu_id = 0 }, { comm = "init", pid = 1, tid = 1 }
>  [00:00:00.000000000] (+0.000000000) perf_comm: { cpu_id = 0 }, { comm = "kthreadd", pid = 2, tid = 2 }
>  [00:00:00.000000000] (+0.000000000) perf_comm: { cpu_id = 0 }, { comm = "ksoftirqd/0", pid = 3, tid = 3 }
>  ...    // comm events are converted
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
>  tools/perf/Documentation/perf-data.txt | 5 ++++-
>  tools/perf/builtin-data.c              | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Documentation/perf-data.txt b/tools/perf/Documentation/perf-data.txt
> index be8fa1a..f8ada39 100644
> --- a/tools/perf/Documentation/perf-data.txt
> +++ b/tools/perf/Documentation/perf-data.txt
> @@ -34,7 +34,10 @@ OPTIONS for 'convert'
>  --verbose::
>          Be more verbose (show counter open errors, etc).
>  
> -SEE ALSO
> +--all::
> +	Convert all events, including non-sample events (comm, fork, ...), to output.
> +	Default is off, only convert samples.

you removed the 'SEE ALSO' header ;-)

> +
>  --------
>  linkperf:perf[1]
>  [1] Common Trace Format - http://www.efficios.com/ctf
> diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
> index a011a56..a87c964 100644
> --- a/tools/perf/builtin-data.c
> +++ b/tools/perf/builtin-data.c
> @@ -65,6 +65,7 @@ static int cmd_data_convert(int argc, const char **argv,
>  		OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"),
>  #endif
>  		OPT_BOOLEAN('f', "force", &opts.force, "don't complain, do it"),
> +		OPT_BOOLEAN(0, "all", &opts.non_sample, "Convert all events"),

IMO opts.all would suite better I think,
but we can always change it if needed

thanks,
jirka

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web