#!/bin/sh OPEN_JDK[0]="../openjdk/build/linux-amd64/bin/java" OPEN_JDK[1]="../openjdk-proxy/build/linux-amd64/bin/java" OPEN_JDK[2]="../openjdk/j2sdk-image/bin/java" VM_ARGS="-cp build/classes/ net.java.openjdk.Main" size=3 echo "start tests" echo for ((i=0; i<$size; i++)); do echo "---===*** ${OPEN_JDK[${i}]}: ***===--- " echo ${OPEN_JDK[${i}]} -version for I in 1 2 3 4 5; do echo "${OPEN_JDK[${i}]} ${VM_ARGS} 2>&1 | tee -a OPEN_JDK${i}.results" ${OPEN_JDK[${i}]} ${VM_ARGS} 2>&1 | tee -a OPEN_JDK${i}.results done echo "" echo "---===*** end: ${OPEN_JDK[${i}]} ***===--- " echo done # now the stats echo "----- printing stats -----" echo OPEN_JDK_RESULTS[0]=OPEN_JDK0.results OPEN_JDK_RESULTS[1]=OPEN_JDK1.results OPEN_JDK_RESULTS[2]=OPEN_JDK2.results for ((i=0; i<$size; i++)); do old_total=0 old_warmed=0 line_count=0 while read line do data=$(echo $line|awk 'BEGIN {FS=": "} {print $2}') is_even=$(expr $line_count % 2) if [ $is_even -eq 0 ] then old_warmed=$(echo "$data + $old_warmed" | bc) else old_total=$(echo "$data + $old_total" | bc) fi ((line_count++)) done < ${OPEN_JDK_RESULTS[${i}]} # print stats line_count=$(echo "$line_count / 2" | bc) result=$(echo "scale=3; $old_warmed / $line_count" | bc) echo "average run for ${OPEN_JDK_RESULTS[${i}]} (warmed up): $result" result=$(echo "scale=3; $old_total / $line_count" | bc) echo "average run for ${OPEN_JDK_RESULTS[${i}]} (total): $result" echo done echo "done!"