Skip to content

Commit

Permalink
option to show all rois in trace, show dma transfers inline
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Jan 19, 2024
1 parent f452cc1 commit 504564b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ gmon.out

// Docs
/site/
/docs/generated/
/docs/generated/
build/
23 changes: 14 additions & 9 deletions util/bench/roi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ def format_roi(roi, label):
}


def get_roi(data, thread, idx):
thread_type, thread_idx = thread.split('_')
thread_idx = int(thread_idx)
thread_data = data[thread]
def get_rois(thread_data, thread_type):
if thread_type == "hart":
return thread_data[idx]
return thread_data
elif thread_type == "dma":
return thread_data["transfers"][idx]
return thread_data["transfers"]
else:
raise ValueError(f"Unsupported thread type {thread_type}")

Expand All @@ -55,11 +52,19 @@ def filter_and_label_rois(data, spec):
# Iterate all threads in the rendered specification
for thread_spec in spec:
thread = thread_spec['thread']
thread_type, thread_idx = thread.split('_')
thread_idx = int(thread_idx)
thread_data = data[thread]

output_rois = []
# Iterate all ROIs to keep for the current thread
for roi in thread_spec['roi']:
output_roi = format_roi(get_roi(data, thread, roi['idx']), roi['label'])
output_rois.append(output_roi)
if thread_spec['roi'] == '*':
for i in get_rois(thread_data, thread_type):
output_rois.append(format_roi(i, thread))
else:
for roi in thread_spec['roi']:
output_roi = format_roi(get_rois(thread_data, thread_type)[roi['idx']], roi['label'])
output_rois.append(output_roi)
# Add ROIs for current thread to output, if any
if output_rois:
output[thread] = output_rois
Expand Down
5 changes: 3 additions & 2 deletions util/bench/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def main():

# Iterate execution regions for current thread
for region in regions:
thread_type, thread_idx = thread.split('_')

# Create TraceViewer event
ts = int(region['tstart'])
Expand All @@ -90,8 +91,8 @@ def main():
'ph': "X", # Complete event type
'ts': us(ts),
'dur': us(dur),
'pid': 0,
'tid': thread,
'pid': 1 if thread_type == 'dma' else 0,
'tid': int(thread_idx) -1,
'args': region['attrs']
}
events.append(event)
Expand Down
2 changes: 2 additions & 0 deletions util/trace/tracevis.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def offload_lookahead(lines, **kwargs):
if match:
(time, cyc, priv, cmt) = tuple(
[match.group(i+1).strip() for i in range(re_acc_line.groups)])
else:
(time, cyc, priv, cmt) = (0,0,0,'')

time = int(time) if use_time else int(cyc)

Expand Down

0 comments on commit 504564b

Please sign in to comment.