2ae73e971c8a71cd2b2e7da175b5c35efa2dd636
[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 #thread multiplier: number of processors divided by 4.
22 NUM_CPUS=$(nproc)
23 if [[ ${NUM_CPUS} -lt 4 ]]; then
24 NUM_CPUS=4 # Floor at 4 due to following assumptions.
25 fi
26
27 THREAD_MUL=$(( ${NUM_CPUS} / 4 ))
28
29 EXTRA_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
35 okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
39 okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
43 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
47 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
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
55 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A ${EXTRA_PARAMS}
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
60 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s ${EXTRA_PARAMS}
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
65 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -u ${EXTRA_PARAMS}
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"
74 okx ${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}
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"
81 okx ${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}
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"
88 okx ${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}
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
100 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
101 -R 1000000 ${EXTRA_PARAMS}
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
108 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
109 -M 10 -N 10 -O 10 ${EXTRA_PARAMS}
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
114 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
115 -M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
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
120 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
121 -M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
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
132 okx ${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}
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
141 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
142 -U ${EXTRA_PARAMS}
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
148 okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
149 -U -C 4 ${EXTRA_PARAMS}
This page took 0.033902 seconds and 3 git commands to generate.