Revision: 41430
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41430&view=rev
Author:   brlcad
Date:     2010-11-23 02:35:43 +0000 (Tue, 23 Nov 2010)

Log Message:
-----------
boo yah.  add elapsed conversion times.  this does even a better job than the 
benchmark since it counts seconds from the beginning of the century and should 
track time across days/weeks.  it reports both cumulative time elapsed, average 
per object (including process startup overhead), and real time per nmg/bot 
conversion.

Modified Paths:
--------------
    brlcad/trunk/sh/conversion.sh

Modified: brlcad/trunk/sh/conversion.sh
===================================================================
--- brlcad/trunk/sh/conversion.sh       2010-11-23 01:51:12 UTC (rev 41429)
+++ brlcad/trunk/sh/conversion.sh       2010-11-23 02:35:43 UTC (rev 41430)
@@ -127,6 +127,19 @@
 }
 
 
+################
+# elapsed time #
+################
+elapsed ( ) {
+
+    # this routine either reports the current time (in seconds)
+
+    elp=`date '+%Y %m %d %H %M %S' | awk '{print ($1*31622400) + 
(($2-1)*2678400) + (($3-1)*86400) + ($4*360) + ($5*60) + ($6)}'`
+    echo $elp
+    return
+}
+
+
 ####################
 # handle arguments #
 ####################
@@ -317,6 +330,7 @@
 nmg_count=0
 bot_count=0
 $ECHO "%s" "-=-"
+begin=`elapsed`
 while test $# -gt 0 ; do
     file="$1"
     if ! test -f "$file" ; then
@@ -340,16 +354,17 @@
        obj="`basename \"$object\"`"
        found=`$GED -c "$work" search . -name \"${obj}\" 2>&1 | grep -v Using`
        if test "x$found" != "x$object" ; then
-           echo "INTERNAL ERROR: Failed to find [$object] with [$obj] (got 
[$found])"
-           exit 3
+           $ECHO "INTERNAL ERROR: Failed to find [$object] with [$obj] (got 
[$found])"
+           continue
        fi
 
        # convert NMG
        nmg=FAIL
        cmd="$GED -c "$work" facetize -n \"${obj}.nmg\" \"${obj}\""
        $VERBOSE_ECHO "\$ $cmd"
-       output=`eval $cmd 2>&1 | grep -v Using`
+       output=`eval time $cmd 2>&1 | grep -v Using`
        $VERBOSE_ECHO "$output"
+       real_nmg="`echo \"$output\" | tail -n 4 | grep real | awk '{print $2}'`"
 
        # verify NMG
        found=`$GED -c "$work" search . -name \"${obj}.nmg\" 2>&1 | grep -v 
Using`
@@ -362,8 +377,9 @@
        bot=FAIL
        cmd="$GED -c "$work" facetize \"${obj}.bot\" \"${obj}\""
        $VERBOSE_ECHO "\$ $cmd"
-       output=`eval $cmd 2>&1 | grep -v Using`
+       output=`eval time $cmd 2>&1 | grep -v Using`
        $VERBOSE_ECHO "$output"
+       real_bot="`echo \"$output\" | tail -n 4 | grep real | awk '{print $2}'`"
 
        # verify BoT
        found=`$GED -c "$work" search . -name \"${obj}.bot\" 2>&1 | grep -v 
Using`
@@ -372,7 +388,11 @@
            bot_count=`expr $bot_count + 1`
        fi
        
-       $ECHO "nmg:%s bot:%s %s:%s" $nmg $bot "$file" "$object"
+       status=FAIL
+       if test "x$nmg" = "xpass" && test "x$bot" = "xpass" ; then
+           status=OK
+       fi
+       $ECHO "%s\tnmg: %s %s\tbot %s %s\t%s:%s" $status $nmg $real_nmg $bot 
$real_bot "$file" "$object"
        count=`expr $count + 1`
 
     done <<EOF
@@ -382,6 +402,7 @@
     rm -f "$work"
     shift
 done
+end=`elapsed`
 $ECHO "%s" "-=-"
 
 if test $count -eq 0 ; then
@@ -393,6 +414,8 @@
     bot_percent=`echo $bot_count $count | awk '{print ($1/$2)*100.0}'`
     rate=`echo $nmg_count $bot_count $count | awk '{print 
($1+$2)/($3+$3)*100.0}'`
 fi
+elp=`echo $begin $end | awk '{print $2-$1}'`
+avg=`echo $elp $count | awk '{print $1/$2}'`
 
 $ECHO
 $ECHO "... Done."
@@ -401,10 +424,10 @@
 $ECHO
 $ECHO "NMG conversion:  %.1f%%  (%ld of %ld objects)" $nmg_percent $nmg_count 
$count
 $ECHO "BoT conversion:  %.1f%%  (%ld of %ld objects)" $bot_percent $bot_count 
$count
-$ECHO "Overall conversion rate:  %.1f%%" $rate
+$ECHO "  Success rate:  %.1f%%" $rate
 $ECHO
-$ECHO "Elapsed conversion time: %lf" 0.0
-$ECHO "Average conversion time: %lf" 0.0
+$ECHO "Elapsed:  %d seconds" $elp
+$ECHO "Average:  %.1f seconds per object" $avg
 $ECHO
 $ECHO "Output was saved to $LOGFILE from `pwd`"
 $ECHO "Conversion testing complete."


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to