#!/bin/bash # TODO!!! COMMENT EXPLAINING ALL THIS!!! # $1 = name of benchmark suite (grande or thread_grande) # $2 = section inside grande (section1, section2, or section3) # $3 = date that the suite was run # check input case $1 in "grande") case $2 in "section1") split_amount=37 benchmark_count=9 ;; "section2") split_amount=29 benchmark_count=7 ;; "section3") split_amount=21 benchmark_count=5 ;; *) echo "Invalid section" exit 1 ;; esac ;; "thread_grande") case $2 in "section1") split_amount=13 benchmark_count=3 ;; "section2") split_amount=21 benchmark_count=5 ;; "section3") split_amount=13 benchmark_count=3 ;; *) echo "Invalid section" exit 1 ;; esac ;; *) echo "Invalid suite" exit 1 ;; esac # get rid of files we'll be generating / appending to # make sure you don't want any of these files! rm -f junk* rm -f benchmark_names rm -f timing-junk* rm -f runtime_table rm -f output_names rm -f more-junk* rm -f diff_input_1 rm -f diff_input_2 rm -f paranoid_diff_out rm -f diff_out rm -f $1_$2_paranoid_diff_$3 rm -f $1_$2_diff_$3 rm -f $1_$2_report_$3 rm -f status_table rm -f temp_report # fill table with real runtimes grep "void main" ./$1/$2/*.java | grep -v JGFAll | grep -v SizeB | grep -v SizeC \ | cut -d'/' -f4 | cut -d'.' -f1 > benchmark_names cat $1_$2_times_$3 | grep -v -i -E 'abort|fault|terminate' | split -l $split_amount - junk for file in junk* do grep user $file | sed -e "s/user//" | tr -cs 'a-zA-Z0-9.' '\012' \ | tail -n$benchmark_count > timing-$file done paste -d' ' benchmark_names timing-junk* | sort > runtime_table # get pass or failure status for each benchmark find ./$1/$2/ -name *.out \ | grep -E 'java-JGF|9-switch-debug-JGF|r1575-switch-debug-JGF|9-inlined-JGF|r1575-inlined-JGF' > output_names cat benchmark_names | xargs -l1 -i grep {} output_names \ | split -l 5 - more-junk for file in more-junk* do for filetype in java-JGF 9-switch-debug-JGF r1575-switch-debug-JGF 9-inlined-JGF r1575-inlined-JGF do # paranoid diff to make sure ... save everything cat `grep java-JGF $file` > diff_input_1 cat `grep $filetype $file` > diff_input_2 diff diff_input_1 diff_input_2 > paranoid_diff_out echo `grep $filetype $file` | cat - paranoid_diff_out >> $1_$2_paranoid_diff_$3 # timing measurements cause false alarms # cat `grep java-JGF $file` | grep -i -v -E 'time|total|msec' > diff_input_1 # cat `grep $filetype $file` | grep -i -v -E 'time|total|msec' > diff_input_2 case $2 in "section1") cat `grep java-JGF $file` | cut -f1,3- > diff_input_1 cat `grep $filetype $file` | cut -f1,3- > diff_input_2 ;; "section2") cat `grep java-JGF $file` | cut -f1,4- > diff_input_1 cat `grep $filetype $file` | cut -f1,4- > diff_input_2 ;; "section3") cat `grep java-JGF $file` | cut -f1,4- > diff_input_1 cat `grep $filetype $file` | cut -f1,4- > diff_input_2 ;; *) echo '$2' must be \"section1\" or \"section2\" or \"section3\" exit 1 ;; esac diff diff_input_1 diff_input_2 > diff_out if [ $? -eq 0 ] then echo pass else echo FAIL echo `grep $filetype $file` | cat - diff_out >> $1_$2_diff_$3 fi done | xargs echo >> status_table done # generate the final report echo name java_t 1.0.9-sd_t r1575-sd_t 1.0.9-i_t r1575-i_t java_s 1.0.9-sd_s r1575-sd_s 1.0.9-i_s r1575-i_s > temp_report paste -d' ' runtime_table status_table >> temp_report cat temp_report | tr ' ' '\t' | expand -t30,45,60,75,90,105,120,135,150,165 > $1_$2_report_$3 # get rid of files again (keeping actual results) rm -f junk* rm -f benchmark_names rm -f timing-junk* rm -f runtime_table rm -f output_names rm -f more-junk* rm -f diff_input_1 rm -f diff_input_2 rm -f paranoid_diff_out rm -f diff_out rm -f status_table rm -f temp_report