Skip to content

Commit

Permalink
Scale time to correct cycles unit by dividing by 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
Raragyay committed Dec 2, 2023
1 parent 82233b6 commit 379cd84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions util/trace/gen_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def eval_dma_metrics(dma_trans, dma_trace):
compl_transfers.append(compl_transfer)
# Calculate bandwidth of individual transfers
for transfer in compl_transfers:
transfer['cycles'] = transfer['end'] - transfer['start']
transfer['cycles'] = (transfer['end'] - transfer['start']) // 1000
transfer['bw'] = transfer['bytes'] / transfer['cycles']
# Calculate aggregate bandwidth: total number of bytes transferred while any
# transfer is active (considers overlaps between transfers).
Expand All @@ -466,7 +466,8 @@ def eval_dma_metrics(dma_trans, dma_trace):
n_bytes = 0
for transfer in compl_transfers:
# Calculate active cycles, without double-counting overlaps
curr_trans_start, curr_trans_end = transfer['start'], transfer['end']
# Convert time to cycles since time = cycles * 1000 + <constant>
curr_trans_start, curr_trans_end = transfer['start'] // 1000, transfer['end'] // 1000
if curr_trans_start > prev_trans_end:
active_cycles += curr_trans_end - curr_trans_start
else:
Expand Down

0 comments on commit 379cd84

Please sign in to comment.