Skip to content
Snippets Groups Projects
benchmark.sh 4.87 KiB
Newer Older
#
# Kieker benchmark script
#
# Usage: benchmark.sh
# 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"
	echo "Missing library: ${MAIN_DIR}/common-functions.sh"
# 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"
Reiner Jung's avatar
Reiner Jung committed
else
	echo "Missing: ${BASE_DIR}/functions.sh"
	exit 1
fi
if [ -f "${BASE_DIR}/labels.sh" ] ; then
	source "${BASE_DIR}/labels.sh"
else
	echo "Missing file: ${BASE_DIR}/labels.sh"
Reiner Jung's avatar
Reiner Jung committed
	exit 1
fi
#
# Setup
#

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

# This is necessary, as the framework name is originally
# derived from the directory the script is sitting in, but
# Kieker supports multiple languages and has multiple
# sub directories for each programming language.
export FRAMEWORK_NAME="kieker-${FRAMEWORK_NAME}"

Reiner Jung's avatar
Reiner Jung committed
cd "${BASE_DIR}"

# load agent
getAgent

Reiner Jung's avatar
Reiner Jung committed
checkDirectory data-dir "${DATA_DIR}" create
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}"

# 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}"
checkFile ApsectJ-Agent "${AGENT}"
checkFile aop-file "${AOP}"

checkExecutable java "${JAVA_BIN}"
Reiner Jung's avatar
Reiner Jung committed
checkExecutable moobench "${MOOBENCH_BIN}"
checkFile R-script "${RSCRIPT_PATH}"
Reiner Jung's avatar
Reiner Jung committed
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."
JAVA_ARGS="-Xms1G -Xmx2G"
Reiner Jung's avatar
Reiner Jung committed
LTW_ARGS="-javaagent:${AGENT} --illegal-access=permit -Dorg.aspectj.weaver.showWeaveInfo=true -Daj.weaving.verbose=true -Dkieker.monitoring.skipDefaultAOPConfiguration=true -Dorg.aspectj.weaver.loadtime.configuration=file://${AOP}"

KIEKER_ARGS="-Dlog4j.configuration=log4j.cfg -Dkieker.monitoring.name=KIEKER-BENCHMARK -Dkieker.monitoring.adaptiveMonitoring.enabled=false -Dkieker.monitoring.periodicSensorsExecutorPoolSize=0"

# JAVA_ARGS used to configure and setup a specific writer
declare -a WRITER_CONFIG
# Receiver setup if necessary
declare -a RECEIVER
# Title
declare -a TITLE

Reiner Jung's avatar
Reiner Jung committed
#
# Different writer setups
#
WRITER_CONFIG[0]=""
WRITER_CONFIG[1]="-Dkieker.monitoring.enabled=false -Dkieker.monitoring.writer=kieker.monitoring.writer.dump.DumpWriter"
WRITER_CONFIG[2]="-Dkieker.monitoring.enabled=true -Dkieker.monitoring.writer=kieker.monitoring.writer.dump.DumpWriter"
WRITER_CONFIG[3]="-Dkieker.monitoring.enabled=true -Dkieker.monitoring.writer=kieker.monitoring.writer.filesystem.FileWriter -Dkieker.monitoring.writer.filesystem.FileWriter.logStreamHandler=kieker.monitoring.writer.filesystem.TextLogStreamHandler -Dkieker.monitoring.writer.filesystem.FileWriter.customStoragePath=${DATA_DIR}/"
WRITER_CONFIG[4]="-Dkieker.monitoring.enabled=true -Dkieker.monitoring.writer=kieker.monitoring.writer.filesystem.FileWriter -Dkieker.monitoring.writer.filesystem.FileWriter.logStreamHandler=kieker.monitoring.writer.filesystem.BinaryLogStreamHandler -Dkieker.monitoring.writer.filesystem.FileWriter.bufferSize=8192 -Dkieker.monitoring.writer.filesystem.FileWriter.customStoragePath=${DATA_DIR}/"
WRITER_CONFIG[5]="-Dkieker.monitoring.writer=kieker.monitoring.writer.tcp.SingleSocketTcpWriter -Dkieker.monitoring.writer.tcp.SingleSocketTcpWriter.port=2345"
Reiner Jung's avatar
Reiner Jung committed
RECEIVER[5]="${RECEIVER_BIN} 2345"
writeConfiguration
# Run benchmark
#

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

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"

    executeBenchmark

    printIntermediaryResults
done
Reiner Jung's avatar
Reiner Jung committed

# Create R labels
LABELS=$(createRLabels)
runStatistics
Reiner Jung's avatar
Reiner Jung committed
cleanupResults
mv "${DATA_DIR}/kieker.log" "${RESULTS_DIR}/kieker.log"
[ -f "${RESULTS_DIR}/hotspot-1-${RECURSION_DEPTH}-1.log" ] && grep "<task " "${RESULTS_DIR}/"hotspot-*.log > "${RESULTS_DIR}/java.log"
[ -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"