From 1d014a20a7d40a25cb6a03b1637cd65125392a61 Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Tue, 27 Nov 2018 15:19:12 +0100 Subject: [PATCH] better shell script --- run-time.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run-time.sh b/run-time.sh index d23352c..5708fff 100755 --- a/run-time.sh +++ b/run-time.sh @@ -1,9 +1,14 @@ #!/bin/bash +if [ "$#" -ne 1 ]; then + echo "Bad usage of run-time.sh" + echo "./run-time " + exit 1 +fi +echo "Starting $1 runs of surfaces-unies" start=$(date +%s.%N) -nbloops=10 -for i in `seq 1 $nbloops`; do +for i in `seq 1 $1`; do ./bin/surfaces-unies -c -i ./img/asterix.ppm done end=$(date +%s.%N) -runtime=$(python -c "print((${end} - ${start}) / ${nbloops})") +runtime=$(python -c "print((${end} - ${start}) / ${1})") echo "Average runtime was $runtime"