#!/bin/sh

# Sample results:
# Number of Runs: 600
# Timing command ../speedy/speedy
# 1.69user 1.24system 0:03.99elapsed 73%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (68057major+14470minor)pagefaults 0swaps
# Timing command perl
# 66.66user 4.16system 1:10.82elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (160457major+119470minor)pagefaults 0swaps

if test "$SPEEDY_BACKENDPROG" = ""; then
    SPEEDY_BACKENDPROG=`pwd`/../speedy_backend/speedy_backend
fi
export SPEEDY_BACKENDPROG

if test ! -f $SPEEDY_BACKENDPROG; then
    echo Warning! Cannot locate $SPEEDY_BACKENDPROG
fi

SPEEDY_MAXRUNS=0
export SPEEDY_MAXRUNS

numruns=600

echo Number of Runs: $numruns

for cmd in ../speedy/speedy perl; do
    # Do a couple runs to get thing in memory
    perl ./timeit.pl $cmd 5

    echo Timing command $cmd
    time perl ./timeit.pl $cmd $numruns
done
