From: Adam Michalski Date: Wed, 5 Jan 2022 17:52:18 +0000 (+0100) Subject: Add batch tests runner script X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2617296ecd601cf65cdd0b04c449e2f322dc52eb;p=platform%2Fcore%2Fsystem%2Fdbus-tools.git Add batch tests runner script Change-Id: I3f809534cd71dfe906336f21db1ce403f924eca8 --- diff --git a/Makefile b/Makefile index 786cf13..42d09a5 100644 --- a/Makefile +++ b/Makefile @@ -33,3 +33,4 @@ install: cp benchmark/libdbus-p2p-server $(DESTDIR)/usr/bin/libdbus-p2p-server cp benchmark/libdbus-p2p-client $(DESTDIR)/usr/bin/libdbus-p2p-client cp benchmark/libdbus $(DESTDIR)/usr/bin/libdbus + cp benchmark/dbus-tools-batch-tests.sh $(DESTDIR)/usr/bin/dbus-tools-batch-tests.sh diff --git a/benchmark/dbus-tools-batch-tests.sh b/benchmark/dbus-tools-batch-tests.sh new file mode 100755 index 0000000..f432689 --- /dev/null +++ b/benchmark/dbus-tools-batch-tests.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +# Large message size default arbitrarily set to 16 kB. Allows to get an idea of +# how the latency values differ from the latencies for small message sizes. +# Could easily be overriden with the `-l` option if necessary. +LARGE_MSG_SIZE=16384 + +# Small message size default arbitrarily set to 32 bytes. Assuming that D-Bus +# header contains more information for the communication via the daemon than for +# the peer to peer, 32 bytes seems to be the reasonable choice for a very small +# message. However, the differences between 32, 64 and 128 byte messages are +# negligible. Could be overriden with the `-s` option if necessary. +SMALL_MSG_SIZE=32 + +# Number of real tries. Should be at least 100000 if we want to make a +# reasonable distribution graph of the latency values. +REAL_TRIES=100000 + +run_ipc_tests() { + if [ ! -d $1 ]; then + if mkdir $1; then + echo "Subdirectory '$1' created" 1>&2 + else + echo "Cannot create '$1' subdirectory" 1>&2 + exit 1 + fi + fi + + p2p-gdbus -m $2 -l -r -t $3 + gdbus -m $2 -l -r -t $3 + libdbus -m $2 -l -r -t $3 + libdbus-p2p-server -r & + # Give the server some time to run and start listening for a connection. + # Arbitrarily chosen 10 second delay seems to do the trick, even on + # 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 + pipe -m $2 -l -r -t $3 + socket -m $2 -l -r -t $3 + sharedmem -m $2 -l -r -t $3 + + mv p2pgdbus-latency.csv $1/ + mv gdbus-latency.csv $1/ + mv libdbus-latency.csv $1/ + mv libdbus-p2p-latency.csv $1/ + mv pipe-latency.csv $1/ + mv socket-latency.csv $1/ + mv sharedmem-latency.csv $1/ +} + +while [ $# -gt 0 ] +do + case $1 in + -h) printf "Usage: $0 [-l large_msg_size] [-s small_msg_size] [-r real_tries]\n" + exit 1 + ;; + -l) LARGE_MSG_SIZE=$2 + shift + ;; + -s) SMALL_MSG_SIZE=$2 + shift + ;; + -r) REAL_TRIES=$2 + shift + ;; + -*) printf "Wrong option: $1. Type \`$0 -h\` for help.\n" 1>&2 + break + ;; + esac + shift +done + +# tests without load +run_ipc_tests no_load_small $SMALL_MSG_SIZE $REAL_TRIES +run_ipc_tests no_load_large $LARGE_MSG_SIZE $REAL_TRIES + +# perfrom tests under load only when hackbench is present +if [ ! -x /usr/bin/hackbench ]; then + echo "hackbench not installed. Cannot perform tests with load." 1>&2 + exit 1 +fi + +# tests under heavy load + +# hackbench produces 40 processes times the value, +# the resulting 560 processes is arbitrary but "a lot" +readonly PROCESS_COUNT=14 + +# enough messages to keep the rest of the system busy +# throughout the entire dbus test +readonly MESSAGE_COUNT=9900000 + +hackbench --pipe --groups $PROCESS_COUNT --loops $MESSAGE_COUNT & +HACKBENCH_PID=$! + +run_ipc_tests load_small $SMALL_MSG_SIZE $REAL_TRIES +run_ipc_tests load_large $LARGE_MSG_SIZE $REAL_TRIES + +# since hackbench's managing process handles SIGTERM by broadcasting the signal +# to every child process, it's enough to kill the main instance +kill $HACKBENCH_PID + diff --git a/packaging/dbus-tools.spec b/packaging/dbus-tools.spec index 23d11eb..1822d11 100644 --- a/packaging/dbus-tools.spec +++ b/packaging/dbus-tools.spec @@ -59,3 +59,4 @@ make %{_bindir}/libdbus-p2p-server %{_bindir}/libdbus-p2p-client %{_bindir}/p2p-gdbus +%{_bindir}/dbus-tools-batch-tests.sh