Fix: regtest outputs valid TAP protocol
[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 tmpfile=
41 trap cleanup SIGINT SIGTERM EXIT
42 tmpfile=$(mktemp)
43
44 #extra options, e.g. for setting affinity on even CPUs :
45 #EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done)
46
47 #ppc64 striding, use with NUM_CPUS=8
48
49 #stride 1
50 #EXTRA_OPTS=$(for a in $(seq 0 2 15); do echo -n "-a ${a} "; done)
51 #stride 2
52 #EXTRA_OPTS=$(for a in $(seq 0 4 31); do echo -n "-a ${a} "; done)
53 #stride 4
54 #EXTRA_OPTS=$(for a in $(seq 0 8 63); do echo -n "-a ${a} "; done)
55 #stride 8
56 #EXTRA_OPTS=$(for a in $(seq 0 16 127); do echo -n "-a ${a} "; done)
57
58 #Vary update fraction
59 #x: vary update fraction from 0 to 0.0001
60 #fix number of readers and reader C.S. length, vary delay between updates
61 #y: ops/s
62
63
64 diag "Executing batch RCU test"
65
66 BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
67 131072 262144"
68 BATCH_TEST_ARRAY="test_urcu_gc"
69
70 NR_WRITERS=$((${NUM_CPUS} / 2))
71
72 NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
73 for BATCH_SIZE in ${BATCH_ARRAY}; do
74 for TEST in ${BATCH_TEST_ARRAY}; do
75 okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
76 -d 0 -b ${BATCH_SIZE} ${EXTRA_OPTS} 2>${tmpfile}
77 cat $tmpfile | while read line; do
78 echo "# $line"
79 done
80 done
81 done
82
83 TEST_ARRAY="test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc
84 test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc
85 test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr
86 test_rwlock test_perthreadlock test_mutex"
87
88 #setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
89 EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
90
91 diag "Executing update fraction test"
92
93 WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
94 65536 131072 262144 524288 1048576 2097152 4194304 8388608
95 16777216 33554432 67108864 134217728"
96 NR_WRITERS=$((${NUM_CPUS} / 2))
97
98 NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
99 for WDELAY in ${WDELAY_ARRAY}; do
100 for TEST in ${TEST_ARRAY}; do
101 okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
102 -d ${WDELAY} ${EXTRA_OPTS} 2>$tmpfile
103 cat $tmpfile | while read line; do
104 echo "# $line"
105 done
106 done
107 done
108
109 #Test scalability :
110 # x: vary number of readers from 0 to num cpus
111 # y: ops/s
112 # 0 writer.
113
114 diag "Executing scalability test"
115
116 NR_WRITERS=0
117
118 for NR_READERS in $(xseq 1 ${NUM_CPUS}); do
119 for TEST in ${TEST_ARRAY}; do
120 okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
121 ${EXTRA_OPTS} 2>$tmpfile
122 cat $tmpfile | while read line; do
123 echo "# $line"
124 done
125 done
126 done
127
128
129 # x: Vary reader C.S. length from 0 to 100 us
130 # y: ops/s
131 # 8 readers
132 # 0 writers
133
134 diag "Executing reader C.S. length test"
135
136 NR_READERS=${NUM_CPUS}
137 NR_WRITERS=0
138 #in loops.
139 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"
140
141 for READERCSLEN in ${READERCSLEN_ARRAY}; do
142 for TEST in ${TEST_ARRAY}; do
143 okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
144 -c ${READERCSLEN} ${EXTRA_OPTS} 2>$tmpfile
145 cat $tmpfile | while read line; do
146 echo "# $line"
147 done
148 done
149 done
This page took 0.045192 seconds and 4 git commands to generate.