#!/bin/bash

JAVA_VMS="java cacao jato jamvm"
JAR=dacapo-2006-10-MR2.jar

function bench {
  echo -e "$1\c"

  for java in $JAVA_VMS; do
    time=$($java -Xmx1024m -cp $JAR Harness $1 2>&1 | grep "===== DaCapo.*PASSED in.*msec =====" | sed -e "s/.*PASSED in \(.*\) msec.*/\1/g")

    echo -e "\t$time\c"
    rm -rf scratch > /dev/null
  done

  echo ""
}

for java in $JAVA_VMS; do
  $java -version
done

echo -e "#\c"
for java in $JAVA_VMS; do
  echo -e "\t$java\c"
done
echo ""

TESTS="antlr bloat chart eclipse fop hsqldb luindex lusearch pmd xalan"

for test in $TESTS; do
  bench $test
done
