From 7397b124b60cdb94ef7cb6ae839e47fa3bdb881b Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Sat, 28 Jun 2025 10:48:48 +0200 Subject: [PATCH] added batch_run script (prev manually in shell) --- batch_run.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 batch_run.sh diff --git a/batch_run.sh b/batch_run.sh new file mode 100755 index 0000000..0d8b460 --- /dev/null +++ b/batch_run.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -euo pipefail + +RUN_TIME=${RUN_TIME:-20} # seconds +ITERATIONS=${ITERATIONS:-49} +BUILD_SCRIPT=${BUILD_SCRIPT:-"./build_run_copy.sh"} +TIMER_MODES=${TIMER_MODES:-"direct timed"} +THREADING_MODES=${THREADING_MODES:-"single multi"} +BOOSTS=${BOOSTS:-"1000 500 100 50 10"} # 1000 equals disabled, 500, 100, 50, 10 + +log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a batch_run.log +} + +cleanup() { + log "Script interrupted or completed. Cleaning up..." + # Add any cleanup tasks here +} +trap cleanup EXIT INT TERM + +# Check if build_run_copy.sh exists and is executable +if [[ ! -x "./build_run_copy.sh" ]]; then + log "ERROR: build_run_copy.sh not found or not executable" + exit 1 +fi + +declare -g total_runs=$((2 * 2 * 50 + 5 * 2 * 2 * 50)) # 200 + 1000 = 1200 +declare -g current_run=0 + +run_with_progress() { + current_run=$((current_run + 1)) + log "Progress: $current_run/$total_runs - Running: $*" + if ! ./build_run_copy.sh "$@"; then + log "ERROR: Failed at run $current_run with args: $*" + exit 1 + fi +} + +run_test_suite() { + local scheduler=$1 + local boost=$2 + local time_mode=$3 + local thread_mode=$4 + + # First run with rebuild + run_with_progress "$scheduler" "$thread_mode" "$time_mode" "$boost" "$RUN_TIME" false + + # Subsequent runs without rebuild + for run in $(seq 1 $ITERATIONS); do + run_with_progress "$scheduler" "$thread_mode" "$time_mode" "$boost" "$RUN_TIME" true + done +} + +# Main execution starts here +for time_mode in $TIMER_MODES; do + for thread_mode in $THREADING_MODES; do + run_test_suite "ros" "1000" "$time_mode" "$thread_mode" + done + + for boost in $BOOSTS; do + for thread_mode in $THREADING_MODES; do + run_test_suite "edf" "$boost" "$time_mode" "$thread_mode" + done + done +done \ No newline at end of file