Skip to content

Commit

Permalink
trace: Log line number on exception in DMA trace
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca committed Oct 2, 2024
1 parent 7fba927 commit f175145
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions util/trace/gen_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,17 @@ def eval_dma_metrics(dma_trans, dma_trace):
bursts_in_transfer = 0
rec_bursts = 0
# Iterate lines in DMA trace
for line in f.readlines():
dma = ast.literal_eval(line)
for lineno, (line, nextl) in enumerate(current_and_next(f.readlines())):
try:
dma = ast.literal_eval(line)
except SyntaxError:
message = 'Exception occured while processing '
if not nextl:
message += 'last line. Did the simulation terminate?'
else:
message += f'line {lineno}.'
print(traceback.format_exc(), file=sys.stderr)
print(message, file=sys.stderr)
time = dma['meta']['time']
# When the first burst in a transfer is granted, we record a new transfer in
# the outstanding transfers queue, with the information obtained from the core
Expand Down

0 comments on commit f175145

Please sign in to comment.