Fix: regtest outputs valid TAP protocol
[urcu.git] / tests / benchmark / run-urcu-tests.sh
CommitLineData
ad460058
MD
1#!/bin/bash
2
f80aadcd
MJ
3#first parameter: seconds per test
4DURATION=$1
ad460058 5
f80aadcd
MJ
6if [ "x$DURATION" = "x" ]; then
7 echo "usage: $0 [DURATION]"
8 exit 1
9fi
ad460058 10
f80aadcd
MJ
11. ../utils/tap.sh
12. ./common.sh
9e31d0f0 13
fba91a85
MJ
14NUM_CPUS="1"
15for 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
22done
23
9e31d0f0 24#set to number of active CPUS
ad460058
MD
25if [[ ${NUM_CPUS} -lt 4 ]]; then
26 NUM_CPUS=4 # Floor at 4 due to following assumptions.
27fi
28
f80aadcd
MJ
29# batch: 19 * 1 = 19
30# fraction: 15 * 29 =
31# scalabilit NUM_CPUS * 15
32# reader 15 * 23 =
33NUM_TESTS=$(( 19 + 435 + ( ${NUM_CPUS} * 15 ) + 345 ))
34
35plan_tests ${NUM_TESTS}
36
37#run all tests
38diag "Executing URCU tests"
39
40tmpfile=
41trap cleanup SIGINT SIGTERM EXIT
42tmpfile=$(mktemp)
9e31d0f0
MD
43
44#extra options, e.g. for setting affinity on even CPUs :
e4ca4127 45#EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done)
9e31d0f0 46
ec3aaabb 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)
9e31d0f0
MD
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
a813abf8 63
ad460058 64diag "Executing batch RCU test"
a813abf8 65
bb9a66cb
MD
66BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
67 131072 262144"
f80aadcd
MJ
68BATCH_TEST_ARRAY="test_urcu_gc"
69
a813abf8
MD
70NR_WRITERS=$((${NUM_CPUS} / 2))
71
a813abf8
MD
72NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
73for BATCH_SIZE in ${BATCH_ARRAY}; do
f80aadcd
MJ
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
a813abf8
MD
81done
82
f80aadcd
MJ
83TEST_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
a74e263c 88#setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
31bb09e2 89EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
a813abf8 90
ad460058 91diag "Executing update fraction test"
9e31d0f0 92
9e31d0f0 93WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
d109adc2
MD
94 65536 131072 262144 524288 1048576 2097152 4194304 8388608
95 16777216 33554432 67108864 134217728"
d42a8f3e 96NR_WRITERS=$((${NUM_CPUS} / 2))
9e31d0f0 97
bb84bcef 98NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
d42a8f3e 99for WDELAY in ${WDELAY_ARRAY}; do
f80aadcd
MJ
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
d42a8f3e 107done
9e31d0f0 108
9e31d0f0
MD
109#Test scalability :
110# x: vary number of readers from 0 to num cpus
111# y: ops/s
112# 0 writer.
113
ad460058 114diag "Executing scalability test"
9e31d0f0
MD
115
116NR_WRITERS=0
9e31d0f0 117
f80aadcd
MJ
118for 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
9e31d0f0
MD
126done
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
ad460058 134diag "Executing reader C.S. length test"
9e31d0f0 135
2b1e60a4 136NR_READERS=${NUM_CPUS}
9e31d0f0 137NR_WRITERS=0
9e31d0f0 138#in loops.
637dc445 139READERCSLEN_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152"
9e31d0f0 140
9e31d0f0 141for READERCSLEN in ${READERCSLEN_ARRAY}; do
f80aadcd
MJ
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
9e31d0f0 149done
This page took 0.064395 seconds and 4 git commands to generate.