1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-25 20:18:47 +00:00

instruments/trace_cmd: Add tracing mode support to TraceCmdInstrument()

Implement tracing mode support (mainly for write-to-disk mode) in
TraceCmdInstrument, enabling efficient collection of large trace
datasets without encountering memory limitations.

This feature is particularly useful for scenarios requiring extensive
trace data.

Additional changes:
- Replace hardcoded strings with corresponding string literals for
  improved maintainability.

Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
Metin Kaya 2025-01-29 16:01:43 +00:00 committed by Marc Bonnici
parent f125fd340d
commit b03f28d1d5
3 changed files with 14 additions and 2 deletions

View File

@ -400,6 +400,7 @@ below:
no_install: false no_install: false
report: true report: true
report_on_target: false report_on_target: false
mode: write-to-memory
csv: csv:
extra_columns: null extra_columns: null
use_all_classifiers: false use_all_classifiers: false

View File

@ -45,6 +45,7 @@ An example agenda can be seen here:
no_install: false no_install: false
report: true report: true
report_on_target: false report_on_target: false
mode: write-to-disk
csv: # Provide config for the csv augmentation csv: # Provide config for the csv augmentation
use_all_classifiers: true use_all_classifiers: true

View File

@ -162,6 +162,13 @@ class TraceCmdInstrument(Instrument):
installed on the host (the one in your installed on the host (the one in your
distribution's repos may be too old). distribution's repos may be too old).
"""), """),
Parameter('mode', kind=str, default='write-to-memory',
allowed_values=['write-to-disk', 'write-to-memory'],
description="""
Specifies whether collected traces should be saved in memory or disk.
Extensive workloads may hit out of memory issue. Hence, write-to-disk
mode can help in such cases.
"""),
] ]
def __init__(self, target, **kwargs): def __init__(self, target, **kwargs):
@ -183,6 +190,7 @@ class TraceCmdInstrument(Instrument):
no_install=self.no_install, no_install=self.no_install,
strict=False, strict=False,
report_on_target=False, report_on_target=False,
mode=self.mode,
) )
if self.report and self.report_on_target: if self.report and self.report_on_target:
collector_params['autoreport'] = True collector_params['autoreport'] = True
@ -215,12 +223,14 @@ class TraceCmdInstrument(Instrument):
if not self.collector: if not self.collector:
return return
self.logger.info('Extracting trace from target...') self.logger.info('Extracting trace from target...')
outfile = os.path.join(context.output_directory, 'trace.dat') outfile = os.path.join(context.output_directory, OUTPUT_TRACE_FILE)
self.collector.set_output(outfile) self.collector.set_output(outfile)
self.collector.get_data() self.collector.get_data()
context.add_artifact('trace-cmd-bin', outfile, 'data') context.add_artifact('trace-cmd-bin', outfile, 'data')
if self.report: if self.report:
textfile = os.path.join(context.output_directory, 'trace.txt') textfile = os.path.join(context.output_directory, OUTPUT_TEXT_FILE)
if not self.report_on_target: if not self.report_on_target:
self.collector.report(outfile, textfile) self.collector.report(outfile, textfile)
context.add_artifact('trace-cmd-txt', textfile, 'export') context.add_artifact('trace-cmd-txt', textfile, 'export')