Skip to content

Conversation

@ekurdybx
Copy link
Contributor

@ekurdybx ekurdybx commented Feb 3, 2026

In case of a faulty mtrace line the sof_perf_analyzer.py script will log warning and move on, instead of failing the script (and the test).

@ekurdybx ekurdybx requested review from a team, golowanow, lgirdwood and marc-hb as code owners February 3, 2026 12:52
@ekurdybx ekurdybx force-pushed the fix-mtrace-ignore-faulty-lines branch from 85f5396 to 8f5f5a3 Compare February 3, 2026 12:54
@ekurdybx ekurdybx changed the title fix: tools: make faulty mtrace lines not exit script fix: tools: faulty mtrace lines do not fail script Feb 3, 2026
@ekurdybx ekurdybx force-pushed the fix-mtrace-ignore-faulty-lines branch 2 times, most recently from e24b25e to 0fcba1f Compare February 3, 2026 14:12
ctx, func = rest[0:2]
msg = ': '.join(rest[2:]).strip()
yield TraceItem(timestamp, trace_lvl, ctx, func, msg)
except Exception as e: # pylint: disable=W0718
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ironic how W0718 warns about precisely the type of "green failure" issues that this PR is trying to fix... Why not simply catch the specific parsing exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This script is a additional tool for getting stats from mtrace file, not a main test. That's why we decided to "ignore" lines that couldn't be parsed for whatever reason - hence the broad exception.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are missing the point. There is a limited number of parsing exception types this small piece of code can raise and that can be expected here. It would be easy to list them here. Catching any exception instead, including unexpected exceptions unrelated to parsing means hiding bugs in this code. This is what W0718 means.

Amusingly, this is a similar sort of issue that this PR is fixing.

hours=int(h),
minutes=int(m),
seconds=float(s)
).total_seconds()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the timestamp parsing has become long enough to deserve its own, separate function. The nesting of try blocks and the significant indentation make the code less readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

In case of a faulty line in mtrace, the sof_perf_analyzer.py script will
log a warning and move on, instead of failing.

Signed-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
@ekurdybx ekurdybx force-pushed the fix-mtrace-ignore-faulty-lines branch from 0fcba1f to e06f756 Compare February 5, 2026 15:20
@KamilxPaszkiet KamilxPaszkiet merged commit da3d9af into thesofproject:main Feb 6, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants