perf auxtrace: Add 'T' itrace option for timestamp trace
authorLeo Yan <leo.yan@linaro.org>
Sat, 14 Oct 2023 07:45:12 +0000 (15:45 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 27 Nov 2023 13:21:27 +0000 (10:21 -0300)
An AUX trace can contain timestamp, but in some situations, the hardware
trace module (e.g. Arm CoreSight) cannot decide the traced timestamp is
the same source with CPU's time, thus the decoder can not use the
timestamp trace for samples.

This patch introduces 'T' itrace option. If users know the platforms
they are working on have the same time counter with CPUs, users can
use this new option to tell a decoder for using timestamp trace as
kernel time.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20231014074513.1668000-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/itrace.txt
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h

index a97f95825b14e8b77186587ad4f19bf2766d7e8c..19cc179be9a784708492f18a94f06752b33c49f6 100644 (file)
@@ -25,6 +25,7 @@
                q       quicker (less detailed) decoding
                A       approximate IPC
                Z       prefer to ignore timestamps (so-called "timeless" decoding)
+               T       use the timestamp trace as kernel time
 
        The default is all events i.e. the same as --itrace=iybxwpe,
        except for perf script where it is --itrace=ce
index a0368202a746ab6c046eed1a3b8bfb671af71456..f528c4364d23588c12d96ff9caa746c559ca5563 100644 (file)
@@ -1638,6 +1638,9 @@ int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts,
                case 'Z':
                        synth_opts->timeless_decoding = true;
                        break;
+               case 'T':
+                       synth_opts->use_timestamp = true;
+                       break;
                case ' ':
                case ',':
                        break;
index 29eb82dff5749c44afa6200dfe3894e64be5258b..55702215a82d31c1a519dde9df327d276adc5c2f 100644 (file)
@@ -99,6 +99,7 @@ enum itrace_period_type {
  * @remote_access: whether to synthesize remote access events
  * @mem: whether to synthesize memory events
  * @timeless_decoding: prefer "timeless" decoding i.e. ignore timestamps
+ * @use_timestamp: use the timestamp trace as kernel time
  * @vm_time_correlation: perform VM Time Correlation
  * @vm_tm_corr_dry_run: VM Time Correlation dry-run
  * @vm_tm_corr_args:  VM Time Correlation implementation-specific arguments
@@ -146,6 +147,7 @@ struct itrace_synth_opts {
        bool                    remote_access;
        bool                    mem;
        bool                    timeless_decoding;
+       bool                    use_timestamp;
        bool                    vm_time_correlation;
        bool                    vm_tm_corr_dry_run;
        char                    *vm_tm_corr_args;
@@ -678,6 +680,7 @@ bool auxtrace__evsel_is_auxtrace(struct perf_session *session,
 "                              q:                      quicker (less detailed) decoding\n" \
 "                              A:                      approximate IPC\n" \
 "                              Z:                      prefer to ignore timestamps (so-called \"timeless\" decoding)\n" \
+"                              T:                      use the timestamp trace as kernel time\n" \
 "                              PERIOD[ns|us|ms|i|t]:   specify period to sample stream\n" \
 "                              concatenate multiple options. Default is iybxwpe or cewp\n"