Add -Wextra to CFLAGS
[urcu.git] / tests / benchmark / runhash.sh
1 #!/bin/bash
2
3 # 1st 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 source ../utils/tap.sh
12
13 NUM_TESTS=17
14
15 plan_tests ${NUM_TESTS}
16
17 diag "Executing Hash table test"
18
19 # TODO: missing tests:
20 # - send kill signals during tests to change the behavior between
21 # add/remove/random
22 # - validate that "nr_leaked" is always 0 in SUMMARY for all tests
23
24 TESTPROG=./test_urcu_hash
25
26 NUM_CPUS="1"
27 for i in nproc gnproc; do
28 NUM_CPUS=$($i 2>/dev/null)
29 if [ "$?" -eq "0" ]; then
30 break
31 else
32 NUM_CPUS="1"
33 fi
34 done
35
36 #thread multiplier: number of processors divided by 4.
37 if [[ ${NUM_CPUS} -lt 4 ]]; then
38 NUM_CPUS=4 # Floor at 4 due to following assumptions.
39 fi
40
41 THREAD_MUL=$((NUM_CPUS / 4))
42
43 EXTRA_PARAMS=-v
44
45 # ** test update coherency with single-value table
46
47 # rw test, single key, replace and del randomly, 4 threads, auto resize.
48 # key range: init, lookup, and update: 0 to 0
49 okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
50
51 # rw test, single key, add unique and del randomly, 4 threads, auto resize.
52 # key range: init, lookup, and update: 0 to 0
53 okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
54
55 # rw test, single key, replace and del randomly, 2 lookup threads, 2 update threads, auto resize.
56 # key range: init, lookup, and update: 0 to 0
57 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
58
59 # rw test, single key, add and del randomly, 2 lookup threads, 2 update threads, auto resize.
60 # key range: init, lookup, and update: 0 to 0
61 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
62
63
64 # ** test updates vs lookups with default table
65
66 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
67 # max 1048576 buckets
68 # key range: init, lookup, and update: 0 to 999999
69 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A ${EXTRA_PARAMS}
70
71 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
72 # max 1048576 buckets
73 # key range: init, lookup, and update: 0 to 999999
74 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s ${EXTRA_PARAMS}
75
76 # rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
77 # max 1048576 buckets
78 # key range: init, lookup, and update: 0 to 999999
79 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -u ${EXTRA_PARAMS}
80
81
82 # test memory management backends
83
84 # rw test, 2 lookup, 2 update threads, add only, auto resize.
85 # max buckets: 1048576
86 # key range: init, lookup, and update: 0 to 99999999
87 # mm backend: "order"
88 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
89 -M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
90
91 # rw test, 2 lookup, 2 update threads, add only, auto resize.
92 # max buckets: 1048576
93 # key range: init, lookup, and update: 0 to 99999999
94 # mm backend: "chunk"
95 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
96 -M 100000000 -N 100000000 -O 100000000 -B chunk ${EXTRA_PARAMS}
97
98 # rw test, 2 lookup, 2 update threads, add only, auto resize.
99 # max buckets: 1048576
100 # key range: init, lookup, and update: 0 to 99999999
101 # mm backend: "mmap"
102 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
103 -M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
104
105
106 # ** key range tests
107
108 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
109 # max 1048576 buckets
110 # key range: init, and update: 0 to 999999
111 # key range: lookup: 1000000 to 1999999
112 # NOTE: reader threads in this test should never have a successful
113 # lookup. TODO
114 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
115 -R 1000000 ${EXTRA_PARAMS}
116
117 # ** small key range
118
119 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
120 # max 1048576 buckets
121 # key range: init, update, and lookups: 0 to 9
122 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
123 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
124
125 # rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
126 # max 1048576 buckets
127 # key range: init, update, and lookups: 0 to 9
128 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
129 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
130
131 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
132 # max 1048576 buckets
133 # key range: init, update, and lookups: 0 to 9
134 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
135 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
136
137 # ** lookup for known keys
138
139 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
140 # max 1048576 buckets
141 # lookup range is entirely populated.
142 # key range: init, and lookups: 0 to 9
143 # key range: updates: 10 to 19
144 # NOTE: reader threads in this test should always have successful
145 # lookups. TODO
146 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
147 -M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
148
149 # ** Uniqueness test
150
151 # rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
152 # max 1048576 buckets
153 # asserts that no duplicates are observed by reader threads
154 # standard length hash chains
155 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
156 -U ${EXTRA_PARAMS}
157
158 # rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
159 # max 1048576 buckets
160 # asserts that no duplicates are observed by reader threads
161 # create long hash chains: using modulo 4 on keys as hash
162 okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
163 -U -C 4 ${EXTRA_PARAMS}
This page took 0.032639 seconds and 4 git commands to generate.