From 14a96de7761dd801ab5fde06800f3facda93f4f1 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 12 Apr 2021 16:19:45 +0000 Subject: [PATCH] chore: bash cleanup --- .../applications/imageclassification/run.sh | 2 +- .../applications/ocr/by_dpi/run.sh | 2 +- .../applications/ocr/by_font/run.sh | 30 ++++++------- runtime/experiments/applications/run.sh | 32 +++++++------- runtime/experiments/common.sh | 18 ++++++++ runtime/experiments/concurrency/run.sh | 32 +++++++------- runtime/experiments/deadline/client.sh | 35 +++++++-------- runtime/experiments/deadline/client2.sh | 31 +++++++------ runtime/experiments/deadline/client3.sh | 31 +++++++------ runtime/experiments/deadline/fix_calcs.sh | 28 ++++++------ runtime/experiments/deadline/fix_calcs2.sh | 30 ++++++------- runtime/experiments/deadline/run.sh | 32 +++++++------- runtime/experiments/deadline/run_relative.sh | 32 +++++++------- runtime/experiments/deadline/server.sh | 2 - runtime/experiments/payload/run.sh | 34 +++++++------- runtime/experiments/preemption/client.sh | 32 +++++++------- runtime/experiments/preemption/fix_results.sh | 40 ++++++++--------- runtime/experiments/preemption/run.sh | 44 ++++++++++++------- .../experiments/preemption/run_relative.sh | 32 +++++++------- 19 files changed, 271 insertions(+), 248 deletions(-) diff --git a/runtime/experiments/applications/imageclassification/run.sh b/runtime/experiments/applications/imageclassification/run.sh index 4c095cb..4218303 100755 --- a/runtime/experiments/applications/imageclassification/run.sh +++ b/runtime/experiments/applications/imageclassification/run.sh @@ -21,7 +21,7 @@ else echo "Running under gdb" fi -# expected_size="$(find expected_result.jpg -printf "%s")" +expected_size="$(find expected_result.jpg -printf "%s")" success_count=0 total_count=50 diff --git a/runtime/experiments/applications/ocr/by_dpi/run.sh b/runtime/experiments/applications/ocr/by_dpi/run.sh index 0d25b80..72df78d 100755 --- a/runtime/experiments/applications/ocr/by_dpi/run.sh +++ b/runtime/experiments/applications/ocr/by_dpi/run.sh @@ -33,7 +33,7 @@ for ((i = 0; i < total_count; i++)); do for dpi in "${dpis[@]}"; do echo "${dpi}"_dpi.pnm - pango-view --dpi=$dpi --font=mono -qo "${dpi}"_dpi.png -t "$words" + pango-view --dpi="$dpi" --font=mono -qo "${dpi}"_dpi.png -t "$words" pngtopnm "${dpi}"_dpi.png > "${dpi}"_dpi.pnm result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"${dpi}"_dpi.pnm localhost:${dpi_to_port[$dpi]} 2> /dev/null) diff --git a/runtime/experiments/applications/ocr/by_font/run.sh b/runtime/experiments/applications/ocr/by_font/run.sh index 83acad0..ca2f8be 100755 --- a/runtime/experiments/applications/ocr/by_font/run.sh +++ b/runtime/experiments/applications/ocr/by_font/run.sh @@ -29,25 +29,25 @@ for ((i = 1; i <= total_count; i++)); do # For whatever reason, templating in multiple word strips was a pain, so brute forcing case "$font" in "DejaVu Sans Mono") - echo "DejaVu Sans Mono" - pango-view --font="DejaVu Sans Mono" -qo mono_words.png -t "$words" || exit 1 - pngtopnm mono_words.png > mono_words.pnm || exit 1 - result=$( curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @mono_words.pnm localhost:10000 2> /dev/null) - diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") + echo "DejaVu Sans Mono" + pango-view --font="DejaVu Sans Mono" -qo mono_words.png -t "$words" || exit 1 + pngtopnm mono_words.png > mono_words.pnm || exit 1 + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @mono_words.pnm localhost:10000 2> /dev/null) + diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") ;; "Roboto") - echo "Roboto" - pango-view --font="Roboto" -qo Roboto_words.png -t "$words" || exit 1 - pngtopnm Roboto_words.png > Roboto_words.pnm || exit 1 - result=$( curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Roboto_words.pnm localhost:10002 2> /dev/null) - diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") + echo "Roboto" + pango-view --font="Roboto" -qo Roboto_words.png -t "$words" || exit 1 + pngtopnm Roboto_words.png > Roboto_words.pnm || exit 1 + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Roboto_words.pnm localhost:10002 2> /dev/null) + diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") ;; "Cascadia Code") - echo "Cascadia Code" - pango-view --font="Cascadia Code" -qo Cascadia_Code_words.png -t "$words" || exit 1 - pngtopnm Cascadia_Code_words.png > Cascadia_Code_words.pnm || exit 1 - result=$( curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Cascadia_Code_words.pnm localhost:10001 2> /dev/null) - diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") + echo "Cascadia Code" + pango-view --font="Cascadia Code" -qo Cascadia_Code_words.png -t "$words" || exit 1 + pngtopnm Cascadia_Code_words.png > Cascadia_Code_words.pnm || exit 1 + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Cascadia_Code_words.pnm localhost:10001 2> /dev/null) + diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") ;; esac echo "===============================================" diff --git a/runtime/experiments/applications/run.sh b/runtime/experiments/applications/run.sh index 6070bcd..04843d1 100755 --- a/runtime/experiments/applications/run.sh +++ b/runtime/experiments/applications/run.sh @@ -61,9 +61,9 @@ for payload in ${payloads[*]}; do # Calculate Success Rate for csv file=$(echo "$payload" | awk -F/ '{print $2}') awk -F, ' - $7 == 200 {ok++} - END{printf "'"$file"',%3.5f\n", (ok / '"$iterations"' * 100)} - ' < "$results_directory/$file.csv" >> "$results_directory/success.csv" + $7 == 200 {ok++} + END{printf "'"$file"',%3.5f\n", (ok / '"$iterations"' * 100)} + ' < "$results_directory/$file.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$file.csv" \ @@ -80,19 +80,19 @@ for payload in ${payloads[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$file"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} - ' < "$results_directory/$file-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$file"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$file-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting rm -rf "$results_directory/$file-response.csv" diff --git a/runtime/experiments/common.sh b/runtime/experiments/common.sh index 28a932e..bbfe879 100644 --- a/runtime/experiments/common.sh +++ b/runtime/experiments/common.sh @@ -1,6 +1,10 @@ #!/bin/bash log_environment() { + if ! command -v git &> /dev/null; then + echo "git could not be found" + exit + fi echo "*******" echo "* Git *" echo "*******" @@ -39,6 +43,20 @@ kill_runtime() { } generate_gnuplots() { + if ! command -v gnuplot &> /dev/null; then + echo "gnuplot could not be found" + exit + fi + # shellcheck disable=SC2154 + if [ -z "$results_directory" ]; then + echo "results_directory is unset or empty" + exit + fi + # shellcheck disable=SC2154 + if [ -z "$experiment_directory" ]; then + echo "experiment_directory is unset or empty" + exit + fi cd "$results_directory" || exit gnuplot ../../latency.gnuplot gnuplot ../../success.gnuplot diff --git a/runtime/experiments/concurrency/run.sh b/runtime/experiments/concurrency/run.sh index c651c47..47bcb9e 100755 --- a/runtime/experiments/concurrency/run.sh +++ b/runtime/experiments/concurrency/run.sh @@ -57,9 +57,9 @@ printf "Con,p50,p90,p99,p100\n" >> "$results_directory/latency.csv" for conn in ${concurrency[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {ok++} - END{printf "'"$conn"',%3.5f\n", (ok / '"$iterations"' * 100)} - ' < "$results_directory/con$conn.csv" >> "$results_directory/success.csv" + $7 == 200 {ok++} + END{printf "'"$conn"',%3.5f\n", (ok / '"$iterations"' * 100)} + ' < "$results_directory/con$conn.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/con$conn.csv" \ @@ -76,19 +76,19 @@ for conn in ${concurrency[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$conn"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} - ' < "$results_directory/con$conn-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$conn"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/con$conn-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting rm -rf "$results_directory/con$conn-response.csv" diff --git a/runtime/experiments/deadline/client.sh b/runtime/experiments/deadline/client.sh index 4063a83..d1acfb1 100755 --- a/runtime/experiments/deadline/client.sh +++ b/runtime/experiments/deadline/client.sh @@ -7,7 +7,6 @@ source ../common.sh host=localhost timestamp=$(date +%s) experiment_directory=$(pwd) -binary_directory=$(cd ../../bin && pwd) results_directory="$experiment_directory/res/$timestamp" log=log.txt @@ -31,9 +30,9 @@ echo "Running Experiments" # Run lower priority first, then higher priority. The lower priority has offsets to ensure it runs the entire time the high priority is trying to run hey -n 1000 -c 1000 -cpus 6 -t 0 -o csv -m GET -d "40\n" http://${host}:10040 > "$results_directory/fib40-con.csv" -# sleep $offset -# hey -n 25000 -c 1000000 -t 0 -o csv -m GET -d "10\n" http://${host}:10010 >"$results_directory/fib10-con.csv" & -# sleep $((duration_sec + offset + 45)) +sleep $offset +hey -n 25000 -c 1000000 -t 0 -o csv -m GET -d "10\n" http://${host}:10010 > "$results_directory/fib10-con.csv" & +sleep $((duration_sec + offset + 45)) # Generate *.csv and *.dat results echo -n "Parsing Results: " @@ -57,8 +56,8 @@ for ((i = 1; i < 2; i++)); do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -75,18 +74,18 @@ for ((i = 1; i < 2; i++)); do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting diff --git a/runtime/experiments/deadline/client2.sh b/runtime/experiments/deadline/client2.sh index 17990e8..2d9ca11 100755 --- a/runtime/experiments/deadline/client2.sh +++ b/runtime/experiments/deadline/client2.sh @@ -8,7 +8,6 @@ host=192.168.1.13 # host=localhost timestamp=$(date +%s) experiment_directory=$(pwd) -binary_directory=$(cd ../../bin && pwd) results_directory="$experiment_directory/res/$timestamp" log=log.txt @@ -59,9 +58,9 @@ for ((i = 0; i < 2; i++)); do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {denom++} - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} + $7 == 200 {denom++} + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -79,18 +78,18 @@ for ((i = 0; i < 2; i++)); do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting diff --git a/runtime/experiments/deadline/client3.sh b/runtime/experiments/deadline/client3.sh index 8d203c7..10e186c 100755 --- a/runtime/experiments/deadline/client3.sh +++ b/runtime/experiments/deadline/client3.sh @@ -8,7 +8,6 @@ host=192.168.1.13 # host=localhost timestamp=$(date +%s) experiment_directory=$(pwd) -binary_directory=$(cd ../../bin && pwd) results_directory="$experiment_directory/res/$timestamp" log=log.txt @@ -57,9 +56,9 @@ for ((i = 0; i < 1; i++)); do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {denom++} - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} + $7 == 200 {denom++} + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -77,18 +76,18 @@ for ((i = 0; i < 1; i++)); do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting diff --git a/runtime/experiments/deadline/fix_calcs.sh b/runtime/experiments/deadline/fix_calcs.sh index 057a19f..7d8d5eb 100755 --- a/runtime/experiments/deadline/fix_calcs.sh +++ b/runtime/experiments/deadline/fix_calcs.sh @@ -27,8 +27,8 @@ for ((i = 0; i < 2; i++)); do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -46,18 +46,18 @@ for ((i = 0; i < 2; i++)); do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting diff --git a/runtime/experiments/deadline/fix_calcs2.sh b/runtime/experiments/deadline/fix_calcs2.sh index 5a1ec6e..adff3c2 100755 --- a/runtime/experiments/deadline/fix_calcs2.sh +++ b/runtime/experiments/deadline/fix_calcs2.sh @@ -60,9 +60,9 @@ for ((i = 0; i < 2; i++)); do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {denom++} - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} + $7 == 200 {denom++} + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / denom * 100)} ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort @@ -80,18 +80,18 @@ for ((i = 0; i < 2; i++)); do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting diff --git a/runtime/experiments/deadline/run.sh b/runtime/experiments/deadline/run.sh index 0847d4f..c69a3e5 100755 --- a/runtime/experiments/deadline/run.sh +++ b/runtime/experiments/deadline/run.sh @@ -73,9 +73,9 @@ for scheduler in ${schedulers[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} - ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -92,19 +92,19 @@ for scheduler in ${schedulers[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} - ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/deadline/run_relative.sh b/runtime/experiments/deadline/run_relative.sh index 31d6c2a..0acc690 100755 --- a/runtime/experiments/deadline/run_relative.sh +++ b/runtime/experiments/deadline/run_relative.sh @@ -73,9 +73,9 @@ for scheduler in ${schedulers[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} - ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -92,19 +92,19 @@ for scheduler in ${schedulers[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p90 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p99 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p100 {printf "%1.4f%\n", $0 / '"$deadline"' * 100} - ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p90 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p99 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p100 {printf "%1.4f%\n", $0 / '"$deadline"' * 100} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/deadline/server.sh b/runtime/experiments/deadline/server.sh index e1e2e5b..965228e 100755 --- a/runtime/experiments/deadline/server.sh +++ b/runtime/experiments/deadline/server.sh @@ -1,7 +1,5 @@ #!/bin/bash -source ../common.sh -timestamp=$(date +%s) experiment_directory=$(pwd) binary_directory=$(cd ../../bin && pwd) diff --git a/runtime/experiments/payload/run.sh b/runtime/experiments/payload/run.sh index 718c57e..7731a81 100755 --- a/runtime/experiments/payload/run.sh +++ b/runtime/experiments/payload/run.sh @@ -34,7 +34,7 @@ for payload in ${payloads[*]}; do else echo "Generating Payloads: " { - cd "$experiment_directory/body" && ./generate.sh + cd "$experiment_directory/body" && ./generate.sh } break fi @@ -73,9 +73,9 @@ printf "Payload,p50,p90,p99,p100\n" >> "$results_directory/latency.csv" for payload in ${payloads[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {ok++} - END{printf "'"$payload"',%3.5f\n", (ok / '"$iterations"' * 100)} - ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 {ok++} + END{printf "'"$payload"',%3.5f\n", (ok / '"$iterations"' * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -92,19 +92,19 @@ for payload in ${payloads[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} - ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/preemption/client.sh b/runtime/experiments/preemption/client.sh index ad07df3..e0b7584 100755 --- a/runtime/experiments/preemption/client.sh +++ b/runtime/experiments/preemption/client.sh @@ -61,9 +61,9 @@ for payload in ${payloads[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} -' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -80,19 +80,19 @@ for payload in ${payloads[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} -' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/preemption/fix_results.sh b/runtime/experiments/preemption/fix_results.sh index 3a527bd..80c6b1f 100755 --- a/runtime/experiments/preemption/fix_results.sh +++ b/runtime/experiments/preemption/fix_results.sh @@ -27,9 +27,9 @@ for payload in ${payloads[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} -' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -46,23 +46,23 @@ for payload in ${payloads[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p998 = int('"$oks"' * 0.998) - p999 = int('"$oks"' * 0.999) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p998 {printf "%1.4f,", $0} - NR==p999 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} -' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p998 = int('"$oks"' * 0.998) + p999 = int('"$oks"' * 0.999) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p998 {printf "%1.4f,", $0} + NR==p999 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/preemption/run.sh b/runtime/experiments/preemption/run.sh index 0847d4f..b549e21 100755 --- a/runtime/experiments/preemption/run.sh +++ b/runtime/experiments/preemption/run.sh @@ -1,9 +1,19 @@ #!/bin/bash -source ../common.sh # This experiment is intended to document how the level of concurrent requests influence the latency, throughput, and success/failure rate # Use -d flag if running under gdb +source ../common.sh + +# Validate dependencies +declare -a -r dependencies=(awk hey wc) +for dependency in "${dependencies[@]}"; do + if ! command -v "$dependency" &> /dev/null; then + echo "$dependency could not be found" + exit + fi +done + timestamp=$(date +%s) experiment_directory=$(pwd) binary_directory=$(cd ../../bin && pwd) @@ -73,9 +83,9 @@ for scheduler in ${schedulers[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} - ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -92,19 +102,19 @@ for scheduler in ${schedulers[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f,", $0} - NR==p90 {printf "%1.4f,", $0} - NR==p99 {printf "%1.4f,", $0} - NR==p100 {printf "%1.4f\n", $0} - ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f,", $0} + NR==p90 {printf "%1.4f,", $0} + NR==p99 {printf "%1.4f,", $0} + NR==p100 {printf "%1.4f\n", $0} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv" diff --git a/runtime/experiments/preemption/run_relative.sh b/runtime/experiments/preemption/run_relative.sh index 31d6c2a..0acc690 100755 --- a/runtime/experiments/preemption/run_relative.sh +++ b/runtime/experiments/preemption/run_relative.sh @@ -73,9 +73,9 @@ for scheduler in ${schedulers[*]}; do # Calculate Success Rate for csv awk -F, ' - $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} - END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} - ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" + $7 == 200 && ($1 * 1000) <= '"$deadline"' {ok++} + END{printf "'"$payload"',%3.5f%\n", (ok / (NR - 1) * 100)} + ' < "$results_directory/$payload.csv" >> "$results_directory/success.csv" # Filter on 200s, convery from s to ms, and sort awk -F, '$7 == 200 {print ($1 * 1000)}' < "$results_directory/$payload.csv" \ @@ -92,19 +92,19 @@ for scheduler in ${schedulers[*]}; do # Generate Latency Data for csv awk ' - BEGIN { - sum = 0 - p50 = int('"$oks"' * 0.5) - p90 = int('"$oks"' * 0.9) - p99 = int('"$oks"' * 0.99) - p100 = '"$oks"' - printf "'"$payload"'," - } - NR==p50 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p90 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p99 {printf "%1.4f%,", $0 / '"$deadline"' * 100} - NR==p100 {printf "%1.4f%\n", $0 / '"$deadline"' * 100} - ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" + BEGIN { + sum = 0 + p50 = int('"$oks"' * 0.5) + p90 = int('"$oks"' * 0.9) + p99 = int('"$oks"' * 0.99) + p100 = '"$oks"' + printf "'"$payload"'," + } + NR==p50 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p90 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p99 {printf "%1.4f%,", $0 / '"$deadline"' * 100} + NR==p100 {printf "%1.4f%\n", $0 / '"$deadline"' * 100} + ' < "$results_directory/$payload-response.csv" >> "$results_directory/latency.csv" # Delete scratch file used for sorting/counting # rm -rf "$results_directory/$payload-response.csv"