From 8603ea12dbb8c1782ea1ce306b4de2ce9ee84d93 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 24 May 2021 10:38:24 -0400 Subject: [PATCH] feat: lpd using framework --- runtime/Makefile | 6 +- .../licenseplate/by_plate_count/.gitignore | 1 + .../licenseplate/by_plate_count/debug.sh | 19 -- .../by_plate_count/edf_nopreemption.env | 2 + .../by_plate_count/edf_preemption.env | 3 + .../by_plate_count/fifo_nopreemption.env | 2 + .../by_plate_count/fifo_preemption.env | 2 + .../by_plate_count/{1 => images}/Cars0.csv | 0 .../by_plate_count/{1 => images}/Cars0.png | Bin .../by_plate_count/{1 => images}/Cars1.csv | 0 .../by_plate_count/{1 => images}/Cars1.png | Bin .../by_plate_count/{4 => images}/Cars106.csv | 0 .../by_plate_count/{4 => images}/Cars106.png | Bin .../by_plate_count/{2 => images}/Cars143.csv | 0 .../by_plate_count/{2 => images}/Cars143.png | Bin .../by_plate_count/{4 => images}/Cars146.csv | 0 .../by_plate_count/{4 => images}/Cars146.png | Bin .../by_plate_count/{1 => images}/Cars2.csv | 0 .../by_plate_count/{1 => images}/Cars2.png | Bin .../by_plate_count/{4 => images}/Cars249.csv | 0 .../by_plate_count/{4 => images}/Cars249.png | Bin .../by_plate_count/{4 => images}/Cars277.csv | 0 .../by_plate_count/{4 => images}/Cars277.png | Bin .../by_plate_count/{2 => images}/Cars295.csv | 0 .../by_plate_count/{2 => images}/Cars295.png | Bin .../by_plate_count/{1 => images}/Cars3.csv | 0 .../by_plate_count/{1 => images}/Cars3.png | Bin .../by_plate_count/{2 => images}/Cars316.csv | 0 .../by_plate_count/{2 => images}/Cars316.png | Bin .../by_plate_count/{4 => images}/Cars330.csv | 0 .../by_plate_count/{4 => images}/Cars330.png | Bin .../by_plate_count/{1 => images}/Cars4.csv | 0 .../by_plate_count/{1 => images}/Cars4.png | Bin .../by_plate_count/{2 => images}/Cars71.csv | 0 .../by_plate_count/{2 => images}/Cars71.png | Bin .../by_plate_count/{2 => images}/Cars87.csv | 0 .../by_plate_count/{2 => images}/Cars87.png | Bin .../licenseplate/by_plate_count/run.sh | 219 ++++++++++++++---- .../ocr/by_dpi/fifo_preemption.env | 2 + 39 files changed, 193 insertions(+), 63 deletions(-) delete mode 100755 runtime/experiments/applications/licenseplate/by_plate_count/debug.sh create mode 100644 runtime/experiments/applications/licenseplate/by_plate_count/edf_nopreemption.env create mode 100644 runtime/experiments/applications/licenseplate/by_plate_count/edf_preemption.env create mode 100644 runtime/experiments/applications/licenseplate/by_plate_count/fifo_nopreemption.env create mode 100644 runtime/experiments/applications/licenseplate/by_plate_count/fifo_preemption.env rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars0.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars0.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars1.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars1.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars106.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars106.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars143.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars143.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars146.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars146.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars2.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars2.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars249.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars249.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars277.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars277.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars295.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars295.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars3.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars3.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars316.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars316.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars330.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{4 => images}/Cars330.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars4.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{1 => images}/Cars4.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars71.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars71.png (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars87.csv (100%) rename runtime/experiments/applications/licenseplate/by_plate_count/{2 => images}/Cars87.png (100%) create mode 100644 runtime/experiments/applications/ocr/by_dpi/fifo_preemption.env diff --git a/runtime/Makefile b/runtime/Makefile index f36e951..af0de1d 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -10,10 +10,10 @@ PAGE_SIZE := $(shell getconf PAGESIZE) # Compiler Settings CC=clang -CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE +# CC_OPTIONS = -O3 -flto -g -pthread -D_GNU_SOURCE # CC_OPTIONS for Debugging -# CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE +CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE # CFI Sanitizer # CC_OPTIONS = -O0 -g -pthread -D_GNU_SOURCE -flto -fvisibility=default -fsanitize=cfi @@ -56,7 +56,7 @@ BINARY_NAME=sledgert # CFLAGS += -DLOG_CONTEXT_SWITCHES # CFLAGS += -DLOG_ADMISSIONS_CONTROL # CFLAGS += -DLOG_REQUEST_ALLOCATION -# CFLAGS += -DLOG_PREEMPTION +CFLAGS += -DLOG_PREEMPTION # CFLAGS += -DLOG_MODULE_LOADING # This dumps per module *.csv files containing the cycle a sandbox has been in RUNNING when each diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore b/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore index ab65fff..0e022d3 100644 --- a/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore +++ b/runtime/experiments/applications/licenseplate/by_plate_count/.gitignore @@ -1,2 +1,3 @@ flower.jpg log.csv +res/* diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh b/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh deleted file mode 100755 index 879d485..0000000 --- a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Executes the runtime in GDB -# Substitutes the absolute path from the container with a path relatively derived from the location of this script -# This allows debugging outside of the Docker container -# Also disables pagination and stopping on SIGUSR1 - -experiment_directory=$(pwd) -project_directory=$(cd ../../../.. && pwd) -binary_directory=$(cd "$project_directory"/bin && pwd) - -export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" -export PATH="$binary_directory:$PATH" - -gdb --eval-command="handle SIGUSR1 nostop" \ - --eval-command="handle SIGPIPE nostop" \ - --eval-command="set pagination off" \ - --eval-command="set substitute-path /sledge/runtime $project_directory" \ - --eval-command="run $experiment_directory/spec.json" \ - sledgert diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/edf_nopreemption.env b/runtime/experiments/applications/licenseplate/by_plate_count/edf_nopreemption.env new file mode 100644 index 0000000..eeba531 --- /dev/null +++ b/runtime/experiments/applications/licenseplate/by_plate_count/edf_nopreemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=EDF +SLEDGE_DISABLE_PREEMPTION=true diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/edf_preemption.env b/runtime/experiments/applications/licenseplate/by_plate_count/edf_preemption.env new file mode 100644 index 0000000..302a324 --- /dev/null +++ b/runtime/experiments/applications/licenseplate/by_plate_count/edf_preemption.env @@ -0,0 +1,3 @@ +SLEDGE_SCHEDULER=EDF +SLEDGE_DISABLE_PREEMPTION=false +SLEDGE_SIGALRM_HANDLER=TRIAGED diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/fifo_nopreemption.env b/runtime/experiments/applications/licenseplate/by_plate_count/fifo_nopreemption.env new file mode 100644 index 0000000..a572a70 --- /dev/null +++ b/runtime/experiments/applications/licenseplate/by_plate_count/fifo_nopreemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=FIFO +SLEDGE_DISABLE_PREEMPTION=true diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/fifo_preemption.env b/runtime/experiments/applications/licenseplate/by_plate_count/fifo_preemption.env new file mode 100644 index 0000000..eb1298f --- /dev/null +++ b/runtime/experiments/applications/licenseplate/by_plate_count/fifo_preemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=FIFO +SLEDGE_DISABLE_PREEMPTION=false diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars0.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars0.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars0.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars0.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars0.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars0.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars0.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars0.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars1.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars1.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars1.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars1.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars1.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars1.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars1.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars1.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars106.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars106.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars106.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars106.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars106.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars106.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars106.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars106.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars143.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars143.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars143.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars143.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars143.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars143.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars143.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars143.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars146.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars146.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars146.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars146.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars146.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars146.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars146.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars146.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars2.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars2.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars2.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars2.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars2.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars2.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars2.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars2.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars249.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars249.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars249.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars249.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars249.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars249.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars249.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars249.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars277.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars277.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars277.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars277.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars277.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars277.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars277.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars277.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars295.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars295.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars295.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars295.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars295.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars295.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars295.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars295.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars3.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars3.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars3.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars3.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars3.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars3.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars3.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars3.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars316.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars316.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars316.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars316.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars316.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars316.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars316.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars316.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars330.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars330.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars330.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars330.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/4/Cars330.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars330.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/4/Cars330.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars330.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars4.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars4.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars4.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars4.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/1/Cars4.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars4.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/1/Cars4.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars4.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars71.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars71.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars71.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars71.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars71.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars71.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars71.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars71.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars87.csv b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars87.csv similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars87.csv rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars87.csv diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/2/Cars87.png b/runtime/experiments/applications/licenseplate/by_plate_count/images/Cars87.png similarity index 100% rename from runtime/experiments/applications/licenseplate/by_plate_count/2/Cars87.png rename to runtime/experiments/applications/licenseplate/by_plate_count/images/Cars87.png diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/run.sh b/runtime/experiments/applications/licenseplate/by_plate_count/run.sh index cb576d7..173e2cb 100755 --- a/runtime/experiments/applications/licenseplate/by_plate_count/run.sh +++ b/runtime/experiments/applications/licenseplate/by_plate_count/run.sh @@ -1,42 +1,179 @@ #!/bin/bash -# Executes the runtime in GDB -# Substitutes the absolute path from the container with a path relatively derived from the location of this script -# This allows debugging outside of the Docker container -# Also disables pagination and stopping on SIGUSR1 - -experiment_directory=$(pwd) -echo "$experiment_directory" -project_directory=$(cd ../../../.. && pwd) -binary_directory=$(cd "$project_directory"/bin && pwd) -log="$experiment_directory/log.csv" - -if [ "$1" != "-d" ]; then - SLEDGE_SANDBOX_PERF_LOG=$log PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & - sleep 1 -else - echo "Running under gdb" -fi - -one_plate=(Cars0 Cars1 Cars2 Cars3 Cars4) -two_plates=(Cars71 Cars87 Cars143 Cars295 Cars316) -four_plates=(Cars106 Cars146 Cars249 Cars277 Cars330) - -for image in ${one_plate[*]}; do - echo "@./1/${image}.png" - curl --data-binary "@./1/${image}.png" --output - localhost:10000 -done -for image in ${two_plates[*]}; do - echo "@./2/${image}.png" - curl --data-binary "@./2/${image}.png" --output - localhost:10001 -done -for image in ${four_plates[*]}; do - echo "@./4/${image}.png" - curl --data-binary "@./4/${image}.png" --output - localhost:10002 -done - -if [ "$1" != "-d" ]; then - sleep 5 - echo -n "Running Cleanup: " - pkill sledgert > /dev/null 2> /dev/null - echo "[DONE]" -fi + +set -o xtrace + +__run_sh__base_path="$(dirname "$(realpath --logical "${BASH_SOURCE[0]}")")" +__run_sh__bash_libraries_relative_path="../../../bash_libraries" +__run_sh__bash_libraries_absolute_path=$(cd "$__run_sh__base_path" && cd "$__run_sh__bash_libraries_relative_path" && pwd) +export PATH="$__run_sh__bash_libraries_absolute_path:$PATH" + +source csv_to_dat.sh || exit 1 +source framework.sh || exit 1 +# source generate_gnuplots.sh || exit 1 +source get_result_count.sh || exit 1 +source panic.sh || exit 1 +source path_join.sh || exit 1 + +declare -a workloads=(lpd1 lpd2 lpd4) + +declare -Ar port=( + [lpd1]=10000 + [lpd2]=10001 + [lpd4]=10002 +) + +# Validate that required tools are in path +declare -a required_binaries=(curl) +validate_dependencies() { + for required_binary in "${required_binaries[@]}"; do + if ! command -v "$required_binary" > /dev/null; then + echo "$required_binary is not present." + exit 1 + fi + done +} + +# Sort the images by the number of labeled plates +declare -a lpd1_images=() +declare -a lpd2_images=() +declare -a lpd4_images=() +while IFS= read -r image_data; do + image_file="${image_data/csv/png}" + # Each line of csv data represents a labeled plate on the image + case $(wc "$image_data" -l | cut -d\ -f1) in + 1) lpd1_images+=("$image_file") ;; + 2) lpd2_images+=("$image_file") ;; + 4) lpd4_images+=("$image_file") ;; + *) panic "Unexpected number of plates" ;; + esac +done < <(ls ./images/*.csv) + +get_random_image() { + local workload="$1" + local -n __random_image="$2" + + case $workload in + lpd1) __random_image="${lpd1_images[$((RANDOM % ${#lpd1_images[@]}))]}" ;; + lpd2) __random_image="${lpd2_images[$((RANDOM % ${#lpd2_images[@]}))]}" ;; + lpd4) __random_image="${lpd4_images[$((RANDOM % ${#lpd4_images[@]}))]}" ;; + *) panic "Invalid Workload" ;; + esac +} + +# Process the experimental results and generate human-friendly results for success rate, throughput, and latency +process_results() { + if (($# != 1)); then + error_msg "invalid number of arguments ($#, expected 1)" + return 1 + elif ! [[ -d "$1" ]]; then + error_msg "directory $1 does not exist" + return 1 + fi + + local -r results_directory="$1" + + printf "Processing Results: " + + # Write headers to CSVs + printf "Payload,p50,p90,p99,p100\n" >> "$results_directory/latency.csv" + + for workload in "${workloads[@]}"; do + + # Filter on 200s, subtract DNS time, convert from s to ms, and sort + awk -F, '$7 == 200 {print (($1 - $2) * 1000)}' < "$results_directory/$workload.csv" \ + | sort -g > "$results_directory/$workload-response.csv" + + oks=$(wc -l < "$results_directory/$workload-response.csv") + ((oks == 0)) && continue # If all errors, skip line + + # 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 "'"$workload"'," + } + 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/$workload-response.csv" >> "$results_directory/latency.csv" + + # Delete scratch file used for sorting/counting + rm -rf "$results_directory/$workload-response.csv" + done + + # Transform csvs to dat files for gnuplot + csv_to_dat "$results_directory/latency.csv" + + printf "[OK]\n" + return 0 +} + +run_functional_tests() { + local hostname="$1" + local results_directory="$2" + + # Functional Testing on each image + for image in "${lpd1_images[@]}"; do + echo "@${image}" >> "${results_directory}/lpd1.txt" + curl --data-binary "@${image}" --output - "${hostname}:10000" >> "${results_directory}/lpd1.txt" + done + for image in "${lpd2_images[@]}"; do + echo "@${image}" >> "${results_directory}/lpd2.txt" + curl --data-binary "@${image}" --output - "${hostname}:10001" >> "${results_directory}/lpd2.txt" + done + for image in "${lpd4_images[@]}"; do + echo "@${image}" >> "${results_directory}/lpd4.txt" + curl --data-binary "@${image}" --output - "${hostname}:10002" >> "${results_directory}/lpd4.txt" + done +} + +run_perf_tests() { + local hostname="$1" + local results_directory="$2" + + local -ir total_iterations=100 + local -ir worker_max=10 + local -ir batch_size=10 + local -i batch_id=0 + local random_image + + printf "Perf Tests: \n" + for workload in "${workloads[@]}"; do + batch_id=0 + for ((i = 0; i < total_iterations; i += batch_size)); do + # Block waiting for a worker to finish if we are at our max + while (($(pgrep --count hey) >= worker_max)); do + wait -n $(pgrep hey | tr '\n' ' ') + done + ((batch_id++)) + + get_random_image "$workload" random_image + hey -disable-compression -disable-keepalive -disable-redirects -n $batch_size -c 1 -cpus 1 -t 0 -o csv -m GET -D "${random_image}" "http://${hostname}:${port[$workload]}" > "$results_directory/${workload}_${batch_id}.csv" 2> /dev/null & + done + wait -f $(pgrep hey | tr '\n' ' ') + done + printf "[OK]\n" + + for workload in "${workloads[@]}"; do + tail --quiet -n +2 "$results_directory/${workload}"_*.csv >> "$results_directory/${workload}.csv" + rm "$results_directory/${workload}"_*.csv + done +} + +experiment_main() { + validate_dependencies + + local -r hostname="$1" + local -r results_directory="$2" + + run_functional_tests "$hostname" "$results_directory" || return 1 + run_perf_tests "$hostname" "$results_directory" || return 1 + process_results "$results_directory" || return 1 +} + +main "$@" diff --git a/runtime/experiments/applications/ocr/by_dpi/fifo_preemption.env b/runtime/experiments/applications/ocr/by_dpi/fifo_preemption.env new file mode 100644 index 0000000..eb1298f --- /dev/null +++ b/runtime/experiments/applications/ocr/by_dpi/fifo_preemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=FIFO +SLEDGE_DISABLE_PREEMPTION=false