1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 12:06:08 +00:00

instruments/trace_cmd: Handle setup failure

In the case that the trace_cmd collector fails to
initialise, do not attempt to use the collector in
subsequent methods.
This commit is contained in:
Marc Bonnici 2022-04-26 14:30:04 +01:00
parent 40a118c8cd
commit 37346fe1b1

View File

@ -190,17 +190,22 @@ class TraceCmdInstrument(Instrument):
signal.connect(self.mark_stop, signal.AFTER_WORKLOAD_EXECUTION, priority=11)
def setup(self, context):
self.collector.reset()
if self.collector:
self.collector.reset()
@very_slow
def start(self, context):
self.collector.start()
if self.collector:
self.collector.start()
@very_slow
def stop(self, context):
self.collector.stop()
if self.collector:
self.collector.stop()
def update_output(self, context): # NOQA pylint: disable=R0912
if not self.collector:
return
self.logger.info('Extracting trace from target...')
outfile = os.path.join(context.output_directory, 'trace.dat')
self.collector.set_output(outfile)