codea: *.{1,2,3}er testfaelle der ag fuer codea uebernommen
[testub10.git] / scripts / bench.sh
index df8c100eedd42b0ad2eebd2019b164ffcba51b15..a4dd0d29ceb1a65b63d0e8f8145d17eed7325b16 100755 (executable)
@@ -48,12 +48,6 @@ for i in $TEST/*.0; do
     # create executable
     gcc -DCALL=\"${i%.0}.call\" -o $TMPNAME $TMPNAME.s $TESTMAIN $CALLCONV
     
-    # count instructions
-    $DUMPINSTR $TMPNAME call >/dev/null
-    if [ $? != 0 ]; then
-       echo "$bi FEHLGESCHLAGEN"
-       continue
-    fi
     
     # extract the exported symbols from the .s file
     #LABEL=`grep '.globl' $TMPNAME.s | sed 's/^.*\\.globl *\\([a-zA-Z0-9_]\\+\\).*$/\1/g'`
@@ -61,9 +55,16 @@ for i in $TEST/*.0; do
     # this won't work, we need all actual labels
     LABEL=`grep '[a-zA-Z0-9_.$]\\+:' $TMPNAME.s | sed 's/^\\(.*[^a-zA-Z0-9_.$]\\)\\?\\([a-zA-Z0-9_.$]\\+\\):.*$/\2/g'`
 
+    rm -f $TMPNAME.trace
     MATCHES=0
     for j in $LABEL; do
-       MATCHES="$MATCHES\\|$j"
+               MATCHES="$MATCHES\\|$j"
+               # count instructions
+               $DUMPINSTR $TMPNAME $j > /dev/null
+               if [ $? != 0 ]; then
+                       echo "$bi FEHLGESCHLAGEN"
+                       continue
+               fi
     done
 
     # filter trace
@@ -76,7 +77,21 @@ for i in $TEST/*.0; do
                echo "err: fuer den testfall \"$bi\" existiert noch keine referenzdatei"
                ti=0
        fi
-    echo "$bi: $ni (referenz: $ti)"
+
+       if [ $ni -gt $ti ]; then
+               #red
+               bcolor="\033[01;31m"
+       else
+               if [ $ni -eq $ti ]; then
+                       #gray
+                       bcolor="\033[01;30m"
+               else
+                       #green
+                       bcolor="\033[01;32m"
+               fi
+       fi
+
+    echo -e "$bcolor $bi: $ni (referenz: $ti) \033[0m"
     echo "$bi $ni" >> $RESULT
 
        let gni=gni+$ni
@@ -90,4 +105,4 @@ echo ""
 echo "Statistik:"
 echo "=========="
 echo "  $gni  Instruktionen"
-echo "  $gni  Referenzinstruktionen"
+echo "  $gti  Referenzinstruktionen"