mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +00:00
collector: ftrace: Use trace-cmd start -b
Avoid manually setting the buffer size since trace-cmd start can do it directly.
This commit is contained in:
parent
cdceba59ba
commit
27616813ea
@ -77,7 +77,6 @@ class FtraceCollector(CollectorBase):
|
||||
self.tracer = tracer
|
||||
self.trace_children_functions = trace_children_functions
|
||||
self.buffer_size = buffer_size
|
||||
self.buffer_size_step = buffer_size_step
|
||||
self.tracing_path = tracing_path
|
||||
self.automark = automark
|
||||
self.autoreport = autoreport
|
||||
@ -102,7 +101,6 @@ class FtraceCollector(CollectorBase):
|
||||
# Setup tracing paths
|
||||
self.available_events_file = self.target.path.join(self.tracing_path, 'available_events')
|
||||
self.available_functions_file = self.target.path.join(self.tracing_path, 'available_filter_functions')
|
||||
self.buffer_size_file = self.target.path.join(self.tracing_path, 'buffer_size_kb')
|
||||
self.current_tracer_file = self.target.path.join(self.tracing_path, 'current_tracer')
|
||||
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')
|
||||
@ -223,8 +221,6 @@ class FtraceCollector(CollectorBase):
|
||||
return self.target.read_value(self.available_functions_file).splitlines()
|
||||
|
||||
def reset(self):
|
||||
if self.buffer_size:
|
||||
self._set_buffer_size()
|
||||
self.target.execute('{} reset'.format(self.target_binary),
|
||||
as_root=True, timeout=TIMEOUT)
|
||||
if self.functions:
|
||||
@ -261,11 +257,12 @@ class FtraceCollector(CollectorBase):
|
||||
self.logger.debug(e)
|
||||
|
||||
self.target.execute(
|
||||
'{} start {events} {tracer} {functions}'.format(
|
||||
'{} start {buffer_size} {events} {tracer} {functions}'.format(
|
||||
self.target_binary,
|
||||
events=self.event_string,
|
||||
tracer=tracer_string,
|
||||
functions=tracecmd_functions,
|
||||
buffer_size='-b {}'.format(self.buffer_size) if self.buffer_size is not None else '',
|
||||
),
|
||||
as_root=True,
|
||||
)
|
||||
@ -426,29 +423,6 @@ class FtraceCollector(CollectorBase):
|
||||
def mark_stop(self):
|
||||
self.target.write_value(self.marker_file, TRACE_MARKER_STOP, verify=False)
|
||||
|
||||
def _set_buffer_size(self):
|
||||
target_buffer_size = self.buffer_size
|
||||
attempt_buffer_size = target_buffer_size
|
||||
buffer_size = 0
|
||||
floor = 1000 if target_buffer_size > 1000 else target_buffer_size
|
||||
while attempt_buffer_size >= floor:
|
||||
self.target.write_value(self.buffer_size_file, attempt_buffer_size, verify=False)
|
||||
buffer_size = self.target.read_int(self.buffer_size_file)
|
||||
if buffer_size == attempt_buffer_size:
|
||||
break
|
||||
else:
|
||||
attempt_buffer_size -= self.buffer_size_step
|
||||
if buffer_size == target_buffer_size:
|
||||
return
|
||||
while attempt_buffer_size < target_buffer_size:
|
||||
attempt_buffer_size += self.buffer_size_step
|
||||
self.target.write_value(self.buffer_size_file, attempt_buffer_size, verify=False)
|
||||
buffer_size = self.target.read_int(self.buffer_size_file)
|
||||
if attempt_buffer_size != buffer_size:
|
||||
message = 'Failed to set trace buffer size to {}, value set was {}'
|
||||
self.logger.warning(message.format(target_buffer_size, buffer_size))
|
||||
break
|
||||
|
||||
|
||||
def _build_trace_events(events):
|
||||
event_string = ' '.join(['-e {}'.format(e) for e in events])
|
||||
|
Loading…
x
Reference in New Issue
Block a user