#!/bin/bash

if [ $# -lt 2 ] ; then
    echo "benchmark-one <java file> <class name> [<name>]"
    exit
fi

javafile=$1
javaclass=$2
if [ $# -ge 3 ] ; then
    testname=$3
else
    testname=$2
fi

find . -name \*.class | xargs -n 10 rm -rf
../bin/javac $javafile
echo -e "\n\n% ../bin/java  $javaclass"
../bin/java  $javaclass | tee benchmark.tmp.txt

echo $testname >> benchmark.tmp.names.txt
grep "^unstaged" benchmark.tmp.txt | sed "s/.*:=\(.*\)x$/\1/" >> benchmark.tmp.results.txt
