Skip to content

Commit

Permalink
ftrace: Allow setting the interval for record mode
Browse files Browse the repository at this point in the history
The trace-cmd record mode allows setting the interval to determine how
often it will write to the trace file. The default is 1000 (us, ie. 1ms).

Add a collector parameter to allow setting that interval. This will only
have an effect when trace_cmd_mode is 'record' as the option does not
exist for 'start' mode.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
  • Loading branch information
mrkajetanp committed Aug 23, 2023
1 parent 6048492 commit 0e4f086
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion devlib/collector/ftrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, target,
trace_clock='local',
saved_cmdlines_nr=4096,
trace_cmd_mode='start',
record_interval=1000,
):
super(FtraceCollector, self).__init__(target)
self.events = events if events is not None else DEFAULT_EVENTS
Expand Down Expand Up @@ -101,6 +102,7 @@ def __init__(self, target,
self.function_string = None
self.trace_clock = trace_clock
self.saved_cmdlines_nr = saved_cmdlines_nr
self.record_interval = record_interval
self._reset_needed = True
self.bg_cmd = None
self.tmp_output_dir = None
Expand Down Expand Up @@ -299,9 +301,10 @@ async def start(self):
self.target.busybox,
output_dir=self.target.working_directory,
)).strip()
trace_cmd = "cd {} && {command} {output}".format(
trace_cmd = "cd {} && {command} {interval} {output}".format(
self.tmp_output_dir,
command=trace_cmd,
interval="-s {}".format(self.record_interval),
output="-o {}".format(self.target_output_file)
)
if self.bg_cmd is None:
Expand Down

0 comments on commit 0e4f086

Please sign in to comment.