Fix: pthread_rwlock initialization on Cygwin
[urcu.git] / tests / benchmark / runhash.sh
CommitLineData
ad460058
MD
1#!/bin/bash
2
748f9af1
MJ
3# 1st parameter: seconds per test
4DURATION=$1
5
6if [ "x${DURATION}" = "x" ]; then
7 echo "usage: $0 [DURATION]"
8 exit 1
9fi
10
ad460058
MD
11source ../utils/tap.sh
12
13NUM_TESTS=17
14
15plan_tests ${NUM_TESTS}
16
17diag "Executing Hash table test"
6d56bfa2
MD
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
6d56bfa2
MD
24TESTPROG=./test_urcu_hash
25
fba91a85
MJ
26NUM_CPUS="1"
27for 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
34done
35
ad460058 36#thread multiplier: number of processors divided by 4.
ad460058
MD
37if [[ ${NUM_CPUS} -lt 4 ]]; then
38 NUM_CPUS=4 # Floor at 4 due to following assumptions.
39fi
40
748f9af1 41THREAD_MUL=$((NUM_CPUS / 4))
6d56bfa2
MD
42
43EXTRA_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
748f9af1 49okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 53okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 57okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 61okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 69okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 74okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 79okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -u ${EXTRA_PARAMS}
6d56bfa2
MD
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"
748f9af1 88okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 89 -M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
6d56bfa2
MD
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"
748f9af1 95okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 96 -M 100000000 -N 100000000 -O 100000000 -B chunk ${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: "mmap"
748f9af1 102okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
ad460058 103 -M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 114okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 115 -R 1000000 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 122okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 123 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 128okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 129 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 134okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 135 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 146okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 147 -M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 155okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 156 -U ${EXTRA_PARAMS}
6d56bfa2
MD
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
748f9af1 162okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
ad460058 163 -U -C 4 ${EXTRA_PARAMS}
This page took 0.039728 seconds and 4 git commands to generate.