Kostya Serebryany | b82ae88 | 2012-05-10 15:10:03 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -e |
| 4 | set -u |
| 5 | |
| 6 | get_asm() { |
Dmitry Vyukov | 8ecd0e5 | 2013-04-30 11:56:56 +0000 | [diff] [blame] | 7 | grep __tsan_$1.: -A 10000 libtsan.objdump | \ |
Kostya Serebryany | b82ae88 | 2012-05-10 15:10:03 +0000 | [diff] [blame] | 8 | awk "/[^:]$/ {print;} />:/ {c++; if (c == 2) {exit}}" |
| 9 | } |
| 10 | |
| 11 | list="write1 \ |
| 12 | write2 \ |
| 13 | write4 \ |
| 14 | write8 \ |
| 15 | read1 \ |
| 16 | read2 \ |
| 17 | read4 \ |
| 18 | read8 \ |
| 19 | func_entry \ |
| 20 | func_exit" |
| 21 | |
| 22 | BIN=`dirname $0`/tsan_test |
| 23 | objdump -d $BIN > libtsan.objdump |
| 24 | nm -S $BIN | grep "__tsan_" > libtsan.nm |
| 25 | |
| 26 | for f in $list; do |
| 27 | file=asm_$f.s |
| 28 | get_asm $f > $file |
| 29 | tot=$(wc -l < $file) |
Dmitry Vyukov | 8ecd0e5 | 2013-04-30 11:56:56 +0000 | [diff] [blame] | 30 | size=$(grep __tsan_$f$ libtsan.nm | awk --non-decimal-data '{print ("0x"$2)+0}') |
Kostya Serebryany | b82ae88 | 2012-05-10 15:10:03 +0000 | [diff] [blame] | 31 | rsp=$(grep '(%rsp)' $file | wc -l) |
| 32 | push=$(grep 'push' $file | wc -l) |
| 33 | pop=$(grep 'pop' $file | wc -l) |
| 34 | call=$(grep 'call' $file | wc -l) |
| 35 | load=$(egrep 'mov .*\,.*\(.*\)|cmp .*\,.*\(.*\)' $file | wc -l) |
| 36 | store=$(egrep 'mov .*\(.*\),' $file | wc -l) |
| 37 | mov=$(grep 'mov' $file | wc -l) |
| 38 | lea=$(grep 'lea' $file | wc -l) |
| 39 | sh=$(grep 'shr\|shl' $file | wc -l) |
| 40 | cmp=$(grep 'cmp\|test' $file | wc -l) |
| 41 | printf "%10s tot %3d; size %4d; rsp %d; push %d; pop %d; call %d; load %2d; store %2d; sh %3d; mov %3d; lea %3d; cmp %3d\n" \ |
| 42 | $f $tot $size $rsp $push $pop $call $load $store $sh $mov $lea $cmp; |
| 43 | done |