uatomic/x86: Remove redundant memory barriers
[urcu.git] / tests / benchmark / runhash.sh
CommitLineData
da56d5ca 1#!/usr/bin/env bash
de6cb9d5
MJ
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
6#
7
8if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
9 UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
10else
11 UTILSSH="$(dirname "$0")/../utils/utils.sh"
12fi
13
14# Enable TAP
15SH_TAP=1
16
17# shellcheck source=../utils/utils.sh
18source "$UTILSSH"
19
ad460058 20
748f9af1
MJ
21# 1st parameter: seconds per test
22DURATION=$1
23
24if [ "x${DURATION}" = "x" ]; then
25 echo "usage: $0 [DURATION]"
26 exit 1
27fi
28
ad460058
MD
29NUM_TESTS=17
30
31plan_tests ${NUM_TESTS}
32
33diag "Executing Hash table test"
6d56bfa2
MD
34
35# TODO: missing tests:
36# - send kill signals during tests to change the behavior between
37# add/remove/random
38# - validate that "nr_leaked" is always 0 in SUMMARY for all tests
39
de6cb9d5 40TESTPROG="${URCU_TESTS_BUILDDIR}/benchmark/test_urcu_hash"
fba91a85 41
ad460058 42#thread multiplier: number of processors divided by 4.
de6cb9d5 43NUM_CPUS="$(urcu_nproc)"
ad460058
MD
44if [[ ${NUM_CPUS} -lt 4 ]]; then
45 NUM_CPUS=4 # Floor at 4 due to following assumptions.
46fi
47
748f9af1 48THREAD_MUL=$((NUM_CPUS / 4))
6d56bfa2
MD
49
50EXTRA_PARAMS=-v
51
52# ** test update coherency with single-value table
53
54# rw test, single key, replace and del randomly, 4 threads, auto resize.
55# key range: init, lookup, and update: 0 to 0
de6cb9d5 56okx "${TESTPROG}" 0 $((4*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
57
58# rw test, single key, add unique and del randomly, 4 threads, auto resize.
59# key range: init, lookup, and update: 0 to 0
de6cb9d5 60okx "${TESTPROG}" 0 $((4*THREAD_MUL)) "${DURATION}" -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
61
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
de6cb9d5 64okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
65
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
de6cb9d5 68okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
69
70
71# ** test updates vs lookups with default table
72
73# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
74# max 1048576 buckets
75# key range: init, lookup, and update: 0 to 999999
de6cb9d5 76okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A ${EXTRA_PARAMS}
6d56bfa2
MD
77
78# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
79# max 1048576 buckets
80# key range: init, lookup, and update: 0 to 999999
de6cb9d5 81okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s ${EXTRA_PARAMS}
6d56bfa2
MD
82
83# rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
84# max 1048576 buckets
85# key range: init, lookup, and update: 0 to 999999
de6cb9d5 86okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -u ${EXTRA_PARAMS}
6d56bfa2
MD
87
88
89# test memory management backends
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: "order"
de6cb9d5 95okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 96 -M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
6d56bfa2
MD
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: "chunk"
de6cb9d5 102okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 103 -M 100000000 -N 100000000 -O 100000000 -B chunk ${EXTRA_PARAMS}
6d56bfa2
MD
104
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
108# mm backend: "mmap"
de6cb9d5 109okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 110 -M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
6d56bfa2
MD
111
112
113# ** key range tests
114
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
120# lookup. TODO
de6cb9d5 121okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 122 -R 1000000 ${EXTRA_PARAMS}
6d56bfa2
MD
123
124# ** small key range
125
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
de6cb9d5 129okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 130 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
6d56bfa2
MD
131
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
de6cb9d5 135okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 136 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
6d56bfa2
MD
137
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
de6cb9d5 141okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 142 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
143
144# ** lookup for known keys
145
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
152# lookups. TODO
de6cb9d5 153okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 154 -M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
155
156# ** Uniqueness test
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# standard length hash chains
de6cb9d5 162okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 163 -U ${EXTRA_PARAMS}
6d56bfa2
MD
164
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
de6cb9d5 169okx "${TESTPROG}" $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 170 -U -C 4 ${EXTRA_PARAMS}
This page took 0.047195 seconds and 4 git commands to generate.