-
Notifications
You must be signed in to change notification settings - Fork 8
/
no_contention.sh
executable file
·63 lines (55 loc) · 1017 Bytes
/
no_contention.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
CYCLE=20
THREAD=1
REPEAT=1
TARGET=""
FIX_PROB=""
while [[ $# -gt 1 ]]; do
key="$1"
case $key in
-c|--cycle)
CYCLE="$2"
shift
;;
-t|--thread)
THREAD="$2"
shift
;;
-r|--repeat)
REPEAT="$2"
shift
;;
-f|--fix-prob)
FIX_PROB="-f"
esac
shift
done
TARGET=${1?"$0 <OUTPUT_DIR>. Need to specify output directory"}
echo CYCLE = "$CYCLE"
echo THREAD = "$THREAD"
echo REPEAT = "$REPEAT"
echo TARGET = "$TARGET"
echo FIX_PROB = "$FIX_PROB"
mkdir -p $TARGET
PROGRAMS=(
nc_thread_local
nc_address
nc_atomic_mutex1
nc_atomic_mutex2
nc_atomic_mutex3
nc_atomic_mutex4
nc_atomic_mutex5
nc_pthread_mutex
nc_pthread_rwlock_r
nc_pthread_rwlock_w
nc_atomic_rwlock_r
nc_atomic_rwlock_w
nc_atomic_punch_card_r
nc_atomic_punch_card_w
)
for program in ${PROGRAMS[@]}; do
echo $program
for i in `seq 1 $REPEAT`; do
perf stat -o "$TARGET/${program}_${THREAD}${FIX_PROB}" --append ./$program -c $CYCLE -t $THREAD $FIX_PROB
done
done