aboutsummaryrefslogtreecommitdiff
path: root/benchmark.sh
diff options
context:
space:
mode:
authorMikkel Thestrup <mithe24@student.sdu.dk>2025-12-04 21:40:06 +0100
committerMikkel Thestrup <mithe24@student.sdu.dk>2025-12-04 21:40:06 +0100
commit76524617ac9d6b86dadd7d23daf8ab3f2ed8675c (patch)
tree64a2e32273f807674ce67f83f2f0f4f93fd5cbc7 /benchmark.sh
parent5ca163f446420c97af8a4fa37f6d0281a84bfbcf (diff)
downloadcycle-detector-76524617ac9d6b86dadd7d23daf8ab3f2ed8675c.tar.gz
cycle-detector-76524617ac9d6b86dadd7d23daf8ab3f2ed8675c.zip
Benchmark script
Diffstat (limited to 'benchmark.sh')
-rwxr-xr-xbenchmark.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/benchmark.sh b/benchmark.sh
new file mode 100755
index 0000000..6af42a8
--- /dev/null
+++ b/benchmark.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+DATA_DIR="data"
+PROGRAM="src/detectCycles"
+
+# Build release version
+echo "Building release version..."
+cd src
+make release
+cd ..
+
+if [ ! -f "$PROGRAM" ]; then
+ echo "Error: Build failed."
+ exit 1
+fi
+
+echo "Benchmarking $PROGRAM"
+echo "======================================"
+
+# Run benchmark on each test file
+for TEST_FILE in "$DATA_DIR"/*; do
+ if [ -f "$TEST_FILE" ]; then
+ FILENAME=$(basename "$TEST_FILE")
+ echo "Testing: $FILENAME"
+
+ # Run program and measure time using time builtin
+ { time "$PROGRAM" "$TEST_FILE" > /dev/null 2>&1; } 2>&1 | grep real
+
+ echo ""
+ fi
+done
+
+echo "======================================"
+echo "Benchmark complete"