3 # SPDX-License-Identifier: GPL-2.0-only
5 # SPDX-FileCopyrightText: 2022 EfficiOS Inc.
8 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
9 UTILSSH
="$URCU_TESTS_SRCDIR/utils/utils.sh"
11 UTILSSH
="$(dirname "$0")/../utils/utils.sh"
17 # shellcheck source=../utils/utils.sh
21 # 1st parameter: seconds per test
24 if [ "x${DURATION}" = "x" ]; then
25 echo "usage: $0 [DURATION]"
31 plan_tests
${NUM_TESTS}
33 diag
"Executing Hash table test"
35 # TODO: missing tests:
36 # - send kill signals during tests to change the behavior between
38 # - validate that "nr_leaked" is always 0 in SUMMARY for all tests
40 TESTPROG
="${URCU_TESTS_BUILDDIR}/benchmark/test_urcu_hash"
42 #thread multiplier: number of processors divided by 4.
43 NUM_CPUS
="$(urcu_nproc)"
44 if [[ ${NUM_CPUS} -lt 4 ]]; then
45 NUM_CPUS
=4 # Floor at 4 due to following assumptions.
48 THREAD_MUL
=$
((NUM_CPUS
/ 4))
52 # ** test update coherency with single-value table
54 # rw test, single key, replace and del randomly, 4 threads, auto resize.
55 # key range: init, lookup, and update: 0 to 0
56 okx
"${TESTPROG}" 0 $((4*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
58 # rw test, single key, add unique and del randomly, 4 threads, auto resize.
59 # key range: init, lookup, and update: 0 to 0
60 okx "${TESTPROG}" 0 $((4*THREAD_MUL)) "${DURATION}" -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
62 # rw test, single key, replace and del randomly, 2 lookup threads, 2 update threads, auto resize.
63 # key range: init, lookup, and update: 0 to 0
64 okx
"${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
66 # rw test, single key, add and del randomly, 2 lookup threads, 2 update threads, auto resize.
67 # key range: init, lookup, and update: 0 to 0
68 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
71 # ** test updates vs lookups with default table
73 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
75 # key range: init, lookup, and update: 0 to 999999
76 okx
"${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A ${EXTRA_PARAMS}
78 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
80 # key range: init, lookup, and update: 0 to 999999
81 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s ${EXTRA_PARAMS}
83 # rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
85 # key range: init, lookup, and update: 0 to 999999
86 okx
"${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -u ${EXTRA_PARAMS}
89 # test memory management backends
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
95 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
96 -M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
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: "chunk
"
102 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
103 -M 100000000 -N 100000000 -O 100000000 -B chunk ${EXTRA_PARAMS}
105 # rw test, 2 lookup, 2 update threads, add only, auto resize.
106 # max buckets: 1048576
107 # key range: init, lookup, and update: 0 to 99999999
109 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
110 -M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
115 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
116 # max 1048576 buckets
117 # key range: init, and update: 0 to 999999
118 # key range: lookup: 1000000 to 1999999
119 # NOTE: reader threads in this test should never have a successful
121 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
122 -R 1000000 ${EXTRA_PARAMS}
126 # rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
127 # max 1048576 buckets
128 # key range: init, update, and lookups: 0 to 9
129 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
130 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
132 # rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
133 # max 1048576 buckets
134 # key range: init, update, and lookups: 0 to 9
135 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
136 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
138 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
139 # max 1048576 buckets
140 # key range: init, update, and lookups: 0 to 9
141 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
142 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
144 # ** lookup for known keys
146 # rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
147 # max 1048576 buckets
148 # lookup range is entirely populated.
149 # key range: init, and lookups: 0 to 9
150 # key range: updates: 10 to 19
151 # NOTE: reader threads in this test should always have successful
153 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
154 -M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
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 # standard length hash chains
162 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
165 # rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
166 # max 1048576 buckets
167 # asserts that no duplicates are observed by reader threads
168 # create long hash chains: using modulo 4 on keys as hash
169 okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
170 -U -C 4 ${EXTRA_PARAMS}
This page took 0.032873 seconds and 4 git commands to generate.