Index: examples/scaling_tests/haystack/fruit_python/base/QUERY.py
===================================================================
--- examples/scaling_tests/haystack/fruit_python/base/QUERY.py	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ examples/scaling_tests/haystack/fruit_python/base/QUERY.py	(revision 08b8da72eb6c21f483448e5fbd475b8ab31f9a6a)
@@ -4,13 +4,48 @@
 Run the queries described in README
 
-cmd1:env keystore=`pwd` ./query.py 
-cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+cmd: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+number of credentials,
+     3 + 6 + 3 x #VAL#
 
 """
 
 import os
+import sys
 import ABAC
+import time
+import datetime
+from datetime import timedelta
+
+debug=0
 
 ctxt = ABAC.Context()
+
+cred_count = 3 + 6 + 3 * #VAL#
+
+def get_msec(e_time) :
+    msec_delta=0
+    if( int(e_time.seconds) !=0 ) :
+        msec_delta= int(e_time.seconds) *1000
+    if( int(e_time.microseconds) !=0) :
+        msec_delta = msec_delta + int(e_time.microseconds)/1000
+    return msec_delta
+
+def get_micro(e_time) :
+    micro_delta=0
+    if( int(e_time.seconds) !=0 ) :
+        micro_delta= int(e_time.seconds) *1000000
+    if( int(e_time.microseconds) !=0) :
+        micro_delta = micro_delta + int(e_time.microseconds)
+    return micro_delta
+
+def extract_delta(starttime, endtime) :
+    """ given a start time, and a endtime, extract delta """
+    elapsed_time = (endtime - starttime)
+# Only handle in seconds/microseconds
+    if ( int(elapsed_time.days) != 0 ) :
+        sys.stderr.write("%s is longer than a day !!!" % msg)
+        exit(1)
+    return elapsed_time
 
 # Keystore is the directory containing the principal credentials.
@@ -18,5 +53,10 @@
 if (os.environ.has_key("keystore")) :
     keystore=os.environ["keystore"]
+    starttime = datetime.datetime.now()
     ctxt.load_directory(keystore)
+    endtime = datetime.datetime.now()
+    elapsed_load=extract_delta(starttime, endtime)
+    elapsed_msec=get_msec(elapsed_load)
+    sys.stderr.write("%d %d LOAD(msec)\n" % (cred_count,elapsed_msec))
 else:
     print("keystore is not set...")
@@ -52,12 +92,35 @@
 # oset = [keyid:mary].oset:what2eat 
 # p [string:'navel orange'] 
-oset = ABAC.Oset(mary,"what2eat")
-term=ABAC.DataTerm("string", "'navel orange'")
-p = ABAC.Oset(term)
-
-print "\n===good============ mary.what2eat <- navel orange"
-out = ctxt.query(oset, p)
-for c in out[1]:
-    print "%s <- %s" % (c.head_string(), c.tail_string())
+def maryQuery(pr) :
+    oset = ABAC.Oset(mary,"what2eat")
+    term=ABAC.DataTerm("string", "'navel orange'")
+    p = ABAC.Oset(term)
+
+    if(pr) :
+        print "\n===good============ mary.what2eat <- navel orange"
+    starttime = datetime.datetime.now()
+    out = ctxt.query(oset, p)
+    endtime = datetime.datetime.now()
+    if(pr) :
+        for c in out[1]:
+            print "%s <- %s" % (c.head_string(), c.tail_string())
+    return extract_delta(starttime, endtime)
+
+# skip the first one
+e_time=maryQuery(1)
+elapsed_micro=get_micro(e_time)
+sys.stderr.write("%d %d GOOD_1(micro)\n" % (cred_count,elapsed_micro))
+
+elapsed_good=timedelta()
+k=20
+while(k):
+    e_time=maryQuery(0)
+    elapsed_good=elapsed_good+e_time
+    k=k-1
+    if(debug):
+        elapsed_micro=get_micro(e_time)
+        sys.stderr.write("%d %d GOOD_%d(micro)\n" % (cred_count,elapsed_micro,k))
+elapsed_micro=get_micro(elapsed_good)
+sys.stderr.write("%d %d GOOD_t(micro)\n" % (cred_count,elapsed_micro/20))
 
 ##########################################################################
@@ -78,12 +141,35 @@
 # oset = [keyid:bob].oset:what2eat 
 # p [string:'navel orange'] 
-oset = ABAC.Oset(bob,"what2eat")
-term=ABAC.DataTerm("string", "'navel orange'")
-p = ABAC.Oset(term)
-
-print "\n===bad============ bob.what2eat <- navel orange"
-out = ctxt.query(oset, p)
-for c in out[1]:
-    print "%s <- %s" % (c.head_string(), c.tail_string())
+def bobQuery(pr) :
+    oset = ABAC.Oset(bob,"what2eat")
+    term=ABAC.DataTerm("string", "'navel orange'")
+    p = ABAC.Oset(term)
+
+    if(pr) :
+        print "\n===bad============ bob.what2eat <- navel orange"
+    starttime = datetime.datetime.now()
+    out = ctxt.query(oset, p)
+    endtime = datetime.datetime.now()
+    if(pr) :
+        for c in out[1]:
+            print "%s <- %s" % (c.head_string(), c.tail_string())
+    return extract_delta(starttime, endtime)
+
+# skip the first one
+e_time=bobQuery(1)
+elapsed_micro=get_micro(e_time)
+sys.stderr.write("%d %d BAD_1(micro)\n" % (cred_count,elapsed_micro))
+
+elapsed_bad=timedelta()
+k=20
+while(k):
+    e_time=bobQuery(0)
+    elapsed_bad=elapsed_bad+e_time
+    k=k-1
+    if(debug):
+        elapsed_micro=get_micro(e_time)
+        sys.stderr.write("%d %d BAD_%d(micro)\n" % (cred_count,elapsed_micro,k))
+elapsed_micro=get_micro(elapsed_bad)
+sys.stderr.write("%d %d BAD_t(micro)\n" % (cred_count,elapsed_micro/20))
 
 ##########################################################################
Index: examples/scaling_tests/haystack/fruit_python/base/RESULT
===================================================================
--- examples/scaling_tests/haystack/fruit_python/base/RESULT	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ examples/scaling_tests/haystack/fruit_python/base/RESULT	(revision 08b8da72eb6c21f483448e5fbd475b8ab31f9a6a)
@@ -4,4 +4,24 @@
 pMary.what2eat <- pRalphs.fruitprice(P:[..2.000000])
 pRalphs.fruitprice(0.50) <- 'navel orange'
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
+YAP query succeed
 
 ===good============ mary.what2eat <- kiwi
@@ -12,4 +32,24 @@
 ===bad============ bob.what2eat <- navel orange
 YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
+YAP query failed
 
 ===good============ ralphs.fruitprice(1.50) <- apple
Index: examples/scaling_tests/haystack/fruit_python/get_time
===================================================================
--- examples/scaling_tests/haystack/fruit_python/get_time	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-
-grep -s user fruit_*/fruit.time
Index: examples/scaling_tests/haystack/fruit_python/run_clean
===================================================================
--- examples/scaling_tests/haystack/fruit_python/run_clean	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-
-rm -rf fruit_*
Index: examples/scaling_tests/haystack/fruit_python/run_one
===================================================================
--- examples/scaling_tests/haystack/fruit_python/run_one	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ examples/scaling_tests/haystack/fruit_python/run_one	(revision 08b8da72eb6c21f483448e5fbd475b8ab31f9a6a)
@@ -4,10 +4,16 @@
 noise=$1
 
+if [ -z "$noise" ]; then
+    exit
+fi 
+
+echo "---running haystack fruit_python $noise scaling"
+
 rm -rf fruit_$noise
 mkdir fruit_$noise
 sed "s/#VAL#/$noise/" base/SETUP.py > fruit_$noise/setup.py
+sed "s/#VAL#/$noise/" base/QUERY.py > fruit_$noise/query.py
+sed "s/#VAL#/$noise/" base/ATTR.py > fruit_$noise/attr.py
 cp base/RESULT fruit_$noise/fruit.save
-cp base/QUERY.py fruit_$noise/query.py
-sed "s/#VAL#/$noise/" base/ATTR.py > fruit_$noise/attr.py
 
 cd fruit_$noise
@@ -15,5 +21,5 @@
 ./setup.py 1>/dev/null 2>& 1
 env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
-time env keystore=`pwd` ABAC_CN=1 ./query.py 1>fruit.tmp 2> fruit.time
+env keystore=`pwd` ABAC_CN=1 ./query.py 1>fruit.tmp 2> fruit.time
 result=`diff fruit.tmp fruit.save 2>/dev/null`
 if [ "$result" = "" ]; then
Index: examples/scaling_tests/haystack/fruit_python/run_test
===================================================================
--- examples/scaling_tests/haystack/fruit_python/run_test	(revision 519e487487fcfb946577db4296eba5a2ee83c27c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#!/bin/sh 
-
-run_clean
-
-echo '---running haystack fruit_python 0 scaling'
-run_one 0  1> log 2>/dev/null
-result=`grep PASSED log 2>/dev/null`
-if [ "$result" = "" ]; then
-   echo "   ERROR"
-else   
-   echo "   PASSED"
-fi
-rm -rf log
-
-
-echo '---running haystack fruit_python 10 scaling'
-run_one 10  1> log 2>/dev/null
-result=`grep PASSED log 2>/dev/null`
-if [ "$result" = "" ]; then
-   echo "   ERROR"
-else   
-   echo "   PASSED"
-fi
-rm -rf log
-
-echo '---running haystack fruit_python 20 scaling'
-run_one 20  1> log 2>/dev/null
-result=`grep PASSED log 2>/dev/null`
-if [ "$result" = "" ]; then
-   echo "   ERROR"
-else   
-   echo "   PASSED"
-fi
-rm -rf log
-
-echo '---running haystack fruit_python 30 scaling'
-run_one 30  1> log 2>/dev/null
-result=`grep PASSED log 2>/dev/null`
-if [ "$result" = "" ]; then
-   echo "   ERROR"
-else   
-   echo "   PASSED"
-fi
-rm -rf log
-
-echo '---running haystack fruit_python 200 scaling'
-run_one 200  1> log 2>/dev/null
-result=`grep PASSED log 2>/dev/null`
-if [ "$result" = "" ]; then
-   echo "   ERROR"
-else   
-   echo "   PASSED"
-fi
-rm -rf log
-
