Tests fix: errors in shell scripts
[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
748f9af1 6if [ "x${DURATION}" = "x" ]; then
f80aadcd
MJ
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 =
748f9af1 33NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 ))
f80aadcd
MJ
34
35plan_tests ${NUM_TESTS}
36
37#run all tests
38diag "Executing URCU tests"
39
9e31d0f0
MD
40
41#extra options, e.g. for setting affinity on even CPUs :
e4ca4127 42#EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done)
9e31d0f0 43
ec3aaabb 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)
9e31d0f0
MD
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
a813abf8 60
ad460058 61diag "Executing batch RCU test"
a813abf8 62
bb9a66cb
MD
63BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
64 131072 262144"
f80aadcd
MJ
65BATCH_TEST_ARRAY="test_urcu_gc"
66
748f9af1
MJ
67NR_WRITERS=$((NUM_CPUS / 2))
68NR_READERS=$((NUM_CPUS - NR_WRITERS))
a813abf8 69
a813abf8 70for BATCH_SIZE in ${BATCH_ARRAY}; do
f80aadcd 71 for TEST in ${BATCH_TEST_ARRAY}; do
748f9af1
MJ
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}"
f80aadcd 77 done
a813abf8
MD
78done
79
f80aadcd
MJ
80TEST_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
a74e263c 85#setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
31bb09e2 86EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
a813abf8 87
ad460058 88diag "Executing update fraction test"
9e31d0f0 89
9e31d0f0 90WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
d109adc2
MD
91 65536 131072 262144 524288 1048576 2097152 4194304 8388608
92 16777216 33554432 67108864 134217728"
748f9af1
MJ
93NR_WRITERS=$((NUM_CPUS / 2))
94NR_READERS=$((NUM_CPUS - NR_WRITERS))
9e31d0f0 95
d42a8f3e 96for WDELAY in ${WDELAY_ARRAY}; do
f80aadcd 97 for TEST in ${TEST_ARRAY}; do
748f9af1
MJ
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}"
f80aadcd 103 done
d42a8f3e 104done
9e31d0f0 105
9e31d0f0
MD
106#Test scalability :
107# x: vary number of readers from 0 to num cpus
108# y: ops/s
109# 0 writer.
110
ad460058 111diag "Executing scalability test"
9e31d0f0
MD
112
113NR_WRITERS=0
9e31d0f0 114
f80aadcd
MJ
115for NR_READERS in $(xseq 1 ${NUM_CPUS}); do
116 for TEST in ${TEST_ARRAY}; do
748f9af1
MJ
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}"
f80aadcd 122 done
9e31d0f0
MD
123done
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
ad460058 131diag "Executing reader C.S. length test"
9e31d0f0 132
2b1e60a4 133NR_READERS=${NUM_CPUS}
9e31d0f0 134NR_WRITERS=0
9e31d0f0 135#in loops.
637dc445 136READERCSLEN_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 137
9e31d0f0 138for READERCSLEN in ${READERCSLEN_ARRAY}; do
f80aadcd 139 for TEST in ${TEST_ARRAY}; do
748f9af1
MJ
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}"
f80aadcd 145 done
9e31d0f0 146done
This page took 0.06452 seconds and 4 git commands to generate.