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 30, 2023
1 parent dd2bbb5 commit 1c6b2c6
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 All @@ -98,6 +99,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_working_directory = self.target.execute("{} mktemp -p {} -d".format(
Expand Down Expand Up @@ -292,9 +294,10 @@ async def start(self):
)

if self.trace_cmd_mode == 'record':
trace_cmd = "cd {} && {command} {output}".format(
trace_cmd = "cd {} && {command} {interval} {output}".format(
self.tmp_working_directory,
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 1c6b2c6

Please sign in to comment.