Refactor tests
[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
ad460058
MD
21#thread multiplier: number of processors divided by 4.
22NUM_CPUS=$(nproc)
23if [[ ${NUM_CPUS} -lt 4 ]]; then
24 NUM_CPUS=4 # Floor at 4 due to following assumptions.
25fi
26
27THREAD_MUL=$(( ${NUM_CPUS} / 4 ))
6d56bfa2
MD
28
29EXTRA_PARAMS=-v
30
31# ** test update coherency with single-value table
32
33# rw test, single key, replace and del randomly, 4 threads, auto resize.
34# key range: init, lookup, and update: 0 to 0
ad460058 35okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
36
37# rw test, single key, add unique and del randomly, 4 threads, auto resize.
38# key range: init, lookup, and update: 0 to 0
ad460058 39okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
40
41# rw test, single key, replace and del randomly, 2 lookup threads, 2 update threads, auto resize.
42# key range: init, lookup, and update: 0 to 0
ad460058 43okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
44
45# rw test, single key, add and del randomly, 2 lookup threads, 2 update threads, auto resize.
46# key range: init, lookup, and update: 0 to 0
ad460058 47okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
48
49
50# ** test updates vs lookups with default table
51
52# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
53# max 1048576 buckets
54# key range: init, lookup, and update: 0 to 999999
ad460058 55okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A ${EXTRA_PARAMS}
6d56bfa2
MD
56
57# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
58# max 1048576 buckets
59# key range: init, lookup, and update: 0 to 999999
ad460058 60okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s ${EXTRA_PARAMS}
6d56bfa2
MD
61
62# rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
63# max 1048576 buckets
64# key range: init, lookup, and update: 0 to 999999
ad460058 65okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -u ${EXTRA_PARAMS}
6d56bfa2
MD
66
67
68# test memory management backends
69
70# rw test, 2 lookup, 2 update threads, add only, auto resize.
71# max buckets: 1048576
72# key range: init, lookup, and update: 0 to 99999999
73# mm backend: "order"
ad460058
MD
74okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
75 -M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
6d56bfa2
MD
76
77# rw test, 2 lookup, 2 update threads, add only, auto resize.
78# max buckets: 1048576
79# key range: init, lookup, and update: 0 to 99999999
80# mm backend: "chunk"
ad460058
MD
81okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
82 -M 100000000 -N 100000000 -O 100000000 -B chunk ${EXTRA_PARAMS}
6d56bfa2
MD
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: "mmap"
ad460058
MD
88okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
89 -M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
6d56bfa2
MD
90
91
92# ** key range tests
93
94# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
95# max 1048576 buckets
96# key range: init, and update: 0 to 999999
97# key range: lookup: 1000000 to 1999999
98# NOTE: reader threads in this test should never have a successful
99# lookup. TODO
ad460058
MD
100okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
101 -R 1000000 ${EXTRA_PARAMS}
6d56bfa2
MD
102
103# ** small key range
104
105# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
106# max 1048576 buckets
107# key range: init, update, and lookups: 0 to 9
ad460058
MD
108okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
109 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
6d56bfa2
MD
110
111# rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
112# max 1048576 buckets
113# key range: init, update, and lookups: 0 to 9
ad460058
MD
114okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
115 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
6d56bfa2
MD
116
117# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
118# max 1048576 buckets
119# key range: init, update, and lookups: 0 to 9
ad460058
MD
120okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
121 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
122
123# ** lookup for known keys
124
125# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
126# max 1048576 buckets
127# lookup range is entirely populated.
128# key range: init, and lookups: 0 to 9
129# key range: updates: 10 to 19
130# NOTE: reader threads in this test should always have successful
131# lookups. TODO
ad460058
MD
132okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
133 -M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
134
135# ** Uniqueness test
136
137# rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
138# max 1048576 buckets
139# asserts that no duplicates are observed by reader threads
140# standard length hash chains
ad460058
MD
141okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
142 -U ${EXTRA_PARAMS}
6d56bfa2
MD
143
144# rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
145# max 1048576 buckets
146# asserts that no duplicates are observed by reader threads
147# create long hash chains: using modulo 4 on keys as hash
ad460058
MD
148okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
149 -U -C 4 ${EXTRA_PARAMS}
This page took 0.033672 seconds and 4 git commands to generate.