Cleanup: remove leftover manual pthread detection
[urcu.git] / tests / benchmark / run-urcu-tests.sh
... / ...
CommitLineData
1#!/bin/bash
2
3#first parameter: seconds per test
4DURATION=$1
5
6if [ "x$DURATION" = "x" ]; then
7 echo "usage: $0 [DURATION]"
8 exit 1
9fi
10
11. ../utils/tap.sh
12. ./common.sh
13
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
24#set to number of active CPUS
25if [[ ${NUM_CPUS} -lt 4 ]]; then
26 NUM_CPUS=4 # Floor at 4 due to following assumptions.
27fi
28
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)
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
64diag "Executing batch RCU test"
65
66BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
67 131072 262144"
68BATCH_TEST_ARRAY="test_urcu_gc"
69
70NR_WRITERS=$((${NUM_CPUS} / 2))
71
72NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
73for 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
81done
82
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
88#setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
89EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
90
91diag "Executing update fraction test"
92
93WDELAY_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"
96NR_WRITERS=$((${NUM_CPUS} / 2))
97
98NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
99for 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
107done
108
109#Test scalability :
110# x: vary number of readers from 0 to num cpus
111# y: ops/s
112# 0 writer.
113
114diag "Executing scalability test"
115
116NR_WRITERS=0
117
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
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
134diag "Executing reader C.S. length test"
135
136NR_READERS=${NUM_CPUS}
137NR_WRITERS=0
138#in loops.
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"
140
141for 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
149done
This page took 0.023342 seconds and 4 git commands to generate.