tests: Add a simple compile test for caa_get_cycles
[urcu.git] / tests / benchmark / run-urcu-tests.sh
1 #!/bin/bash
2
3 #first parameter: seconds per test
4 DURATION=$1
5
6 if [ "x${DURATION}" = "x" ]; then
7 echo "usage: $0 [DURATION]"
8 exit 1
9 fi
10
11 . ../utils/tap.sh
12 . ./common.sh
13
14 NUM_CPUS="1"
15 for i in nproc gnproc; do
16 NUM_CPUS=$($i 2>/dev/null)
17 if [ "$?" -eq "0" ]; then
18 break
19 else
20 NUM_CPUS="1"
21 fi
22 done
23
24 #set to number of active CPUS
25 if [[ ${NUM_CPUS} -lt 4 ]]; then
26 NUM_CPUS=4 # Floor at 4 due to following assumptions.
27 fi
28
29 # batch: 19 * 1 = 19
30 # fraction: 15 * 29 =
31 # scalabilit NUM_CPUS * 15
32 # reader 15 * 23 =
33 NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 ))
34
35 plan_tests ${NUM_TESTS}
36
37 #run all tests
38 diag "Executing URCU tests"
39
40
41 #extra options, e.g. for setting affinity on even CPUs :
42 #EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done)
43
44 #ppc64 striding, use with NUM_CPUS=8
45
46 #stride 1
47 #EXTRA_OPTS=$(for a in $(seq 0 2 15); do echo -n "-a ${a} "; done)
48 #stride 2
49 #EXTRA_OPTS=$(for a in $(seq 0 4 31); do echo -n "-a ${a} "; done)
50 #stride 4
51 #EXTRA_OPTS=$(for a in $(seq 0 8 63); do echo -n "-a ${a} "; done)
52 #stride 8
53 #EXTRA_OPTS=$(for a in $(seq 0 16 127); do echo -n "-a ${a} "; done)
54
55 #Vary update fraction
56 #x: vary update fraction from 0 to 0.0001
57 #fix number of readers and reader C.S. length, vary delay between updates
58 #y: ops/s
59
60
61 diag "Executing batch RCU test"
62
63 BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
64 131072 262144"
65 BATCH_TEST_ARRAY="test_urcu_gc"
66
67 NR_WRITERS=$((NUM_CPUS / 2))
68 NR_READERS=$((NUM_CPUS - NR_WRITERS))
69
70 for BATCH_SIZE in ${BATCH_ARRAY}; do
71 for TEST in ${BATCH_TEST_ARRAY}; do
72 okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
73 -d 0 -b "${BATCH_SIZE}" ${EXTRA_OPTS} 2>"${TMPFILE}"
74 while read line; do
75 echo "## $line"
76 done <"${TMPFILE}"
77 done
78 done
79
80 TEST_ARRAY="test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc
81 test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc
82 test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr
83 test_rwlock test_perthreadlock test_mutex"
84
85 #setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
86 EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
87
88 diag "Executing update fraction test"
89
90 WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
91 65536 131072 262144 524288 1048576 2097152 4194304 8388608
92 16777216 33554432 67108864 134217728"
93 NR_WRITERS=$((NUM_CPUS / 2))
94 NR_READERS=$((NUM_CPUS - NR_WRITERS))
95
96 for WDELAY in ${WDELAY_ARRAY}; do
97 for TEST in ${TEST_ARRAY}; do
98 okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
99 -d "${WDELAY}" ${EXTRA_OPTS} 2>"${TMPFILE}"
100 while read line; do
101 echo "## $line"
102 done <"${TMPFILE}"
103 done
104 done
105
106 #Test scalability :
107 # x: vary number of readers from 0 to num cpus
108 # y: ops/s
109 # 0 writer.
110
111 diag "Executing scalability test"
112
113 NR_WRITERS=0
114
115 for NR_READERS in $(xseq 1 ${NUM_CPUS}); do
116 for TEST in ${TEST_ARRAY}; do
117 okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
118 ${EXTRA_OPTS} 2>"${TMPFILE}"
119 while read line; do
120 echo "## $line"
121 done <"${TMPFILE}"
122 done
123 done
124
125
126 # x: Vary reader C.S. length from 0 to 100 us
127 # y: ops/s
128 # 8 readers
129 # 0 writers
130
131 diag "Executing reader C.S. length test"
132
133 NR_READERS=${NUM_CPUS}
134 NR_WRITERS=0
135 #in loops.
136 READERCSLEN_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152"
137
138 for READERCSLEN in ${READERCSLEN_ARRAY}; do
139 for TEST in ${TEST_ARRAY}; do
140 okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
141 -c "${READERCSLEN}" ${EXTRA_OPTS} 2>"${TMPFILE}"
142 while read line; do
143 echo "## $line"
144 done <"${TMPFILE}"
145 done
146 done
This page took 0.031739 seconds and 4 git commands to generate.