#!/bin/sh
#
# This script runs the program named 'bench' in the current
# directory and logs the results together with useful log
# data to 'bench.log'. Output from the program containing
# the string 'BENCH' is ignored (useful for printing progress
# information that should not be logged).
#
# Anders Logg, 2009-05-24 -- 2009-06-17

unset LANG
LOG=bench.log

# Print log data
echo "Date: "`date` >> $LOG
echo "-------------------------------------------------------------------------------" >> $LOG
echo "" >> $LOG
uname -a >> $LOG
echo "" >> $LOG
hg tip >> $LOG

# Run benchmark
echo "Running benchmark..."
time -f "%E" --output=timing.tmp ./bench | grep -v BENCH >> $LOG
echo "" >> $LOG
echo "Total time: "`cat timing.tmp` >> $LOG
echo "" >> $LOG
