Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tools/sof_perf_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import re
import pathlib
import argparse
from datetime import timedelta
from typing import TextIO
from typing import Generator
from dataclasses import dataclass
Expand Down Expand Up @@ -135,7 +136,18 @@ def make_trace_item(fileio: TextIO) -> TraceItemGenerator:
# both some specific offset from the sentinel.
span_end_pos = match_obj.span()[1]
trace_lvl = line[span_end_pos - 4: span_end_pos - 1]
timestamp = float(line[span_end_pos - 19: span_end_pos - 7].strip())
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

The difference is caused by the Zephyr log timestamp format. It seems in some new targets, the time format is not set (default Zephyr format is used) and this breaks test. I now submitted a pull request to make the Linux format the default in Linux overlay thesofproject/sof#10501 .

I think it's still ok to have support for both widely used Zephyr timestamp formats in sof-test, but maybe a comment either in a comment or in the git commit would be good that the difference is caused by Zephyr build options and whether CONFIG_LOG_OUTPUT_FORMAT_LINUX_TIMESTAMP is set or not.

timestamp = float(line[span_end_pos - 19: span_end_pos - 7].strip())
# Support for CONFIG_LOG_OUTPUT_FORMAT_TIME_TIMESTAMP - For when default Zephyr timestamp format is used
except ValueError:
h, m, rest = line[span_end_pos - 23: span_end_pos - 7].strip().split(':')
s1, s2 = rest.split(',')
s = s1+s2
timestamp = timedelta(
hours=int(h),
minutes=int(m),
seconds=float(s)
).total_seconds()

# The rest after removing timestamp and log level
rest = line[span_end_pos + 1:].split(': ')
Expand Down