Fix: change method used by _rcu_dereference to strip type constness
[urcu.git] / tests / benchmark / run-urcu-tests.sh
CommitLineData
ad460058 1#!/bin/bash
de6cb9d5
MJ
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
6#
7
8if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
9 UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
10else
11 UTILSSH="$(dirname "$0")/../utils/utils.sh"
12fi
13
14# Enable TAP
15SH_TAP=1
16
17# shellcheck source=../utils/utils.sh
18source "$UTILSSH"
ad460058 19
de6cb9d5
MJ
20
21# First parameter: seconds per test
f80aadcd 22DURATION=$1
ad460058 23
748f9af1 24if [ "x${DURATION}" = "x" ]; then
f80aadcd
MJ
25 echo "usage: $0 [DURATION]"
26 exit 1
27fi
ad460058 28
de6cb9d5
MJ
29# Create a temporary file for tests output
30TMPFILE=$(mktemp)
31
32# Set trap to delete the temporary file on exit and call tap.sh '_exit'
33trap 'rm -f "$TMPFILE"; _exit' EXIT
fba91a85 34
de6cb9d5
MJ
35# Set to number of active CPUS
36NUM_CPUS="$(urcu_nproc)"
ad460058
MD
37if [[ ${NUM_CPUS} -lt 4 ]]; then
38 NUM_CPUS=4 # Floor at 4 due to following assumptions.
39fi
40
f80aadcd
MJ
41# batch: 19 * 1 = 19
42# fraction: 15 * 29 =
43# scalabilit NUM_CPUS * 15
44# reader 15 * 23 =
748f9af1 45NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 ))
f80aadcd
MJ
46
47plan_tests ${NUM_TESTS}
48
49#run all tests
50diag "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 71EXTRA_OPTS=""
9e31d0f0 72
a813abf8 73
ad460058 74diag "Executing batch RCU test"
a813abf8 75
bb9a66cb
MD
76BATCH_ARRAY="1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
77 131072 262144"
f80aadcd
MJ
78BATCH_TEST_ARRAY="test_urcu_gc"
79
748f9af1
MJ
80NR_WRITERS=$((NUM_CPUS / 2))
81NR_READERS=$((NUM_CPUS - NR_WRITERS))
a813abf8 82
a813abf8 83for 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
91done
92
f80aadcd
MJ
93TEST_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 99EXTRA_OPTS="${EXTRA_OPTS} -b 32768"
a813abf8 100
ad460058 101diag "Executing update fraction test"
9e31d0f0 102
9e31d0f0 103WDELAY_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
106NR_WRITERS=$((NUM_CPUS / 2))
107NR_READERS=$((NUM_CPUS - NR_WRITERS))
9e31d0f0 108
d42a8f3e 109for 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 117done
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 124diag "Executing scalability test"
9e31d0f0
MD
125
126NR_WRITERS=0
9e31d0f0 127
de6cb9d5 128for 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
136done
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 144diag "Executing reader C.S. length test"
9e31d0f0 145
2b1e60a4 146NR_READERS=${NUM_CPUS}
9e31d0f0 147NR_WRITERS=0
9e31d0f0 148#in loops.
637dc445 149READERCSLEN_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 151for 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 159done
This page took 0.052219 seconds and 4 git commands to generate.