1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-29 14:14:06 +00:00

Added option to re-open files to poller.

Some times a sysfs/debug fs will only generate a value on open. Subsequent seek/read will not vield any new values. This patch adds the option to reopen all files on each read.
This commit is contained in:
Sebastian Goscik
2025-02-28 16:14:59 +00:00
committed by Marc Bonnici
parent 8598d1ba3c
commit 2d14c82f92
4 changed files with 39 additions and 11 deletions

View File

@@ -59,6 +59,12 @@ class FilePoller(Instrument):
Whether or not the poller will be run as root. This should be
used when the file you need to poll can only be accessed by root.
"""),
Parameter('reopen', kind=bool, default=False,
description="""
When enabled files will be re-opened with each read. This is
useful for some sysfs/debugfs entries that only generate a
value when opened.
"""),
]
def validate(self):
@@ -91,13 +97,17 @@ class FilePoller(Instrument):
if self.align_with_ftrace:
marker_option = '-m'
signal.connect(self._adjust_timestamps, signal.AFTER_JOB_OUTPUT_PROCESSED)
self.command = '{} -t {} {} -l {} {} > {} 2>{}'.format(target_poller,
self.sample_interval * 1000,
marker_option,
','.join(self.labels),
' '.join(self.files),
self.target_output_path,
self.target_log_path)
reopen_option = ''
if self.reopen:
reopen_option = '-r'
self.command = '{} {} -t {} {} -l {} {} > {} 2>{}'.format(target_poller,
reopen_option,
self.sample_interval * 1000,
marker_option,
','.join(self.labels),
' '.join(self.files),
self.target_output_path,
self.target_log_path)
def start(self, context):
self.target.kick_off(self.command, as_root=self.as_root)