Skip to content

Commit

Permalink
audio: perf: fix no widget ID case in kernel logs
Browse files Browse the repository at this point in the history
When there is no widget ID in kernel logs, try to find
the widget ID in bind related logs.

Signed-off-by: Baofeng Tian <[email protected]>
  • Loading branch information
btian1 committed Oct 31, 2023
1 parent 6715ffb commit 07b6a37
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tools/sof_perf_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def process_kmsg_file():
with overlapping information, the last one wins.
'''
comp_name = {}
not_found = {}
with open(args.kmsg, encoding='utf8') as f:
ppln_id = None
for line in f:
Expand All @@ -204,8 +205,29 @@ def process_kmsg_file():
next_line = next(f)
widget_id = next_line.split('|')[0].split(':')[-1].strip()
# convert to the same ID format in mtrace
widget_id = int('0x' + widget_id[-6:], 16)
try:
widget_id = int('0x' + widget_id[-6:], 16)
except:
print("no valid widget ID found, try with bind information")
not_found[widget_name] = ppln_id
continue
comp_name[str(Component(ppln_id, widget_id))] = widget_name
elif match_obj := re.search(r' bind ', line):
if not_found:
# parse current line to get widget name
span_end_pos = match_obj.span()[1] - 1
line_split = line[span_end_pos + 1:].split()
widget_name = line_split[0].split(':')[0]
# parse next line get widget ID
next_line = next(f)
widget_id = next_line.split('|')[0].split(':')[-1].strip()
widget_id = int('0x' + widget_id[-6:], 16)
# get ppln_id from dictionary
if not_found[widget_name]:
ppln_id = not_found[widget_name]
comp_name[str(Component(ppln_id, widget_id))] = widget_name
# delete not_fund
del not_found[widget_name]

col_data = pd.DataFrame(
comp_name.values(),
Expand Down

0 comments on commit 07b6a37

Please sign in to comment.