#!/bin/sh

# Sample results:
# Number of Runs: 200
# Timing command ../speedy
#         1.74 real         0.13 user         1.04 sys
# Timing command perl
#        27.74 real        23.56 user         2.93 sys

numruns=200

echo Number of Runs: $numruns

# Build a list of numbers for the for loop
while test $numruns -gt 0; do
    nums="$nums $numruns"
    numruns=`expr $numruns - 1`
done

for cmd in ../../speedy perl; do
    # Do one run to get program running.
    echo p=20 | $cmd ./test.pl >/dev/null 2>&1

    echo Timing command $cmd
    time /bin/sh -c "
	for i in $nums; do
	    echo p=20 | $cmd ./test.pl
	done >/dev/null 2>&1
    "
done
