Port: Detect nproc bin name in benchmark scripts
[urcu.git] / tests / benchmark / runhash.sh
1 #!/bin/bash
2
3 source ../utils/tap.sh
4
5 NUM_TESTS=17
6
7 plan_tests ${NUM_TESTS}
8
9 diag "Executing Hash table test"
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
16 # 1st parameter: seconds per test
17 TIME_UNITS=$1
18
19 TESTPROG=./test_urcu_hash
20
21 NUM_CPUS="1"
22 for 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
29 done
30
31 #thread multiplier: number of processors divided by 4.
32 if [[ ${NUM_CPUS} -lt 4 ]]; then
33 NUM_CPUS=4 # Floor at 4 due to following assumptions.
34 fi
35
36 THREAD_MUL=$(( ${NUM_CPUS} / 4 ))
37
38 EXTRA_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
44 okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
48 okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
52 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
56 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
64 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A ${EXTRA_PARAMS}
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
69 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s ${EXTRA_PARAMS}
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
74 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -u ${EXTRA_PARAMS}
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"
83 okx ${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}
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"
90 okx ${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}
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"
97 okx ${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}
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
109 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
110 -R 1000000 ${EXTRA_PARAMS}
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
117 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
118 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
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
123 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
124 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
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
129 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
130 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
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
141 okx ${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}
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
150 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
151 -U ${EXTRA_PARAMS}
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
157 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
158 -U -C 4 ${EXTRA_PARAMS}
This page took 0.044346 seconds and 4 git commands to generate.