#!/usr/sup/gnu/bin/bash # Copyright 1997 Matz Kindahl, Uppsala. All rights reserved. # This program is in the public domain. It may be used, # redistributed, modified, extended, limited, mangled, thrashed, fed # to rats, or stomped on as long as this copyright notice is # maintained. # There is NO WARRANTY of any sort, it may not work, might kill your # rats, cause mudslides, make your wife leave you. Who knows. COUNT=30 # The number of measurements START=100000 # Start value INC=50000 # Increase in value between measurements PROGRAM=./test_sort # Program to measure # Check if the files exists. If so, ask if they should be removed. [ -f $1.calc ] && rm -i $1.calc [ -f $1.data ] && rm -i $1.data echo "mat m[$COUNT,1]" >>$1.calc echo "mat t[$COUNT,1]" >>$1.calc I=0 while [ $I -lt $COUNT ]; do echo -n "Measuring for $[$START + $I * $INC]..." echo "t[$I,0] = $[$START + $I * $INC]" >>$1.calc echo $(time $PROGRAM $[$START + $I * $INC] 2>&1) | { read X R Y U Z S echo "m[$I,0] = $U /* $Z time for $[$START + $I * $INC] */" >>$1.calc echo $[$START + $I * $INC] $U >>$1.data echo "done (took $R seconds $X time)" } I=$[$I + 1] done cat >>$1.calc <