Commit | Line | Data |
---|---|---|
ad460058 | 1 | #!/bin/bash |
de6cb9d5 MJ |
2 | # |
3 | # SPDX-License-Identifier: GPL-2.0-only | |
4 | # | |
5 | # SPDX-FileCopyrightText: 2022 EfficiOS Inc. | |
6 | # | |
7 | ||
8 | if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then | |
9 | UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh" | |
10 | else | |
11 | UTILSSH="$(dirname "$0")/../utils/utils.sh" | |
12 | fi | |
13 | ||
14 | # Enable TAP | |
15 | SH_TAP=1 | |
16 | ||
17 | # shellcheck source=../utils/utils.sh | |
18 | source "$UTILSSH" | |
ad460058 | 19 | |
de6cb9d5 MJ |
20 | |
21 | # First parameter: seconds per test | |
f80aadcd | 22 | DURATION=$1 |
ad460058 | 23 | |
748f9af1 | 24 | if [ "x${DURATION}" = "x" ]; then |
f80aadcd MJ |
25 | echo "usage: $0 [DURATION]" |
26 | exit 1 | |
27 | fi | |
ad460058 | 28 | |
de6cb9d5 MJ |
29 | # Create a temporary file for tests output |
30 | TMPFILE=$(mktemp) | |
31 | ||
32 | # Set trap to delete the temporary file on exit and call tap.sh '_exit' | |
33 | trap 'rm -f "$TMPFILE"; _exit' EXIT | |
fba91a85 | 34 | |
de6cb9d5 MJ |
35 | # Set to number of active CPUS |
36 | NUM_CPUS="$(urcu_nproc)" | |
ad460058 MD |
37 | if [[ ${NUM_CPUS} -lt 4 ]]; then |
38 | NUM_CPUS=4 # Floor at 4 due to following assumptions. | |
39 | fi | |
40 | ||
f80aadcd MJ |
41 | # batch: 19 * 1 = 19 |
42 | # fraction: 15 * 29 = | |
43 | # scalabilit NUM_CPUS * 15 | |
44 | # reader 15 * 23 = | |
748f9af1 | 45 | NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 )) |
f80aadcd MJ |
46 | |
47 | plan_tests ${NUM_TESTS} | |
48 | ||
49 | #run all tests | |
50 | diag "Executing URCU tests" | |
51 | ||
9e31d0f0 MD |
52 | |
53 | #extra options, e.g. for setting affinity on even CPUs : | |
e4ca4127 | 54 | #EXTRA_OPTS=$(for a in $(seq 0 2 127); do echo -n "-a ${a} "; done) |
9e31d0f0 | 55 | |
ec3aaabb | 56 | #ppc64 striding, use with NUM_CPUS=8 |
57 | ||
58 | #stride 1 | |
59 | #EXTRA_OPTS=$(for a in $(seq 0 2 15); do echo -n "-a ${a} "; done) | |
60 | #stride 2 | |
61 | #EXTRA_OPTS=$(for a in $(seq 0 4 31); do echo -n "-a ${a} "; done) | |
62 | #stride 4 | |
63 | #EXTRA_OPTS=$(for a in $(seq 0 8 63); do echo -n "-a ${a} "; done) | |
64 | #stride 8 | |
65 | #EXTRA_OPTS=$(for a in $(seq 0 16 127); do echo -n "-a ${a} "; done) | |
9e31d0f0 MD |
66 | |
67 | #Vary update fraction | |
68 | #x: vary update fraction from 0 to 0.0001 | |
69 | #fix number of readers and reader C.S. length, vary delay between updates | |
70 | #y: ops/s | |
de6cb9d5 | 71 | EXTRA_OPTS="" |
9e31d0f0 | 72 | |
a813abf8 | 73 | |
ad460058 | 74 | diag "Executing batch RCU test" |
a813abf8 | 75 | |
bb9a66cb MD |
76 | BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 |
77 | 131072 262144" | |
f80aadcd MJ |
78 | BATCH_TEST_ARRAY="test_urcu_gc" |
79 | ||
748f9af1 MJ |
80 | NR_WRITERS=$((NUM_CPUS / 2)) |
81 | NR_READERS=$((NUM_CPUS - NR_WRITERS)) | |
a813abf8 | 82 | |
a813abf8 | 83 | for BATCH_SIZE in ${BATCH_ARRAY}; do |
f80aadcd | 84 | for TEST in ${BATCH_TEST_ARRAY}; do |
de6cb9d5 | 85 | okx ${URCU_TESTS_TIME_BIN} "${URCU_TESTS_BUILDDIR}/benchmark/${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \ |
748f9af1 | 86 | -d 0 -b "${BATCH_SIZE}" ${EXTRA_OPTS} 2>"${TMPFILE}" |
de6cb9d5 | 87 | while read -r line; do |
748f9af1 MJ |
88 | echo "## $line" |
89 | done <"${TMPFILE}" | |
f80aadcd | 90 | done |
a813abf8 MD |
91 | done |
92 | ||
f80aadcd MJ |
93 | TEST_ARRAY="test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc |
94 | test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc | |
95 | test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr | |
96 | test_rwlock test_perthreadlock test_mutex" | |
97 | ||
a74e263c | 98 | #setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE ** |
31bb09e2 | 99 | EXTRA_OPTS="${EXTRA_OPTS} -b 32768" |
a813abf8 | 100 | |
ad460058 | 101 | diag "Executing update fraction test" |
9e31d0f0 | 102 | |
9e31d0f0 | 103 | WDELAY_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 |
d109adc2 MD |
104 | 65536 131072 262144 524288 1048576 2097152 4194304 8388608 |
105 | 16777216 33554432 67108864 134217728" | |
748f9af1 MJ |
106 | NR_WRITERS=$((NUM_CPUS / 2)) |
107 | NR_READERS=$((NUM_CPUS - NR_WRITERS)) | |
9e31d0f0 | 108 | |
d42a8f3e | 109 | for WDELAY in ${WDELAY_ARRAY}; do |
f80aadcd | 110 | for TEST in ${TEST_ARRAY}; do |
de6cb9d5 | 111 | okx ${URCU_TESTS_TIME_BIN} "${URCU_TESTS_BUILDDIR}/benchmark/${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \ |
748f9af1 | 112 | -d "${WDELAY}" ${EXTRA_OPTS} 2>"${TMPFILE}" |
de6cb9d5 | 113 | while read -r line; do |
748f9af1 MJ |
114 | echo "## $line" |
115 | done <"${TMPFILE}" | |
f80aadcd | 116 | done |
d42a8f3e | 117 | done |
9e31d0f0 | 118 | |
9e31d0f0 MD |
119 | #Test scalability : |
120 | # x: vary number of readers from 0 to num cpus | |
121 | # y: ops/s | |
122 | # 0 writer. | |
123 | ||
ad460058 | 124 | diag "Executing scalability test" |
9e31d0f0 MD |
125 | |
126 | NR_WRITERS=0 | |
9e31d0f0 | 127 | |
de6cb9d5 | 128 | for NR_READERS in $(urcu_xseq 1 ${NUM_CPUS}); do |
f80aadcd | 129 | for TEST in ${TEST_ARRAY}; do |
de6cb9d5 | 130 | okx ${URCU_TESTS_TIME_BIN} "${URCU_TESTS_BUILDDIR}/benchmark/${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \ |
748f9af1 | 131 | ${EXTRA_OPTS} 2>"${TMPFILE}" |
de6cb9d5 | 132 | while read -r line; do |
748f9af1 MJ |
133 | echo "## $line" |
134 | done <"${TMPFILE}" | |
f80aadcd | 135 | done |
9e31d0f0 MD |
136 | done |
137 | ||
138 | ||
139 | # x: Vary reader C.S. length from 0 to 100 us | |
140 | # y: ops/s | |
141 | # 8 readers | |
142 | # 0 writers | |
143 | ||
ad460058 | 144 | diag "Executing reader C.S. length test" |
9e31d0f0 | 145 | |
2b1e60a4 | 146 | NR_READERS=${NUM_CPUS} |
9e31d0f0 | 147 | NR_WRITERS=0 |
9e31d0f0 | 148 | #in loops. |
637dc445 | 149 | READERCSLEN_ARRAY="0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152" |
9e31d0f0 | 150 | |
9e31d0f0 | 151 | for READERCSLEN in ${READERCSLEN_ARRAY}; do |
f80aadcd | 152 | for TEST in ${TEST_ARRAY}; do |
de6cb9d5 | 153 | okx ${URCU_TESTS_TIME_BIN} "${URCU_TESTS_BUILDDIR}/benchmark/${TEST}" "${NR_READERS}" "${NR_WRITERS}" "${DURATION}" \ |
748f9af1 | 154 | -c "${READERCSLEN}" ${EXTRA_OPTS} 2>"${TMPFILE}" |
de6cb9d5 | 155 | while read -r line; do |
748f9af1 MJ |
156 | echo "## $line" |
157 | done <"${TMPFILE}" | |
f80aadcd | 158 | done |
9e31d0f0 | 159 | done |