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