unrelacy: instrument relacy-marked normal loads/stores
[model-checker-benchmarks.git] / bench.sh
1 #!/bin/bash
2
3 # A (work-in-progress) test script for running our benchmarks
4 # Runs all tests, logging output to a directory named
5 # '${BASEDIR}/run-<date-time>', where ${BASEDIR} is either the current
6 # directory or the first parameter to this script
7
8 ## Unfinished benchmarks - do not use
9 # queue williams-queue
10
11 DATECMD="date +%Y-%m-%d-%R"
12 DATE="`${DATECMD}`"
13 BASEDIR=.
14
15 [ $# -gt 0 ] && [ -d "$1" ] && BASEDIR="$1" && shift
16
17 DIR="${BASEDIR}/run-${DATE}"
18
19 TESTS="barrier/barrier"
20 TESTS+=" mcs-lock/mcs-lock"
21 TESTS+=" spsc-queue/spsc-queue"
22 TESTS+=" mpmc-queue/mpmc-2r1w"
23 TESTS+=" mpmc-queue/mpmc-1r2w-noinit"
24 TESTS+=" mpmc-queue/mpmc-queue-noinit"
25 TESTS+=" linuxrwlocks/linuxrwlocks"
26
27 MODEL_ARGS="-f 10 -m 2 -e 1"
28 COUNT=0
29
30 function run_test {
31         t=$1
32         shift
33         ARGS="$@"
34         RUN="./run.sh"
35         LOG=${DIR}/log-${COUNT}
36
37         echo "-----------------------------------------------"
38         echo "*******************************"
39         echo "Running test ${COUNT} (${t}): logging to ${LOG}"
40         echo "ARGS=${ARGS}"
41         echo "*******************************"
42         time ${RUN} ${t} ${ARGS} > ${LOG} 2>&1
43         echo
44         grep -A 2 "Number of executions" ${LOG} | tail -3
45         echo
46         echo "Test done; sleeping for a few seconds"
47         echo
48         sleep 3
49
50         echo "*******************************"
51         echo "Re-running test for timing data"
52         echo "*******************************"
53         (time ${RUN} ${t} ${ARGS} > /dev/null 2>&1) 2>&1
54         echo
55         echo "Test done; sleeping for a few seconds"
56         echo
57
58         let COUNT++
59 }
60
61 function run_all_tests {
62         echo ${DATE}
63
64         for t in ${TESTS}
65         do
66                 run_test ${t} ${MODEL_ARGS}
67         done
68         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 2 -w 1
69         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 1 -w 2
70         #run_test mpmc-queue/mpmc-queue ${MODEL_ARGS} -- -r 2 -w 2
71 }
72
73 mkdir ${DIR}
74 (git log --oneline -1; echo; run_all_tests) | tee ${DIR}/timing.log