alistair23-linux/tools/perf
Jiri Olsa 88371c5898 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>
2020-08-06 09:43:37 -03:00
..
arch Mgerge remote-tracking branch 'torvalds/master' into perf/core 2020-08-06 08:15:47 -03:00
bench perf bench: Add benchmark of find_next_bit 2020-07-31 09:32:11 -03:00
Documentation perf data: Add support to store time of day in CTF data conversion 2020-08-06 09:43:37 -03:00
examples/bpf
include/bpf
jvmti perf jvmti: Remove redundant jitdump line table entries 2020-05-29 16:51:38 -03:00
pmu-events Merge remote-tracking branch 'torvalds/master' into perf/core 2020-08-03 09:37:31 -03:00
python
scripts perf scripts python: exported-sql-viewer.py: Fix time chart call tree 2020-07-03 08:19:52 -03:00
tests Merge remote-tracking branch 'torvalds/master' into perf/core 2020-08-03 09:37:31 -03:00
trace perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument 2020-06-09 12:40:03 -03:00
ui Merge remote-tracking branch 'torvalds/master' into perf/core 2020-07-08 13:49:15 -03:00
util perf data: Add support to store time of day in CTF data conversion 2020-08-06 09:43:37 -03:00
.gitignore
Build
builtin-annotate.c perf evsel: Rename perf_evsel__resort*() to evsel__resort*() 2020-05-28 10:03:24 -03:00
builtin-bench.c perf bench: Add benchmark of find_next_bit 2020-07-31 09:32:11 -03:00
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c perf evlist: Fix the class prefix for 'struct evlist' sample_type methods 2020-06-22 16:28:09 -03:00
builtin-config.c
builtin-data.c perf data: Add support to store time of day in CTF data conversion 2020-08-06 09:43:37 -03:00
builtin-diff.c perf evsel: Rename perf_evsel__is_*() to evsel__is*() 2020-05-05 16:35:31 -03:00
builtin-evlist.c perf evsel: Rename perf_evsel__fprintf() to evsel__fprintf() 2020-05-28 10:03:24 -03:00
builtin-ftrace.c perf ftrace: Detect workload failure 2020-05-28 10:03:27 -03:00
builtin-help.c
builtin-inject.c perf inject jit: Remove //anon mmap events 2020-07-08 13:51:12 -03:00
builtin-kallsyms.c
builtin-kmem.c perf kmem: Pass additional arguments to 'perf record' 2020-07-10 09:37:55 -03:00
builtin-kvm.c perf evlist: Fix the class prefix for 'struct evlist' 'add' evsel methods 2020-06-22 16:28:09 -03:00
builtin-list.c perf list: Add metrics to command line usage 2020-05-28 10:03:28 -03:00
builtin-lock.c perf lock: Rename perf_evsel__*() operating on 'struct evsel *' to evsel__*() 2020-05-05 16:35:31 -03:00
builtin-mem.c perf c2c: Fix 'perf c2c record -e list' to show the default events used 2020-05-28 10:03:25 -03:00
builtin-probe.c perf probe: Do not show the skipped events 2020-05-28 10:03:24 -03:00
builtin-record.c perf tools: Move clockid_res_ns under clock struct 2020-08-06 09:42:20 -03:00
builtin-report.c perf evlist: Fix the class prefix for 'struct evlist' branch_type methods 2020-06-22 16:28:10 -03:00
builtin-sched.c perf sched: Rename perf_evsel__*() operating on 'struct evsel *' to evsel__*() 2020-05-05 16:35:31 -03:00
builtin-script.c perf script: Show text poke address symbol 2020-07-10 08:39:14 -03:00
builtin-stat.c perf stat: Introduce --control fd:ctl-fd[,ack-fd] options 2020-08-04 08:48:58 -03:00
builtin-timechart.c perf tools: Replace zero-length array with flexible-array 2020-05-28 10:03:27 -03:00
builtin-top.c perf evlist: Fix the class prefix for 'struct evlist' 'add' evsel methods 2020-06-22 16:28:09 -03:00
builtin-trace.c perf record: Extend -D,--delay option with -1 value 2020-08-04 08:50:04 -03:00
builtin-version.c
builtin.h
check-headers.sh perf tools: Grab a copy of libbpf's hashmap 2020-05-28 10:03:26 -03:00
command-list.txt
CREDITS
design.txt
Makefile
Makefile.config perf build: Fix error message when asking for -fsanitize=address without required libraries 2020-06-18 10:34:31 -03:00
Makefile.perf perf tools: Add optional support for libpfm4 2020-05-29 16:51:38 -03:00
MANIFEST
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf.h