#first parameter: seconds per test
DURATION=$1
-if [ "x$DURATION" = "x" ]; then
+if [ "x${DURATION}" = "x" ]; then
echo "usage: $0 [DURATION]"
exit 1
fi
# fraction: 15 * 29 =
# scalabilit NUM_CPUS * 15
# reader 15 * 23 =
-NUM_TESTS=$(( 19 + 435 + ( ${NUM_CPUS} * 15 ) + 345 ))
+NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 ))
plan_tests ${NUM_TESTS}
#run all tests
diag "Executing URCU tests"
-tmpfile=
-trap cleanup SIGINT SIGTERM EXIT
-tmpfile=$(mktemp)
#extra options, e.g. for setting affinity on even CPUs :
#EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done)
131072 262144"
BATCH_TEST_ARRAY="test_urcu_gc"
-NR_WRITERS=$((${NUM_CPUS} / 2))
+NR_WRITERS=$((NUM_CPUS / 2))
+NR_READERS=$((NUM_CPUS - NR_WRITERS))
-NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
for BATCH_SIZE in ${BATCH_ARRAY}; do
for TEST in ${BATCH_TEST_ARRAY}; do
- okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
- -d 0 -b ${BATCH_SIZE} ${EXTRA_OPTS} 2>${tmpfile}
- cat $tmpfile | while read line; do
- echo "# $line"
- done
+ okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
+ -d 0 -b "${BATCH_SIZE}" ${EXTRA_OPTS} 2>"${TMPFILE}"
+ while read line; do
+ echo "## $line"
+ done <"${TMPFILE}"
done
done
WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
65536 131072 262144 524288 1048576 2097152 4194304 8388608
16777216 33554432 67108864 134217728"
-NR_WRITERS=$((${NUM_CPUS} / 2))
+NR_WRITERS=$((NUM_CPUS / 2))
+NR_READERS=$((NUM_CPUS - NR_WRITERS))
-NR_READERS=$((${NUM_CPUS} - ${NR_WRITERS}))
for WDELAY in ${WDELAY_ARRAY}; do
for TEST in ${TEST_ARRAY}; do
- okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
- -d ${WDELAY} ${EXTRA_OPTS} 2>$tmpfile
- cat $tmpfile | while read line; do
- echo "# $line"
- done
+ okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
+ -d "${WDELAY}" ${EXTRA_OPTS} 2>"${TMPFILE}"
+ while read line; do
+ echo "## $line"
+ done <"${TMPFILE}"
done
done
for NR_READERS in $(xseq 1 ${NUM_CPUS}); do
for TEST in ${TEST_ARRAY}; do
- okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
- ${EXTRA_OPTS} 2>$tmpfile
- cat $tmpfile | while read line; do
- echo "# $line"
- done
+ okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
+ ${EXTRA_OPTS} 2>"${TMPFILE}"
+ while read line; do
+ echo "## $line"
+ done <"${TMPFILE}"
done
done
for READERCSLEN in ${READERCSLEN_ARRAY}; do
for TEST in ${TEST_ARRAY}; do
- okx $test_time_bin ./${TEST} ${NR_READERS} ${NR_WRITERS} ${DURATION} \
- -c ${READERCSLEN} ${EXTRA_OPTS} 2>$tmpfile
- cat $tmpfile | while read line; do
- echo "# $line"
- done
+ okx ${TEST_TIME_BIN} ./"${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \
+ -c "${READERCSLEN}" ${EXTRA_OPTS} 2>"${TMPFILE}"
+ while read line; do
+ echo "## $line"
+ done <"${TMPFILE}"
done
done
#!/bin/bash
+# 1st parameter: seconds per test
+DURATION=$1
+
+if [ "x${DURATION}" = "x" ]; then
+ echo "usage: $0 [DURATION]"
+ exit 1
+fi
+
source ../utils/tap.sh
NUM_TESTS=17
# add/remove/random
# - validate that "nr_leaked" is always 0 in SUMMARY for all tests
-# 1st parameter: seconds per test
-TIME_UNITS=$1
-
TESTPROG=./test_urcu_hash
NUM_CPUS="1"
NUM_CPUS=4 # Floor at 4 due to following assumptions.
fi
-THREAD_MUL=$(( ${NUM_CPUS} / 4 ))
+THREAD_MUL=$((NUM_CPUS / 4))
EXTRA_PARAMS=-v
# rw test, single key, replace and del randomly, 4 threads, auto resize.
# key range: init, lookup, and update: 0 to 0
-okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
+okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
# rw test, single key, add unique and del randomly, 4 threads, auto resize.
# key range: init, lookup, and update: 0 to 0
-okx ${TESTPROG} 0 $((4*${THREAD_MUL})) ${TIME_UNITS} -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
+okx ${TESTPROG} 0 $((4*THREAD_MUL)) "${DURATION}" -A -u -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
# rw test, single key, replace and del randomly, 2 lookup threads, 2 update threads, auto resize.
# key range: init, lookup, and update: 0 to 0
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
# rw test, single key, add and del randomly, 2 lookup threads, 2 update threads, auto resize.
# key range: init, lookup, and update: 0 to 0
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -M 1 -N 1 -O 1 ${EXTRA_PARAMS}
# ** test updates vs lookups with default table
# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
# max 1048576 buckets
# key range: init, lookup, and update: 0 to 999999
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A ${EXTRA_PARAMS}
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
# max 1048576 buckets
# key range: init, lookup, and update: 0 to 999999
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -s ${EXTRA_PARAMS}
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -s ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
# max 1048576 buckets
# key range: init, lookup, and update: 0 to 999999
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -u ${EXTRA_PARAMS}
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -u ${EXTRA_PARAMS}
# test memory management backends
# max buckets: 1048576
# key range: init, lookup, and update: 0 to 99999999
# mm backend: "order"
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
-M 100000000 -N 100000000 -O 100000000 -B order ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add only, auto resize.
# max buckets: 1048576
# key range: init, lookup, and update: 0 to 99999999
# mm backend: "chunk"
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
-M 100000000 -N 100000000 -O 100000000 -B chunk ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add only, auto resize.
# max buckets: 1048576
# key range: init, lookup, and update: 0 to 99999999
# mm backend: "mmap"
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A -m 1 -n 1048576 -i \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A -m 1 -n 1048576 -i \
-M 100000000 -N 100000000 -O 100000000 -B mmap ${EXTRA_PARAMS}
# key range: lookup: 1000000 to 1999999
# NOTE: reader threads in this test should never have a successful
# lookup. TODO
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-R 1000000 ${EXTRA_PARAMS}
# ** small key range
# rw test, 2 lookup, 2 update threads, add and del randomly, auto resize.
# max 1048576 buckets
# key range: init, update, and lookups: 0 to 9
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-M 10 -N 10 -O 10 ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add_unique and del randomly, auto resize.
# max 1048576 buckets
# key range: init, update, and lookups: 0 to 9
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-M 10 -N 10 -O 10 -u ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add_replace and del randomly, auto resize.
# max 1048576 buckets
# key range: init, update, and lookups: 0 to 9
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-M 10 -N 10 -O 10 -s ${EXTRA_PARAMS}
# ** lookup for known keys
# key range: updates: 10 to 19
# NOTE: reader threads in this test should always have successful
# lookups. TODO
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-M 10 -N 10 -O 10 -R 0 -T 0 -S 10 -k 10 -s ${EXTRA_PARAMS}
# ** Uniqueness test
# max 1048576 buckets
# asserts that no duplicates are observed by reader threads
# standard length hash chains
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-U ${EXTRA_PARAMS}
# rw test, 2 lookup, 2 update threads, add_unique, add_replace and del randomly, auto resize.
# max 1048576 buckets
# asserts that no duplicates are observed by reader threads
# create long hash chains: using modulo 4 on keys as hash
-okx ${TESTPROG} $((2*${THREAD_MUL})) $((2*${THREAD_MUL})) ${TIME_UNITS} -A \
+okx ${TESTPROG} $((2*THREAD_MUL)) $((2*THREAD_MUL)) "${DURATION}" -A \
-U -C 4 ${EXTRA_PARAMS}