better shell script

This commit is contained in:
Phuntsok Drak-pa 2018-11-27 15:19:12 +01:00
parent 5c596ea613
commit 1d014a20a7
No known key found for this signature in database
GPG Key ID: 9CB34B6827C66D22
1 changed files with 8 additions and 3 deletions

View File

@ -1,9 +1,14 @@
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Bad usage of run-time.sh"
echo "./run-time <number of runs>"
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"