From def235064bcc880fa8b9fd4a0c2bd52f9a03c82f Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Thu, 31 Oct 2019 16:20:53 +0000 Subject: [PATCH] ftrace: Allow choosing clock source trace-cmd start -C allows selecting the ftrace clock. Expose that in FtraceCollector API. Signed-off-by: Douglas RAILLARD --- devlib/trace/ftrace.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devlib/trace/ftrace.py b/devlib/trace/ftrace.py index 3a0b513..ffe80d3 100644 --- a/devlib/trace/ftrace.py +++ b/devlib/trace/ftrace.py @@ -63,6 +63,7 @@ class FtraceCollector(TraceCollector): no_install=False, strict=False, report_on_target=False, + trace_clock='local', ): super(FtraceCollector, self).__init__(target) self.events = events if events is not None else DEFAULT_EVENTS @@ -83,6 +84,7 @@ class FtraceCollector(TraceCollector): self.stop_time = None self.event_string = None self.function_string = None + self.trace_clock = trace_clock self._reset_needed = True # pylint: disable=bad-whitespace @@ -94,6 +96,7 @@ class FtraceCollector(TraceCollector): self.function_profile_file = self.target.path.join(self.tracing_path, 'function_profile_enabled') self.marker_file = self.target.path.join(self.tracing_path, 'trace_marker') self.ftrace_filter_file = self.target.path.join(self.tracing_path, 'set_ftrace_filter') + self.trace_clock_file = self.target.path.join(self.tracing_path, 'trace_clock') self.host_binary = which('trace-cmd') self.kernelshark = which('kernelshark') @@ -170,6 +173,8 @@ class FtraceCollector(TraceCollector): self.start_time = time.time() if self._reset_needed: self.reset() + + self.target.write_value(self.trace_clock_file, self.trace_clock, verify=False) self.target.execute('{} start {}'.format(self.target_binary, self.event_string), as_root=True) if self.automark: