Skip to content

Commit

Permalink
Added small script to calculate basic block sizes from simulation trace
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhepp committed Jan 13, 2014
1 parent 4006dc3 commit 35b548a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions simutils/get_ebb_size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# Small utility script to get the size of extended basic blocks out of a pasim trace.
# It will print the size of each continiously executed block of code.
#
# TODO port to python (?)
#
# Usage: pasim <binary> --debug=0 --debug-fmt=trace | ./get_ebb_size.sh
#
# Author: Stefan Hepp <[email protected]>
#

startpc=
lastpc=1

while read pc cnt; do
pc=$((0x$pc))
nextpc=$((lastpc + 8))

if [[ (($pc < $lastpc)) || (($pc > $nextpc)) ]]; then
if [ "$startpc" ]; then
echo $((nextpc-startpc))
fi
startpc=$pc
fi
lastpc=$pc
done

0 comments on commit 35b548a

Please sign in to comment.