diff mbox

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

Message ID 1466673383-105778-6-git-send-email-wangnan0@huawei.com
State New
Headers show

Commit Message

Wang Nan June 23, 2016, 9:16 a.m. UTC
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(-)

-- 
1.8.3.4
diff mbox

Patch

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()
 	};