mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 10:10:46 +00:00
ftrace: Add tracer name validation
Check that the asked tracer is supported by the kernel. Signed-off-by: Douglas RAILLARD <douglas.raillard@arm.com>
This commit is contained in:
parent
6b0b12d833
commit
656da00d2a
@ -25,7 +25,7 @@ from pipes import quote
|
|||||||
from devlib.trace import TraceCollector
|
from devlib.trace import TraceCollector
|
||||||
from devlib.host import PACKAGE_BIN_DIRECTORY
|
from devlib.host import PACKAGE_BIN_DIRECTORY
|
||||||
from devlib.exception import TargetStableError, HostError
|
from devlib.exception import TargetStableError, HostError
|
||||||
from devlib.utils.misc import check_output, which
|
from devlib.utils.misc import check_output, which, memoized
|
||||||
|
|
||||||
|
|
||||||
TRACE_MARKER_START = 'TRACE_MARKER_START'
|
TRACE_MARKER_START = 'TRACE_MARKER_START'
|
||||||
@ -105,6 +105,7 @@ class FtraceCollector(TraceCollector):
|
|||||||
self.ftrace_filter_file = self.target.path.join(self.tracing_path, 'set_ftrace_filter')
|
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.trace_clock_file = self.target.path.join(self.tracing_path, 'trace_clock')
|
||||||
self.save_cmdlines_size_file = self.target.path.join(self.tracing_path, 'saved_cmdlines_size')
|
self.save_cmdlines_size_file = self.target.path.join(self.tracing_path, 'saved_cmdlines_size')
|
||||||
|
self.available_tracers_file = self.target.path.join(self.tracing_path, 'available_tracers')
|
||||||
|
|
||||||
self.host_binary = which('trace-cmd')
|
self.host_binary = which('trace-cmd')
|
||||||
self.kernelshark = which('kernelshark')
|
self.kernelshark = which('kernelshark')
|
||||||
@ -143,6 +144,10 @@ class FtraceCollector(TraceCollector):
|
|||||||
else:
|
else:
|
||||||
selected_events.append(event)
|
selected_events.append(event)
|
||||||
|
|
||||||
|
if self.tracer and self.tracer not in self.available_tracers:
|
||||||
|
raise TargetStableError('Unsupported tracer "{}". Available tracers: {}'.format(
|
||||||
|
self.tracer, ', '.join(self.available_tracers)))
|
||||||
|
|
||||||
# Check for function tracing support
|
# Check for function tracing support
|
||||||
if self.functions:
|
if self.functions:
|
||||||
if not self.target.file_exists(self.function_profile_file):
|
if not self.target.file_exists(self.function_profile_file):
|
||||||
@ -175,6 +180,15 @@ class FtraceCollector(TraceCollector):
|
|||||||
|
|
||||||
self.event_string = _build_trace_events(selected_events)
|
self.event_string = _build_trace_events(selected_events)
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
@memoized
|
||||||
|
def available_tracers(self):
|
||||||
|
"""
|
||||||
|
List of ftrace tracers supported by the target's kernel.
|
||||||
|
"""
|
||||||
|
return self.target.read_value(self.available_tracers_file).split(' ')
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
if self.buffer_size:
|
if self.buffer_size:
|
||||||
self._set_buffer_size()
|
self._set_buffer_size()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user