Skip to content

Commit 78efa7b

Browse files
Leo Yannamhyung
authored andcommitted
perf cs-etm: Respect timestamp option
When users pass the option '--timestamp' or '-T' in the record command, all events will set the PERF_SAMPLE_TIME bit in the attribution. In this case, the AUX event will record the kernel timestamp, but it doesn't mean Arm CoreSight enables timestamp packets in its hardware tracing. If the option '--timestamp' or '-T' is set, this patch always enables Arm CoreSight timestamp, as a result, the bit 28 in event's config is to be set. Before: # perf record -e cs_etm// --per-thread --timestamp -- ls # perf script --header-only ... # event : name = cs_etm//, , id = { 69 }, type = 12, size = 136, config = 0, { sample_period, sample_freq } = 1, sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 ... After: # perf record -e cs_etm// --per-thread --timestamp -- ls # perf script --header-only ... # event : name = cs_etm//, , id = { 49 }, type = 12, size = 136, config = 0x10000000, { sample_period, sample_freq } = 1, sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 ... Signed-off-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: James Clark <james.clark@arm.com> Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: John Garry <john.g.garry@oracle.com> Cc: linux-arm-kernel@lists.infradead.org Cc: coresight@lists.linaro.org Link: https://lore.kernel.org/r/20231014074159.1667880-3-leo.yan@linaro.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent f8ccc2d commit 78efa7b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tools/perf/arch/arm/util/cs-etm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,15 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
442442
"contextid", 1);
443443
}
444444

445+
/*
446+
* When the option '--timestamp' or '-T' is enabled, the PERF_SAMPLE_TIME
447+
* bit is set for all events. In this case, always enable Arm CoreSight
448+
* timestamp tracing.
449+
*/
450+
if (opts->sample_time_set)
451+
evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
452+
"timestamp", 1);
453+
445454
/* Add dummy event to keep tracking */
446455
err = parse_event(evlist, "dummy:u");
447456
if (err)

0 commit comments

Comments
 (0)