Skip to content

fix: tools: sof_perf_analyzer: ignore errors when decoding mtrace file#1357

Merged
ekurdybx merged 1 commit intothesofproject:mainfrom
ekurdybx:fix-sof-perf-analyzer
Apr 9, 2026
Merged

fix: tools: sof_perf_analyzer: ignore errors when decoding mtrace file#1357
ekurdybx merged 1 commit intothesofproject:mainfrom
ekurdybx:fix-sof-perf-analyzer

Conversation

@ekurdybx
Copy link
Copy Markdown
Contributor

@ekurdybx ekurdybx commented Apr 7, 2026

Add ignore errors option when decoding mtrace file in sof_perf_analyzer.py script.

@ekurdybx ekurdybx force-pushed the fix-sof-perf-analyzer branch 2 times, most recently from 72ec037 to 0189a9b Compare April 7, 2026 11:50
@ekurdybx ekurdybx marked this pull request as ready for review April 7, 2026 13:05
@ekurdybx ekurdybx requested review from a team, golowanow, lgirdwood and marc-hb as code owners April 7, 2026 13:05
Copy link
Copy Markdown
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A commit message would not hurt?

# pylint: disable=C0103
ts_shift = 0
with open(args.filename, 'r', encoding='utf8') as file:
with open(args.filename, 'r', encoding='utf8', errors='ignore') as file:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with open(args.filename, 'r', encoding='utf8', errors='ignore') as file:
with open(args.filename, 'r', encoding='utf8', errors='backslashreplace') as file:

ignore = "ignore bugs".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backslashreplace is only supported for writing to the file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backslashreplace is only supported for writing to the file

I just tried it and it worked4me. There is also replace and a few others that don't hide corrupted input -> much more time-consuming if something goes wrong.

if ! perf_analyze; then
exit_status=1
fi
perf_analyze
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
perf_analyze
perf_analyze || dlogw 'perf_analyze failed in exit handler'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok done

eval "$perf_cmd" || {
dloge "SOF component performace analysis tool exit with error"
return 1
dlogw "SOF component performace analysis tool exit with error"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more flexible and future-proof to leave that decision to the caller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done

@ekurdybx ekurdybx force-pushed the fix-sof-perf-analyzer branch from 0189a9b to 838989c Compare April 9, 2026 10:11
Ignore faulty lines in mtrace file when analyzing it with
sof_perf_analyzer.py script

Signed-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
@ekurdybx ekurdybx force-pushed the fix-sof-perf-analyzer branch from 838989c to b127ff9 Compare April 9, 2026 10:13
@ekurdybx ekurdybx merged commit 37fb5cc into thesofproject:main Apr 9, 2026
3 of 8 checks passed
@ekurdybx ekurdybx deleted the fix-sof-perf-analyzer branch April 9, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants