# reasonable distribution graph of the latency values.
REAL_TRIES=100000
+# OS-dependent constant used for calculating delays between sent messages.
+# Borrowed from the source code of the IPC tests for consistency.
+readonly ONE_PAGE_SIZE=4096
+
run_ipc_tests() {
if [ ! -d $1 ]; then
if mkdir $1; then
# a heavily loaded system.
sleep 10
LIBDBUS_P2P_TRY_COUNT=`expr $3 + 1000`
- libdbus-p2p-client -m $2 -t $LIBDBUS_P2P_TRY_COUNT -d 50
+
+ # The following piece of code, that sets the value of the
+ # `LIBDBUS_P2P_TRY_COUNT` variable, is an exact reflection of the same
+ # code snippet found in the other IPC tests. It sets the delay between
+ # sent messages to prevent latencies from stacking.
+ # The reason why this is here is that it's parametrized in the libdbus
+ # p2p test, while in other IPC tests it's hard-coded.
+
+ if [ "$2" -le "$ONE_PAGE_SIZE" ]; then
+ LIBDBUS_P2P_DELAY=5000;
+ elif [ "$2" -le `expr 10 \* $ONE_PAGE_SIZE` ]; then
+ LIBDBUS_P2P_DELAY=10000;
+ elif [ "$2" -le `expr 100 \* $ONE_PAGE_SIZE` ]; then
+ LIBDBUS_P2P_DELAY=20000;
+ else
+ LIBDBUS_P2P_DELAY=40000;
+ fi
+
+ libdbus-p2p-client -m $2 -t $LIBDBUS_P2P_TRY_COUNT -d $LIBDBUS_P2P_DELAY
pipe -m $2 -l -r -t $3
socket -m $2 -l -r -t $3
sharedmem -m $2 -l -r -t $3
# tests under heavy load
-# hackbench produces 40 processes times the value,
-# the resulting 560 processes is arbitrary but "a lot"
-readonly PROCESS_COUNT=14
+# hackbench produces #groups times #file descriptors times 2 processes.
+# The resulting 72 processes is arbitrary but enough to generate a load of
+# about 25-30 on x64 and RPi4. This mimics the real working environment of
+# a heavily loaded system.
+readonly GROUPS_COUNT=6
+readonly FILE_DESC_COUNT=6
# enough messages to keep the rest of the system busy
# throughout the entire dbus test
-readonly MESSAGE_COUNT=9900000
+readonly MESSAGE_COUNT=1000000000
-hackbench --pipe --groups $PROCESS_COUNT --loops $MESSAGE_COUNT &
+hackbench --pipe --groups $GROUPS_COUNT --fds $FILE_DESC_COUNT --loops $MESSAGE_COUNT &
HACKBENCH_PID=$!
run_ipc_tests load_small $SMALL_MSG_SIZE $REAL_TRIES