summaryrefslogtreecommitdiff
path: root/bench/runbench.sh
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-09-03 09:42:31 +0200
committerYorhel <git@yorhel.nl>2013-09-03 09:42:31 +0200
commit5399893617ebc52bba1976e94c9f1cc742fff48d (patch)
treeaa65e1362a14b402d5803032c7e8f181a8fc5374 /bench/runbench.sh
parent377ab04bd22654a5317c8ce1c492139448513ded (diff)
Add benchmark code
Diffstat (limited to 'bench/runbench.sh')
-rwxr-xr-xbench/runbench.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/bench/runbench.sh b/bench/runbench.sh
new file mode 100755
index 0000000..77b4e50
--- /dev/null
+++ b/bench/runbench.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+OBJ=$1
+shift
+PROG=$1
+shift
+
+if test -z $OBJ; then
+ echo "This script is supposed to be run from 'make'."
+ exit 1
+fi
+
+echo "====> Benchmark results for $PROG" >$PROG-bench
+size -t $OBJ | tail -n 1 >>$PROG-bench
+wc -c $PROG >>$PROG-bench
+
+for i in $@; do
+ echo "== $i" >>$PROG-bench
+ cat $i >/dev/null
+ sh -c "time ./$PROG $i" >>$PROG-bench 2>&1
+ sh -c "time ./$PROG $i" >>$PROG-bench 2>&1
+done