[PATCH v3 03/18] perf cs-etm: Turn on context packet timestamps in per-thread mode
James Clark
james.clark at linaro.org
Mon Nov 2 04:15:17 PST 2026
Practically this costs nothing and preempts future changes that will be
made to support decoding trace in order with Perf MMAP and JIT events.
It also helps keep samples in order when we add support for multiple
per-thread mode threads in the next commit.
Signed-off-by: James Clark <james.clark at linaro.org>
---
tools/perf/arch/arm/util/cs-etm.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index acfdb3f53821..47b4e386cc53 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -453,13 +453,26 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
*/
evsel__set_sample_bit(cs_etm_evsel, CPU);
- /*
- * Also the case of per-cpu mmaps, need the contextID in order to be notified
- * when a context switch happened.
- */
if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
+ /*
+ * Timestamps are required to interleave samples from different
+ * CPUs.
+ */
evsel__set_config_if_unset(cs_etm_evsel, "timestamp", 1);
+ /* Context IDs are required to associate trace to a process */
evsel__set_config_if_unset(cs_etm_evsel, "contextid", 1);
+ } else {
+ /*
+ * Disable periodic timestamps but generate timestamps for trace
+ * synchronization. Even in per-thread mode with a single
+ * process we still need to correlate trace to a specific mmap
+ * around execs, which can be done with only timestamps of trace
+ * synchronization.
+ *
+ * Use MAX to support the kernel widening the field in the
+ * future.
+ */
+ evsel__set_config_if_unset(cs_etm_evsel, "timestamp", UINT64_MAX);
}
/*
--
2.43.0
More information about the linux-arm-kernel
mailing list