#!/bin/bash # ./wrapper "." "manytextboxes" "panda" "100" # Check we are not running already data=`ps -aux | grep wrapper | grep -v emacs | grep -v grep | wc -l | tr -d " "` if [ $data -gt 2 ] then echo "Already running ($data)" exit 42 fi if [ `echo $1 | wc -c | tr -d " "` -gt 1 ] then echo "Set working dir to $1" cd $1 fi starttime=`date` # This file runs through all the known timetrials and tests to see if our # performance has improved or degraded. # This variable is a list of libaries to test if [ `echo $3 | wc -c | tr -d " "` -gt 1 ] then echo "Libaries on command line $3" `echo $3 | wc -c | tr -d " "` libs=$3 else libs="clibpdf-202r1 pdflib-30 panda-02" fi echo Libaries are $libs # This variable is a list of tests -- this can also be overwridden on the # command line if we only want to run one test if [ `echo $2 | wc -c | tr -d " "` -gt 1 ] then echo "Tests on command line $2" `echo $2 | wc -c | tr -d " "` tests=$2 else tests="hello manytextboxes manypages" fi echo Tests are $tests # How many times per test if [ `echo $4 | wc -c | tr -d " "` -gt 1 ] then number=$4 else # number=100 number=10 fi echo Iterations is $number delay=1 echo Delay between is $delay seconds # Make sure the math stuff is there make math for test in $tests do for lib in $libs do # Every test for every library make $test-$lib # Make sure that make made! if [ $? -gt 0 ] then echo $starttime - Did not make >> $test-$lib.db else rm timings # Run the tests count=0 while [ $count -lt $number ] do echo $count time ./$test-$lib.o 2>> timings count=$(( $count + 1 )) sleep $delay done # Save the file that we made so that we have something to show the kids mv -f $test-$lib.pdf $test-$lib.prev.pdf mv -f output.pdf $test-$lib.pdf # Do something with the results echo "Analysing results" runningtime=0 for item in `grep system timings | tr " " "_"` do utime=`echo $item | sed 's/user.*//'` stime=`echo $item | sed 's/.*user_//' | sed 's/system.*//'` time=`./math $utime + $stime` runningtime=`./math $runningtime + $time` done runningmajorpf=0 runningminorpf=0 for item in `grep pagefaults timings | tr " " "_"` do time=`echo $item | sed 's/.*(//' | sed 's/minor).*//' | sed 's/major//'` majorpf=`echo $time | sed 's/+.*//'` minorpf=`echo $time | sed 's/.*+//'` runningmajorpf=$(( $runningmajorpf + $majorpf )) runningminorpf=$(( $runningminorpf + $minorpf )) done # Output the results to the database echo $starttime "-" `./math $runningtime / $number` "," `./math $runningmajorpf / $number` "," `./math $runningminorpf / $number` "," `du -sk $test-$lib.pdf` >> $test-$lib.db fi done done # And now run the archival tests ./wrapper-archive