mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
trace/ftrace: Memoize tracable functions
This is similar to what is already done for events and tracers. Also, use this opportunity to use read_value() instead of target.execute('cat {}').
This commit is contained in:
parent
72be3d01f8
commit
e7bd2a5b22
@ -162,13 +162,10 @@ class FtraceCollector(TraceCollector):
|
||||
# Check for function tracing support
|
||||
if self.functions:
|
||||
# Validate required functions to be traced
|
||||
available_functions = self.target.execute(
|
||||
'cat {}'.format(self.available_functions_file),
|
||||
as_root=True).splitlines()
|
||||
selected_functions = []
|
||||
for function in self.functions:
|
||||
if function not in available_functions:
|
||||
message = 'Function [{}] not available for profiling'.format(function)
|
||||
if function not in self.available_functions:
|
||||
message = 'Function [{}] not available for tracing/profiling'.format(function)
|
||||
if self.strict:
|
||||
raise TargetStableError(message)
|
||||
self.target.logger.warning(message)
|
||||
@ -209,6 +206,14 @@ class FtraceCollector(TraceCollector):
|
||||
"""
|
||||
return self.target.read_value(self.available_events_file).splitlines()
|
||||
|
||||
@property
|
||||
@memoized
|
||||
def available_functions(self):
|
||||
"""
|
||||
List of functions whose tracing/profiling is supported by the target's kernel.
|
||||
"""
|
||||
return self.target.read_value(self.available_functions_file).splitlines()
|
||||
|
||||
def reset(self):
|
||||
if self.buffer_size:
|
||||
self._set_buffer_size()
|
||||
|
Loading…
x
Reference in New Issue
Block a user