diff --git a/frameworks/Kieker/python/.gitignore b/frameworks/Kieker/python/.gitignore index d4779b6951a15453d0fddab9c322c05129de4dd5..ce4db221c870bab5df54ade2c85922c1399f2589 100644 --- a/frameworks/Kieker/python/.gitignore +++ b/frameworks/Kieker/python/.gitignore @@ -1,2 +1,5 @@ - __pycache__ /** +__pycache__ /** +config.ini +config.rc +monitoring.ini diff --git a/frameworks/Kieker/python/benchmark.sh b/frameworks/Kieker/python/benchmark.sh index d83631c960212ec6c7fe0625f9e20b5508e52adb..e4956db35104ea5b4ae4d999708ccd4f1f3521d6 100755 --- a/frameworks/Kieker/python/benchmark.sh +++ b/frameworks/Kieker/python/benchmark.sh @@ -44,21 +44,6 @@ else echo "Missing file: ${BASE_DIR}/labels.sh" exit 1 fi - -# -# check command line parameters -# -if [ "$1" == "" ] ; then - MODE="execute" -else - if [ "$1" == "execute" ] ; then - MODE="execute" - else - mode="test" - fi - OPTION="$2" -fi - # # Setup # @@ -72,38 +57,25 @@ cd "${BASE_DIR}" # load agent getAgent +checkDirectory data-dir "${DATA_DIR}" create +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" +checkExecutable receiver "${RECEIVER_BIN}" -PARENT=`dirname "${RESULTS_DIR}"` - -checkDirectory DATA_DIR "${DATA_DIR}" create -checkDirectory result-base "${PARENT}" -checkFile ApsectJ-Agent "${AGENT}" -checkExecutable Receiver "${RECEIVER_BIN}" -checkFile Labels "${BASE_DIR}/labels.sh" checkFile R-script "${RSCRIPT_PATH}" -checkDirectory results-directory "${RESULTS_DIR}" recreate checkFile log "${DATA_DIR}/kieker.log" clean -checkExecutable java "${JAVA_BIN}" -checkExecutable moobench "${MOOBENCH_BIN}" -checkExecutable receiver "${RECEIVER_BIN}" -checkFile aop-file "${AOP}" 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." -# general server arguments -JAVA_ARGS="-Xms1G -Xmx2G" - -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 @@ -111,15 +83,6 @@ declare -a RECEIVER # Title declare -a TITLE -# -# 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" RECEIVER[5]="${RECEIVER_BIN} 2345" # @@ -127,10 +90,7 @@ RECEIVER[5]="${RECEIVER_BIN} 2345" # uname -a > "${RESULTS_DIR}/configuration.txt" -"${JAVA_BIN}" "${JAVA_ARGS}" -version 2>> "${RESULTS_DIR}/configuration.txt" cat << EOF >> "${RESULTS_DIR}/configuration.txt" -JAVA_ARGS: ${JAVA_ARGS} - Runtime: circa ${TIME} seconds SLEEP_TIME=${SLEEP_TIME} @@ -153,20 +113,9 @@ info "----------------------------------" info "Running benchmark..." info "----------------------------------" -if [ "$MODE" == "execute" ] ; then - if [ "$OPTION" == "" ] ; then - executeBenchmark - else - executeBenchmarkBody $OPTION 1 1 - fi - - # Create R labels - LABELS=$(createRLabels) - runStatistics - cleanupResults -else - executeBenchmarkBody $OPTION 1 1 -fi +benchmark + +# cleanup info "Done." diff --git a/frameworks/Kieker/python/config.rc.template b/frameworks/Kieker/python/config.rc.template new file mode 100644 index 0000000000000000000000000000000000000000..1074fc9c93887ba31a80dc760a9299c92dfa1a28 --- /dev/null +++ b/frameworks/Kieker/python/config.rc.template @@ -0,0 +1,8 @@ +# benchmark setup script + +PYTHON=`which python3` +PIP=`which pip` +GIT=`which git` + + + diff --git a/frameworks/Kieker/python/functions.sh b/frameworks/Kieker/python/functions.sh index a02f0d687a9ec2ce1dd938175525585a72022e02..a7fdcc7f3d957eac57d24cb48e162c9571bf3534 100644 --- a/frameworks/Kieker/python/functions.sh +++ b/frameworks/Kieker/python/functions.sh @@ -9,102 +9,181 @@ fi function getAgent() { - info "Checking whether Kieker is present in ${AGENT}" - if [ ! -f "${AGENT}" ] ; then - # get agent - export VERSION_PATH=`curl "https://oss.sonatype.org/service/local/repositories/snapshots/content/net/kieker-monitoring/kieker/" | grep '<resourceURI>' | sed 's/ *<resourceURI>//g' | sed 's/<\/resourceURI>//g' | grep '/$' | grep -v ".xml" | head -n 1` - export AGENT_PATH=`curl "${VERSION_PATH}" | grep 'aspectj.jar</resourceURI' | sort | sed 's/ *<resourceURI>//g' | sed 's/<\/resourceURI>//g' | tail -1` - curl "${AGENT_PATH}" > "${AGENT}" - - if [ ! -f "${AGENT}" ] || [ -s "${AGENT}" ] ; then - error "Kieker download from $AGENT_PATH failed; please asure that a correct Kieker AspectJ file is present!" - fi - fi + info "Setup Kieker4Python" + + checkExecutable python "${PYHTON}" + checkExecutable pip "${PIP}" + checkExecutbale git "${GIT}" + + "${GIT}" clone "${KIEKER_4_PYTHON_REPO_URL}" + checkDirectory kieker-python "${KIEKER_4_PYTHON_DIR}" + cd "${KIEKER_4_PYTHON_DIR}" + "${PYTHON}" -m build + "${PIP}" install dist/kieker-monitoring-for-python-0.0.1.tar.gz + cd "${BASE_DIR}" } # experiment setups ################################# # function: execute an experiment -# -# $1 = i iterator -# $2 = j iterator -# $3 = k iterator -# $4 = title -# $5 = writer parameters -function executeExperiment() { - loop="$1" - recursion="$2" - index="$3" - title="$4" - kieker_parameters="$5" - - info " # ${loop}.${recursion}.${index} ${title}" - echo " # ${loop}.${recursion}.${index} ${title}" >> "${DATA_DIR}/kieker.log" - - if [ "${kieker_parameters}" == "" ] ; then - export BENCHMARK_OPTS="${JAVA_ARGS}" - else - export BENCHMARK_OPTS="${JAVA_ARGS} ${LTW_ARGS} ${KIEKER_ARGS} ${kieker_parameters}" - fi - - debug "Run options: ${BENCHMARK_OPTS}" - - "${MOOBENCH_BIN}" \ - --application moobench.application.MonitoredClassSimple \ - --output-filename "${RAWFN}-${loop}-${recursion}-${index}.csv" \ - --total-calls "${TOTAL_NUM_OF_CALLS}" \ - --method-time "${METHOD_TIME}" \ - --total-threads 1 \ - --recursion-depth "${recursion}" &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" + +function createConfig() { + inactive="$1" + instrument="$2" + approach="$3" +cat > config.ini << EOF +[Benchmark] +total_calls = ${TOTAL_NUM_OF_CALLS} +recursion_depth = ${RECURSION_DEPTH} +method_time = ${METHOD_TIME} +config_path = ${BASE_DIR}/monitoring.ini +inactive = $inactive +instrumentation_on = $instrument +approach = $appraoch +EOF +} + +function createMonitoring() { + mode="$1" +cat > monitoring.ini << EOF +[Main] +mode = ${mode} + +[Tcp] +host = 127.0.0.1 +port = 5678 +connection_timeout = 10 + +[FileWriter] +file_path = ${DATA_DIR} +EOF +} + +function noInstrumentation() { + index="$1" + loop="$2" + + info " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" + echo " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" >> "${DATA_DIR}/kieker.log" + + createConfig True False 1 + + "${PYTHON}" benchmark.py # &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" rm -rf "${DATA_DIR}"/kieker-* - [ -f "${DATA_DIR}/hotspot.log" ] && mv "${DATA_DIR}/hotspot.log" "${RESULTS_DIR}/hotspot-${loop}-${recursion}-${index}.log" echo >> "${DATA_DIR}/kieker.log" echo >> "${DATA_DIR}/kieker.log" sync sleep "${SLEEP_TIME}" } -function executeBenchmarkBody() { - index="$1" - loop="$2" - recursion="$3" - if [[ "${RECEIVER[$index]}" ]] ; then - debug "receiver ${RECEIVER[$index]}" - ${RECEIVER[$index]} >> "${DATA_DIR}/kieker.receiver-${loop}-${index}.log" & - RECEIVER_PID=$! - debug "PID ${RECEIVER_PID}" - fi - - executeExperiment "$loop" "$recursion" "$index" "${TITLE[$index]}" "${WRITER_CONFIG[$index]}" - - if [[ "${RECEIVER_PID}" ]] ; then - kill -TERM "${RECEIVER_PID}" - unset RECEIVER_PID - fi +function dactivatedProbe() { + index="$1" + loop="$2" + approach="$3" + + info " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" + echo " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" >> "${DATA_DIR}/kieker.log" + + createMonitoring dummy + createConfig True True ${approach} + + "${PYTHON}" benchmark.py # &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" + + rm -rf "${DATA_DIR}"/kieker-* + + echo >> "${DATA_DIR}/kieker.log" + echo >> "${DATA_DIR}/kieker.log" + sync + sleep "${SLEEP_TIME}" +} + +function noLogging() { + index="$1" + loop="$2" + approach="$3" + + info " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" + echo " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" >> "${DATA_DIR}/kieker.log" + + createMonitoring dummy + createConfig False True ${approach} + + "${PYTHON}" benchmark.py # &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" + + rm -rf "${DATA_DIR}"/kieker-* + + echo >> "${DATA_DIR}/kieker.log" + echo >> "${DATA_DIR}/kieker.log" + sync + sleep "${SLEEP_TIME}" +} + +function textLogging() { + index="$1" + loop="$2" + approach="$3" + + info " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" + echo " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" >> "${DATA_DIR}/kieker.log" + + createMonitoring text + createConfig False True ${approach} + + "${PYTHON}" benchmark.py # &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" + + rm -rf "${DATA_DIR}"/kieker-* + + echo >> "${DATA_DIR}/kieker.log" + echo >> "${DATA_DIR}/kieker.log" + sync + sleep "${SLEEP_TIME}" +} + +function tcpLogging() { + index="$1" + loop="$2" + approach="$3" + + info " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" + echo " # ${loop}.${RECURSION_DEPTH}.${index} ${TITLE[index]}" >> "${DATA_DIR}/kieker.log" + + createMonitoring tcp + createConfig False True ${approach} + + "${PYTHON}" benchmark.py # &> "${RESULTS_DIR}/output_${loop}_${RECURSION_DEPTH}_${index}.txt" + + rm -rf "${DATA_DIR}"/kieker-* + + echo >> "${DATA_DIR}/kieker.log" + echo >> "${DATA_DIR}/kieker.log" + sync + sleep "${SLEEP_TIME}" } ## Execute Benchmark function executeBenchmark() { for ((loop=1;loop<="${NUM_OF_LOOPS}";loop+=1)); do - recursion="${RECURSION_DEPTH}" - info "## Starting iteration ${loop}/${NUM_OF_LOOPS}" echo "## Starting iteration ${loop}/${NUM_OF_LOOPS}" >> "${DATA_DIR}/kieker.log" - for ((index=0;index<${#WRITER_CONFIG[@]};index+=1)); do - executeBenchmarkBody $index $loop $recursion - done - + noInstrumentation 0 $loop + dactivatedProbe 1 $loop + dactivatedProbe 2 $loop + noLogging 2 $loop 1 + noLogging 2 $loop 2 + textLogging 3 $loop 1 + textLogging 3 $loop 2 + tcpLogging 4 $loop 1 + tcpLogging 4 $loop 2 + printIntermediaryResults done 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}/log.log" [ -f "${DATA_DIR}/errorlog.txt" ] && mv "${DATA_DIR}/errorlog.txt" "${RESULTS_DIR}" } - # end diff --git a/frameworks/Kieker/python/monitoring.ini.template b/frameworks/Kieker/python/monitoring.ini.template index ce67f011f621bddcdaf8684a7774a5f4a0d0554f..7f7649e4434079f40872b71447cac4270ef229fc 100644 --- a/frameworks/Kieker/python/monitoring.ini.template +++ b/frameworks/Kieker/python/monitoring.ini.template @@ -1,5 +1,5 @@ [Main] -isTCP = True +mode = tcp [Tcp] host = 127.0.0.1 @@ -7,4 +7,5 @@ port = 65432 connection_timeout = 10 [FileWriter] -file_path = /home/reiner/temp/k2py-experiment +file_path = %DATA% +