Skip to content
Snippets Groups Projects
benchmark.sh 3.42 KiB
Newer Older
Reiner Jung's avatar
Reiner Jung committed
#!/bin/bash

#
# Kieker python benchmark script
Reiner Jung's avatar
Reiner Jung committed
#
# Usage: benchmark.sh
Reiner Jung's avatar
Reiner Jung committed

# configure base dir
BASE_DIR=$(cd "$(dirname "$0")"; pwd)

#
# source functionality
#

if [ ! -d "${BASE_DIR}" ] ; then
	echo "Base directory ${BASE_DIR} does not exist."
	exit 1
fi

MAIN_DIR="${BASE_DIR}/../.."

if [ -f "${MAIN_DIR}/common-functions.sh" ] ; then
	source "${MAIN_DIR}/common-functions.sh"
Reiner Jung's avatar
Reiner Jung committed
else
	echo "Missing library: ${MAIN_DIR}/common-functions.sh"
Reiner Jung's avatar
Reiner Jung committed
	exit 1
fi

# load configuration and common functions
if [ -f "${BASE_DIR}/config.rc" ] ; then
	source "${BASE_DIR}/config.rc"
Reiner Jung's avatar
Reiner Jung committed
else
	echo "Missing configuration: ${BASE_DIR}/config.rc"
Reiner Jung's avatar
Reiner Jung committed
	exit 1
fi

if [ -f "${BASE_DIR}/functions.sh" ] ; then
	source "${BASE_DIR}/functions.sh"
else
	echo "Missing functions: ${BASE_DIR}/functions.sh"
Reiner Jung's avatar
Reiner Jung committed
	exit 1
fi
if [ -f "${BASE_DIR}/labels.sh" ] ; then
	source "${BASE_DIR}/labels.sh"
else
	echo "Missing file: ${BASE_DIR}/labels.sh"
	exit 1
fi
if [ -z "$MOOBENCH_CONFIGURATIONS" ]
then
	MOOBENCH_CONFIGURATIONS="0 1 3 4"
	echo "Setting default configuration $MOOBENCH_CONFIGURATIONS (without text logging)"
fi
echo "Running configurations: $MOOBENCH_CONFIGURATIONS"

Reiner Jung's avatar
Reiner Jung committed
#
# Setup
#

info "----------------------------------"
info "Setup..."
info "----------------------------------"

cd "${BASE_DIR}"

# load agent
getAgent

checkFile log "${DATA_DIR}/kieker.log" clean
Reiner Jung's avatar
Reiner Jung committed
checkDirectory results-directory "${RESULTS_DIR}" recreate
PARENT=`dirname "${RESULTS_DIR}"`
checkDirectory result-base "${PARENT}"
checkDirectory data-dir "${DATA_DIR}" create
Reiner Jung's avatar
Reiner Jung committed

Reiner Jung's avatar
Reiner Jung committed
# Find receiver and extract it
checkFile receiver "${RECEIVER_ARCHIVE}"
tar -xpf "${RECEIVER_ARCHIVE}"
RECEIVER_BIN="${BASE_DIR}/receiver/bin/receiver"
Reiner Jung's avatar
Reiner Jung committed
checkExecutable receiver "${RECEIVER_BIN}"
Reiner Jung's avatar
Reiner Jung committed

checkFile R-script "${RSCRIPT_PATH}"

showParameter

TIME=`expr ${METHOD_TIME} \* ${TOTAL_NUM_OF_CALLS} / 1000000000 \* 4 \* ${RECURSION_DEPTH} \* ${NUM_OF_LOOPS} + ${SLEEP_TIME} \* 4 \* ${NUM_OF_LOOPS}  \* ${RECURSION_DEPTH} + 50 \* ${TOTAL_NUM_OF_CALLS} / 1000000000 \* 4 \* ${RECURSION_DEPTH} \* ${NUM_OF_LOOPS} `
info "Experiment will take circa ${TIME} seconds."

# Receiver setup if necessary
declare -a RECEIVER
# Title
declare -a TITLE

RECEIVER[5]="${RECEIVER_BIN} 2345"

#
# Write configuration
#

uname -a > "${RESULTS_DIR}/configuration.txt"
cat << EOF >> "${RESULTS_DIR}/configuration.txt"
Runtime: circa ${TIME} seconds

SLEEP_TIME=${SLEEP_TIME}
NUM_OF_LOOPS=${NUM_OF_LOOPS}
TOTAL_NUM_OF_CALLS=${TOTAL_NUM_OF_CALLS}
METHOD_TIME=${METHOD_TIME}
RECURSION_DEPTH=${RECURSION_DEPTH}
EOF

sync

Reiner Jung's avatar
Reiner Jung committed

#
# Run benchmark
#

info "----------------------------------"
info "Running benchmark..."
info "----------------------------------"


## Execute Benchmark
Reiner Jung's avatar
Reiner Jung committed
for ((i=1;i<=${NUM_OF_LOOPS};i+=1)); do

    info "## Starting iteration ${i}/${NUM_OF_LOOPS}"
    echo "## Starting iteration ${i}/${NUM_OF_LOOPS}" >> "${DATA_DIR}/kieker.log"

Reiner Jung's avatar
Reiner Jung committed
    noInstrumentation 0 $i
    deactivatedProbe 1 $i 1
    deactivatedProbe 2 $i 2
Reiner Jung's avatar
Reiner Jung committed
    noLogging 3 $i 1
    noLogging 4 $i 2
Reiner Jung's avatar
Reiner Jung committed
    textLogging 5 $i 1
    textLogging 6 $i 2
Reiner Jung's avatar
Reiner Jung committed
    tcpLogging 7 $i 1
    tcpLogging 8 $i 2
Reiner Jung's avatar
Reiner Jung committed
    printIntermediaryResults "${i}"
Reiner Jung's avatar
Reiner Jung committed

Reiner Jung's avatar
Reiner Jung committed
# Create R labels
LABELS=$(createRLabels)
runStatistics
cleanupResults
mv "${DATA_DIR}/kieker.log" "${RESULTS_DIR}/kieker.log"
rm "${DATA_DIR}/kieker"
[ -f "${DATA_DIR}/errorlog.txt" ] && mv "${DATA_DIR}/errorlog.txt" "${RESULTS_DIR}"

checkFile results.yaml "${RESULTS_DIR}/results.yaml"
checkFile results.yaml "${RESULTS_DIR}/results.zip"

Reiner Jung's avatar
Reiner Jung committed
info "Done."

Reiner Jung's avatar
Reiner Jung committed
# end