#!/usr/bin/env bash # Rebuilds the C++ and C programs and regenerates every file in output/. set -euo pipefail cd "$(dirname "$0")/.." mkdir -p output build CXX=${CXX:-g++}; CC=${CC:-gcc} $CXX -std=c++17 -Wall -Wextra -O2 -o build/rr rr.cpp $CC -std=c11 -Wall -Wextra -O2 -o build/rrc rr.c $CXX -std=c++17 -o build/old legacy/old_rr_tick_loop.cpp build/rr < input/legacy-5proc-q10.txt > output/01-rr-legacy-5proc-q10.txt build/rr < input/classic-q4.txt > output/02-rr-classic-q4.txt build/rr < input/staggered-q2.txt > output/03-rr-staggered-q2.txt build/rr < input/idle-gap-q3.txt > output/04-rr-idle-gap-q3.txt build/rr < input/quantum-1.txt > output/05-rr-quantum-1.txt build/rr < input/large-quantum.txt > output/06-rr-large-quantum.txt build/old < input/legacy-bursts-only.txt > output/07-legacy-full-session.txt # Quantum sweep on the 5-process workload: average waiting time and number of Gantt boxes { echo "Q avg-WT avg-TAT gantt-boxes" for q in 1 2 3 5 7 10 12 15 20 29 40; do sed "\$s/.*/$q/" input/legacy-5proc-q10.txt | build/rr | awk -v q="$q" ' /Average waiting/ {w=$NF} /Average turnaround/ {t=$NF} /^\| / {b=gsub(/\| /,"| ")} END {printf "%-3s %-8s %-9s %s\n", q, w, t, b}' done } > output/08-quantum-sweep.txt # The C and C++ versions must agree byte for byte on every input { for f in input/*.txt; do [ "$f" = input/legacy-bursts-only.txt ] && continue if cmp -s <(build/rr < "$f") <(build/rrc < "$f"); then echo "identical $f"; else echo "DIFFERENT $f"; fi done } > output/09-c-vs-cpp.txt python3 scripts/compare_legacy.py > output/10-legacy-vs-new.txt echo "done: $(ls output | wc -l) files in output/"