Skip to content

Commit

Permalink
tools: sof_perf_analyzer: remove skip to first trace option
Browse files Browse the repository at this point in the history
CI performance test is failing in recent daily build, this is
due to timestamp are aligned between kernel and SOF, details
are listed in below link.

The firmware timestamp is in sync with the host side now,
and becomes much more deterministic. The condition to use
--skip-to-first-trace option in CI is eliminated (see the help
info for the reason it is used in CI test).

Based on this, skip-to-first-trace are not needed anymore,
hence remove it from the script.

Link: thesofproject/sof#8480

Signed-off-by: Baofeng Tian <[email protected]>
  • Loading branch information
btian1 committed Jan 11, 2024
1 parent a4d3f24 commit 3947c34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
4 changes: 2 additions & 2 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -966,9 +966,9 @@ perf_analyze()
dlogi "Checking SOF component performance"
if [ -e "$LOG_ROOT/mtrace.txt" ]; then
if [ -e "$LOG_ROOT/dmesg.txt" ]; then
perf_cmd="sof_perf_analyzer.py --skip-to-first-trace --kmsg=$LOG_ROOT/dmesg.txt --out2html $LOG_ROOT/sof_perf.html $LOG_ROOT/mtrace.txt"
perf_cmd="sof_perf_analyzer.py --kmsg=$LOG_ROOT/dmesg.txt --out2html $LOG_ROOT/sof_perf.html $LOG_ROOT/mtrace.txt"
else
perf_cmd="sof_perf_analyzer.py --skip-to-first-trace --out2html $LOG_ROOT/sof_perf.html $LOG_ROOT/mtrace.txt"
perf_cmd="sof_perf_analyzer.py --out2html $LOG_ROOT/sof_perf.html $LOG_ROOT/mtrace.txt"
fi
dlogc "$perf_cmd"
eval "$perf_cmd" || {
Expand Down
26 changes: 1 addition & 25 deletions tools/sof_perf_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ def dispatch_trace_item(trace_item: TraceItem):
if trace_item.func == 'comp_copy':
collect_perf_info(trace_item)

def skip_to_first_trace(trace_item_gen: TraceItemGenerator):
'''The current sof-test test case may collect some traces belonging to previous
test case due to mtrace is configured in deferred mode. This function consumes
those traces from the generator, and return the first trace item of current test.
'''
while item := next(trace_item_gen):
# On test running, the SOF firmware is reloaded to DSP, timer is reset to 0.
# The first trace must have a timestamp with integral part equals to 0.
if int(item.timestamp) == 0:
return item

def make_trace_item(fileio: TextIO) -> TraceItemGenerator:
'''Filter and parse a line of trace in string form into TraceItem object, for example:
'[ 2.566046] <inf> component: comp_copy: comp:0 0x40000 perf comp_copy samples
Expand Down Expand Up @@ -155,15 +144,7 @@ def process_trace_file():
ts_shift = 0
with open(args.filename, 'r', encoding='utf8') as file:
trace_item_gen = make_trace_item(file)
trace_prev = None
try:
if args.skip_to_first_trace:
trace_prev = skip_to_first_trace(trace_item_gen)
else:
trace_prev = next(trace_item_gen)
except StopIteration as si:
si.args = ('No valid trace in provided file',)
raise
trace_prev = next(trace_item_gen)
for trace_curr in trace_item_gen:
# pylint: disable=W0603
old_ts_shift = ts_shift
Expand Down Expand Up @@ -279,11 +260,6 @@ def parse_args():
help='Output SOF performance statistics to csv file')
parser.add_argument('--out2html', type=pathlib.Path, required=False,
help='Output SOF performance statistics to html file')
parser.add_argument('-s', '--skip-to-first-trace', action="store_true", default=False,
help='''In CI test, some traces from previous test case will appear in
the mtrace of current test case, this flag is used to denote if we
want to skip until the first line with a timestamp between 0 and 1s.
For CI test, set the flag to True''')

return parser.parse_args()

Expand Down

0 comments on commit 3947c34

Please sign in to comment.