Skip to content
Snippets Groups Projects
Commit aecedd0f authored by David Georg Reichelt's avatar David Georg Reichelt
Browse files

Extract common functions and make parameters setable by environment

variables
parent 2de365cc
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
function getSum {
awk '{sum += $1; square += $1^2} END {print "Average: "sum/NR" Standard Deviation: "sqrt(square / NR - (sum/NR)^2)" Count: "NR}'
}
## Clean up raw results
function cleanup-results() {
zip -jqr ${RESULTS_DIR}/results.zip ${RAWFN}*
rm -f ${RAWFN}*
[ -f ${DATA_DIR}/nohup.out ] && cp ${DATA_DIR}/nohup.out ${RESULTS_DIR}
[ -f ${DATA_DIR}/nohup.out ] && > ${DATA_DIR}/nohup.out
}
# Initialize all unset parameters
if [ -z $SLEEPTIME ]; then
SLEEPTIME=30 ## 30
fi
if [ -z $NUM_LOOPS ]; then
NUM_LOOPS=10 ## 10
fi
if [ -z $THREADS ]; then
THREADS=1 ## 1
fi
if [ -z $RECURSIONDEPTH ]; then
RECURSIONDEPTH=10 ## 10
fi
if [ -z $TOTALCALLS ]; then
TOTALCALLS=2000000 ## 2000000
fi
if [ -z $METHODTIME ]; then
METHODTIME=0 ## 500000
fi
if [ -z $DEBUG ]; then
DEBUG=false ## false
fi
...@@ -61,7 +61,7 @@ function runNoInstrumentation { ...@@ -61,7 +61,7 @@ function runNoInstrumentation {
--method-time ${METHODTIME} \ --method-time ${METHODTIME} \
--total-threads ${THREADS} \ --total-threads ${THREADS} \
--recursion-depth ${j} \ --recursion-depth ${j} \
${MOREPARAMS} &> ${RESULTSDIR}output_"$i"_uninstrumented.txt ${MOREPARAMS} &> ${RESULTS_DIR}output_"$i"_uninstrumented.txt
} }
function runOpenTelemetryNoLogging { function runOpenTelemetryNoLogging {
...@@ -75,7 +75,7 @@ function runOpenTelemetryNoLogging { ...@@ -75,7 +75,7 @@ function runOpenTelemetryNoLogging {
--method-time ${METHODTIME} \ --method-time ${METHODTIME} \
--total-threads ${THREADS} \ --total-threads ${THREADS} \
--recursion-depth ${j} \ --recursion-depth ${j} \
${MOREPARAMS} &> ${RESULTSDIR}output_"$i"_opentelemetry.txt ${MOREPARAMS} &> ${RESULTS_DIR}output_"$i"_opentelemetry.txt
} }
function runOpenTelemetryLogging { function runOpenTelemetryLogging {
...@@ -89,10 +89,10 @@ function runOpenTelemetryLogging { ...@@ -89,10 +89,10 @@ function runOpenTelemetryLogging {
--method-time ${METHODTIME} \ --method-time ${METHODTIME} \
--total-threads ${THREADS} \ --total-threads ${THREADS} \
--recursion-depth ${j} \ --recursion-depth ${j} \
${MOREPARAMS} &> ${RESULTSDIR}output_"$i"_opentelemetry_logging.txt ${MOREPARAMS} &> ${RESULTS_DIR}output_"$i"_opentelemetry_logging.txt
if [ ! "$DEBUG" = true ] if [ ! "$DEBUG" = true ]
then then
rm ${RESULTSDIR}output_"$i"_opentelemetry_logging.txt rm ${RESULTS_DIR}output_"$i"_opentelemetry_logging.txt
fi fi
} }
...@@ -108,7 +108,7 @@ function runOpenTelemetryZipkin { ...@@ -108,7 +108,7 @@ function runOpenTelemetryZipkin {
--method-time ${METHODTIME} \ --method-time ${METHODTIME} \
--total-threads ${THREADS} \ --total-threads ${THREADS} \
--recursion-depth ${j} \ --recursion-depth ${j} \
${MOREPARAMS} &> ${RESULTSDIR}output_"$i"_opentelemetry_zipkin.txt ${MOREPARAMS} &> ${RESULTS_DIR}output_"$i"_opentelemetry_zipkin.txt
stopBackgroundProcess stopBackgroundProcess
} }
...@@ -140,14 +140,10 @@ function runOpenTelemetryPrometheus { ...@@ -140,14 +140,10 @@ function runOpenTelemetryPrometheus {
--method-time ${METHODTIME} \ --method-time ${METHODTIME} \
--total-threads ${THREADS} \ --total-threads ${THREADS} \
--recursion-depth ${j} \ --recursion-depth ${j} \
${MOREPARAMS} &> ${RESULTSDIR}output_"$i"_opentelemetry_prometheus.txt ${MOREPARAMS} &> ${RESULTS_DIR}output_"$i"_opentelemetry_prometheus.txt
stopBackgroundProcess stopBackgroundProcess
} }
function getSum {
awk '{sum += $1; square += $1^2} END {print "Average: "sum/NR" Standard Deviation: "sqrt(square / NR - (sum/NR)^2)" Count: "NR}'
}
function printIntermediaryResults { function printIntermediaryResults {
echo -n "Intermediary results uninstrumented " echo -n "Intermediary results uninstrumented "
cat results-opentelemetry/raw-*-$RECURSIONDEPTH-0.csv | awk -F';' '{print $2}' | getSum cat results-opentelemetry/raw-*-$RECURSIONDEPTH-0.csv | awk -F';' '{print $2}' | getSum
...@@ -178,15 +174,9 @@ JAVABIN="" ...@@ -178,15 +174,9 @@ JAVABIN=""
RSCRIPTDIR=r/ RSCRIPTDIR=r/
BASEDIR=./ BASEDIR=./
RESULTSDIR="${BASEDIR}results-opentelemetry/" RESULTS_DIR="${BASEDIR}results-opentelemetry/"
SLEEPTIME=30 ## 30 source ../common-functions.sh
NUM_LOOPS=10 ## 10
THREADS=1 ## 1
RECURSIONDEPTH=10 ## 10
TOTALCALLS=2000000 ## 2000000
METHODTIME=0 ## 500000
DEBUG=false ## false
#MOREPARAMS="--quickstart" #MOREPARAMS="--quickstart"
MOREPARAMS="--application moobench.application.MonitoredClassSimple ${MOREPARAMS}" MOREPARAMS="--application moobench.application.MonitoredClassSimple ${MOREPARAMS}"
...@@ -194,15 +184,15 @@ MOREPARAMS="--application moobench.application.MonitoredClassSimple ${MOREPARAMS ...@@ -194,15 +184,15 @@ MOREPARAMS="--application moobench.application.MonitoredClassSimple ${MOREPARAMS
TIME=`expr ${METHODTIME} \* ${TOTALCALLS} / 1000000000 \* 4 \* ${RECURSIONDEPTH} \* ${NUM_LOOPS} + ${SLEEPTIME} \* 4 \* ${NUM_LOOPS} \* ${RECURSIONDEPTH} + 50 \* ${TOTALCALLS} / 1000000000 \* 4 \* ${RECURSIONDEPTH} \* ${NUM_LOOPS} ` TIME=`expr ${METHODTIME} \* ${TOTALCALLS} / 1000000000 \* 4 \* ${RECURSIONDEPTH} \* ${NUM_LOOPS} + ${SLEEPTIME} \* 4 \* ${NUM_LOOPS} \* ${RECURSIONDEPTH} + 50 \* ${TOTALCALLS} / 1000000000 \* 4 \* ${RECURSIONDEPTH} \* ${NUM_LOOPS} `
echo "Experiment will take circa ${TIME} seconds." echo "Experiment will take circa ${TIME} seconds."
echo "Removing and recreating '$RESULTSDIR'" echo "Cleaning and recreating '$RESULTS_DIR'"
(rm -rf ${RESULTSDIR}) && mkdir -p ${RESULTSDIR} (rm -rf ${RESULTS_DIR}/**csv) && mkdir -p ${RESULTS_DIR}
#mkdir ${RESULTSDIR}stat/ #mkdir ${RESULTS_DIR}stat/
# Clear opentelemetry.log and initialize logging # Clear opentelemetry.log and initialize logging
rm -f ${BASEDIR}opentelemetry.log rm -f ${BASEDIR}opentelemetry.log
touch ${BASEDIR}opentelemetry.log touch ${BASEDIR}opentelemetry.log
RAWFN="${RESULTSDIR}raw" RAWFN="${RESULTS_DIR}raw"
JAVAARGS="-server" JAVAARGS="-server"
JAVAARGS="${JAVAARGS} " JAVAARGS="${JAVAARGS} "
...@@ -236,18 +226,18 @@ JAVAARGS_OPENTELEMETRY_PROMETHEUS="${JAVAARGS_OPENTELEMETRY_BASIC} -Dotel.traces ...@@ -236,18 +226,18 @@ JAVAARGS_OPENTELEMETRY_PROMETHEUS="${JAVAARGS_OPENTELEMETRY_BASIC} -Dotel.traces
## Write configuration ## Write configuration
uname -a >${RESULTSDIR}configuration.txt uname -a >${RESULTS_DIR}configuration.txt
${JAVABIN}java ${JAVAARGS} -version 2>>${RESULTSDIR}configuration.txt ${JAVABIN}java ${JAVAARGS} -version 2>>${RESULTS_DIR}configuration.txt
echo "JAVAARGS: ${JAVAARGS}" >>${RESULTSDIR}configuration.txt echo "JAVAARGS: ${JAVAARGS}" >>${RESULTS_DIR}configuration.txt
echo "" >>${RESULTSDIR}configuration.txt echo "" >>${RESULTS_DIR}configuration.txt
echo "Runtime: circa ${TIME} seconds" >>${RESULTSDIR}configuration.txt echo "Runtime: circa ${TIME} seconds" >>${RESULTS_DIR}configuration.txt
echo "" >>${RESULTSDIR}configuration.txt echo "" >>${RESULTS_DIR}configuration.txt
echo "SLEEPTIME=${SLEEPTIME}" >>${RESULTSDIR}configuration.txt echo "SLEEPTIME=${SLEEPTIME}" >>${RESULTS_DIR}configuration.txt
echo "NUM_LOOPS=${NUM_LOOPS}" >>${RESULTSDIR}configuration.txt echo "NUM_LOOPS=${NUM_LOOPS}" >>${RESULTS_DIR}configuration.txt
echo "TOTALCALLS=${TOTALCALLS}" >>${RESULTSDIR}configuration.txt echo "TOTALCALLS=${TOTALCALLS}" >>${RESULTS_DIR}configuration.txt
echo "METHODTIME=${METHODTIME}" >>${RESULTSDIR}configuration.txt echo "METHODTIME=${METHODTIME}" >>${RESULTS_DIR}configuration.txt
echo "THREADS=${THREADS}" >>${RESULTSDIR}configuration.txt echo "THREADS=${THREADS}" >>${RESULTS_DIR}configuration.txt
echo "RECURSIONDEPTH=${RECURSIONDEPTH}" >>${RESULTSDIR}configuration.txt echo "RECURSIONDEPTH=${RECURSIONDEPTH}" >>${RESULTS_DIR}configuration.txt
sync sync
## Execute Benchmark ## Execute Benchmark
...@@ -284,14 +274,17 @@ for ((i=1;i<=${NUM_LOOPS};i+=1)); do ...@@ -284,14 +274,17 @@ for ((i=1;i<=${NUM_LOOPS};i+=1)); do
printIntermediaryResults printIntermediaryResults
done done
#zip -jqr ${RESULTSDIR}stat.zip ${RESULTSDIR}stat
#rm -rf ${RESULTSDIR}stat/ cleanup-results
mv ${BASEDIR}opentelemetry.log ${RESULTSDIR}opentelemetry.log
[ -f ${RESULTSDIR}hotspot-1-${RECURSIONDEPTH}-1.log ] && grep "<task " ${RESULTSDIR}hotspot-*.log >${RESULTSDIR}log.log #zip -jqr ${RESULTS_DIR}stat.zip ${RESULTS_DIR}stat
[ -f ${BASEDIR}errorlog.txt ] && mv ${BASEDIR}errorlog.txt ${RESULTSDIR} #rm -rf ${RESULTS_DIR}stat/
mv ${BASEDIR}opentelemetry.log ${RESULTS_DIR}opentelemetry.log
[ -f ${RESULTS_DIR}hotspot-1-${RECURSIONDEPTH}-1.log ] && grep "<task " ${RESULTS_DIR}hotspot-*.log >${RESULTS_DIR}log.log
[ -f ${BASEDIR}errorlog.txt ] && mv ${BASEDIR}errorlog.txt ${RESULTS_DIR}
## Clean up raw results ## Clean up raw results
#gzip -qr ${RESULTSDIR}results.zip ${RAWFN}* #gzip -qr ${RESULTS_DIR}results.zip ${RAWFN}*
#rm -f ${RAWFN}* #rm -f ${RAWFN}*
[ -f ${BASEDIR}nohup.out ] && cp ${BASEDIR}nohup.out ${RESULTSDIR} [ -f ${BASEDIR}nohup.out ] && cp ${BASEDIR}nohup.out ${RESULTS_DIR}
[ -f ${BASEDIR}nohup.out ] && > ${BASEDIR}nohup.out [ -f ${BASEDIR}nohup.out ] && > ${BASEDIR}nohup.out
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment