lkml.org 
[lkml]   [2021]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/6] perf arm-spe: Save clock parameters from TIME_CONV event
Date
During the recording phase, "perf record" tool synthesizes event
PERF_RECORD_TIME_CONV for the hardware clock parameters and saves the
event into the data file.

Afterwards, when processing the data file, the event TIME_CONV will be
processed at the very early time and is stored into session context.

This patch extracts these parameters from the session context and saves
into the structure "spe->tc" with the type perf_tsc_conversion, so that
the parameters are ready for conversion between clock counter and time
stamp.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/arm-spe.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index 2539d4baec44..b48816d5c0b4 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -26,6 +26,7 @@
#include "symbol.h"
#include "thread.h"
#include "thread-stack.h"
+#include "tsc.h"
#include "tool.h"
#include "util/synthetic-events.h"

@@ -45,6 +46,8 @@ struct arm_spe {
struct machine *machine;
u32 pmu_type;

+ struct perf_tsc_conversion tc;
+
u8 timeless_decoding;
u8 data_queued;

@@ -1027,6 +1030,22 @@ int arm_spe_process_auxtrace_info(union perf_event *event,
spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE];

spe->timeless_decoding = arm_spe__is_timeless_decoding(spe);
+
+ /*
+ * The synthesized event PERF_RECORD_TIME_CONV has been handled
+ * ahead and the parameters for hardware clock are stored in
+ * the session context. Passes these parameters to the structure
+ * perf_tsc_conversion in "spe->tc", which is used for later
+ * conversion between clock counter and timestamp.
+ */
+ spe->tc.time_shift = session->time_conv.time_shift;
+ spe->tc.time_mult = session->time_conv.time_mult;
+ spe->tc.time_zero = session->time_conv.time_zero;
+ spe->tc.time_cycles = session->time_conv.time_cycles;
+ spe->tc.time_mask = session->time_conv.time_mask;
+ spe->tc.cap_user_time_zero = session->time_conv.cap_user_time_zero;
+ spe->tc.cap_user_time_short = session->time_conv.cap_user_time_short;
+
spe->auxtrace.process_event = arm_spe_process_event;
spe->auxtrace.process_auxtrace_event = arm_spe_process_auxtrace_event;
spe->auxtrace.flush_events = arm_spe_flush;
--
2.25.1
\
 
 \ /
  Last update: 2021-04-10 07:02    [W:0.071 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site