Revision: 41515
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41515&view=rev
Author:   erikgreenwald
Date:     2010-12-06 20:53:48 +0000 (Mon, 06 Dec 2010)

Log Message:
-----------
Don't assume bc if dc is not found (but do assume awk as a last ditch attempt, 
because that's somehow better).

Modified Paths:
--------------
    brlcad/trunk/bench/run.sh

Modified: brlcad/trunk/bench/run.sh
===================================================================
--- brlcad/trunk/bench/run.sh   2010-12-06 19:06:50 UTC (rev 41514)
+++ brlcad/trunk/bench/run.sh   2010-12-06 20:53:48 UTC (rev 41515)
@@ -1155,15 +1155,23 @@
        perf_have_dc=no
     fi
 
+    perf_have_bc=yes
+    echo "1 + 1" | bc >/dev/null 2>&1
+    if test ! x$? = x0 ; then
+       perf_have_bc=no
+    fi
+
     for perf_ref in $perf_VGRREF ; do
        perf_cur=$1
        shift
 
        if test "x$perf_have_dc" = "xyes" ; then
            perf_RATIO=`echo "2k $perf_cur $perf_ref / p" | dc`
-       else
+       elif test "x$perf_have_bc" = "xyes" ; then
            # presume bc as an alternate (tsk tsk)
            perf_RATIO=`echo "scale=2; $perf_cur / $perf_ref" | bc`
+       else
+           perf_RATIO=`echo $perf_cur $perf_ref | awk '{printf "%.2f", $1/$2}'`
        fi
        # Note: append new value and a trail TAB to existing list.
        perf_RATIO_LIST="${perf_RATIO_LIST}$perf_RATIO  "
@@ -1173,7 +1181,7 @@
     if test "x$perf_have_dc" = "xyes" ; then
        perf_MEAN_ABS=`echo 2k $perf_CURVALS +++++ 6/ p | dc`
        perf_MEAN_REL=`echo 2k $perf_RATIO_LIST +++++ 6/ p | dc`
-    else
+    elif test "x$perf_have_bc" = "xyes" ; then
        perf_expr="scale=2; ( 0"
        for perf_val in $perf_CURVALS ; do
            perf_expr="$perf_expr + $perf_val"
@@ -1187,6 +1195,9 @@
        done
        perf_expr="$perf_expr ) / 6"
        perf_MEAN_REL=`echo $perf_expr | bc`
+    else
+       perf_MEAN_ABS=`echo $perf_CURVALS | awk '{printf "%.2f", 
($1+$2+$3+$4+$5+$6)/6}'`
+       perf_MEAN_REL=`echo $perf_RATIO_LIST | awk '{printf "%.2f", 
($1+$2+$3+$4+$5+$6)/6}'`
     fi
 
     # Note: Both perf_RATIO_LIST and perf_CURVALS have an extra


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

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to