summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-data.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-08-05 11:34:42 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-08-06 09:43:37 -0300
commit88371c5898fc9e7c9faeb7f53ab9082b4e84b7a8 (patch)
tree2ab056bd173a722b8c73a8d9a041e8419434e403 /tools/perf/builtin-data.c
parent9d88a1a170edfc89cdb2ef9ca07e53d74359081e (diff)
perf data: Add support to store time of day in CTF data conversion
Adad support to convert and store time of day in CTF data conversion for 'perf data convert' subcommand. The perf.data used for conversion needs to have clock data information - must be recorded with -k/--clockid option). New --tod option is added to 'perf data convert' subcommand to convert data with timestamps converted to wall clock time. Record data with clockid set: # perf record -k CLOCK_MONOTONIC kill kill: not enough arguments [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.033 MB perf.data (8 samples) ] Convert data with TOD timestamps: # perf data convert --tod --to-ctf ./ctf [ perf data convert: Converted 'perf.data' into CTF data './ctf' ] [ perf data convert: Converted and wrote 0.000 MB (8 samples) ] Display data in perf script: # perf script -F+tod --ns perf 262150 2020-07-13 18:38:50.097678523 153633.958246159: 1 cycles: ... perf 262150 2020-07-13 18:38:50.097682941 153633.958250577: 1 cycles: ... perf 262150 2020-07-13 18:38:50.097684997 153633.958252633: 7 cycles: ... ... Display data in babeltrace: # babeltrace --clock-date ./ctf [2020-07-13 18:38:50.097678523] (+?.?????????) cycles: { cpu_id = 0 }, { perf_ip = 0xFFF ... [2020-07-13 18:38:50.097682941] (+0.000004418) cycles: { cpu_id = 0 }, { perf_ip = 0xFFF ... [2020-07-13 18:38:50.097684997] (+0.000002056) cycles: { cpu_id = 0 }, { perf_ip = 0xFFF ... ... It's available only for recording with clockid specified, because it's the only case where we can get reference time to wallclock time. It's can't do that with perf clock yet. Error is display if you want to use --tod on data without clockid specified: # perf data convert --tod --to-ctf ./ctf Can't provide --tod time, missing clock data. Please record with -k/--clockid option. Failed to setup CTF writer. Error during conversion setup. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Geneviève Bastien <gbastien@versatic.net> Cc: Ian Rogers <irogers@google.com> Cc: Jeremie Galarneau <jgalar@efficios.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lore.kernel.org/lkml/20200805093444.314999-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-data.c')
-rw-r--r--tools/perf/builtin-data.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index ca2fb44874e4..8d23b8d6ee8e 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('i', "input", &input_name, "file", "input file name"),
#ifdef HAVE_LIBBABELTRACE_SUPPORT
OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"),
+ OPT_BOOLEAN(0, "tod", &opts.tod, "Convert time to wall clock time"),
#endif
OPT_BOOLEAN('f', "force", &opts.force, "don't complain, do it"),
OPT_BOOLEAN(0, "all", &opts.all, "Convert all events"),