perf arm-spe: Convert event kernel time to counter value
authorLeo Yan <leo.yan@linaro.org>
Wed, 19 May 2021 07:19:36 +0000 (15:19 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 1 Jul 2021 19:14:36 +0000 (16:14 -0300)
When handle a perf event, Arm SPE decoder needs to decide if this perf
event is earlier or later than the samples from Arm SPE trace data; to
do comparision, it needs to use the same unit for the time.

This patch converts the event kernel time to arch timer's counter value,
thus it can be used to compare with counter value contained in Arm SPE
Timestamp packet.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: James Clark <james.clark@arm.com>
Tested-by: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Al Grant <Al.Grant@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20210519071939.1598923-3-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/arm-spe.c

index d2ae5a5..ff8b52e 100644 (file)
@@ -669,7 +669,7 @@ static int arm_spe_process_event(struct perf_session *session,
        }
 
        if (sample->time && (sample->time != (u64) -1))
-               timestamp = sample->time;
+               timestamp = perf_time_to_tsc(sample->time, &spe->tc);
        else
                timestamp = 0;