Index: examples/scaling_tests/daisychain/likes_python/base/BQUERY.py
===================================================================
--- examples/scaling_tests/daisychain/likes_python/base/BQUERY.py	(revision 248530744daa5aba8e076649b532945a14660457)
+++ 	(revision )
@@ -1,62 +1,0 @@
-#!/usr/bin/env python
-
-"""
-Run the queries described in README
-
-cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
-
-"""
-
-import os
-import ABAC
-
-ctxt = ABAC.Context()
-
-# Keystore is the directory containing the principal credentials.
-# Load existing principals and/or policy credentials
-if (os.environ.has_key("keystore")) :
-    keystore=os.environ["keystore"]
-    ctxt.load_directory(keystore)
-else:
-    print("keystore is not set...")
-    exit(1)
-
-##########################################################################
-# dump the loaded principals/policies
-#
-
-fd=os.open("creds_dump",os.O_WRONLY|os.O_CREAT)
-out = ctxt.context_principals()
-for x in out[1]:
-    os.write(fd, x.string())
-    os.write(fd,"\n")
-out = ctxt.context_credentials()
-for c in out[1]:
-    string="%s <- %s" % (c.head_string(), c.tail_string())
-    os.write(fd,string) 
-    os.write(fd,"\n")
-os.close(fd)
-
-##########################################################################
-# Does John0 likes JohnX ?
-# role = [keyid:JohnX].role:after 
-# p [Keyid:john0]
-bid="John%s_ID.pem"% #VAL#
-bID=ABAC.ID(bid)
-b=bID.id_keyid()
-
-aID=ABAC.ID("John0_ID.pem")
-a=aID.id_keyid()
-
-role = ABAC.Role(a,"likes")
-p = ABAC.Role(b)
-
-print "\n===bad============ john0.likes <- johnX "
-out = ctxt.query(role, p)
-for c in out[1]:
-    print "%s <- %s" % (c.head_string(), c.tail_string())
-
-#### border case for VAL=0 (faking it) #### 
-if ( #VAL# == 0) :
-    print "YAP query failed (fake)\n"
-
Index: examples/scaling_tests/daisychain/likes_python/base/QUERY.py
===================================================================
--- examples/scaling_tests/daisychain/likes_python/base/QUERY.py	(revision 248530744daa5aba8e076649b532945a14660457)
+++ examples/scaling_tests/daisychain/likes_python/base/QUERY.py	(revision 658e7ef6636fd7814aa21793979cf4ab63120ff5)
@@ -4,12 +4,46 @@
 Run the queries described in README
 
-cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+cmd: env ABAC_CN=1 keystore=`pwd` ./query.py
 
 """
 
 import os
+import sys
 import ABAC
+import time
+import datetime
+from datetime import timedelta
+
+debug=0
 
 ctxt = ABAC.Context()
+
+cred_count = 2 + 2 * #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.
@@ -17,5 +51,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...")
@@ -42,17 +81,91 @@
 # role = [keyid:JohnX].role:after 
 # p [Keyid:john0]
-aid="John%s_ID.pem"% #VAL#
-aID=ABAC.ID(aid)
-a=aID.id_keyid()
+def goodQuery() :
+    aid="John%s_ID.pem"% #VAL#
+    aID=ABAC.ID(aid)
+    a=aID.id_keyid()
 
-bID=ABAC.ID("John0_ID.pem")
-b=bID.id_keyid()
+    bID=ABAC.ID("John0_ID.pem")
+    b=bID.id_keyid()
 
-role = ABAC.Role(a,"likes")
-p = ABAC.Role(b)
+    role = ABAC.Role(a,"likes")
+    p = ABAC.Role(b)
 
-print "\n===good============ johnN.likes <- john0 "
-out = ctxt.query(role, p)
-for c in out[1]:
-    print "%s <- %s" % (c.head_string(), c.tail_string())
+    print "\n===good============ johnN.likes <- john0 "
+    starttime = datetime.datetime.now()
+    out = ctxt.query(role, p)
+    endtime = datetime.datetime.now()
+    for c in out[1]:
+        print "%s <- %s" % (c.head_string(), c.tail_string())
+    return extract_delta(starttime, endtime)
+    
 
+##########################################################################
+# Does John0 likes JohnX ?
+# role = [keyid:JohnX].role:after 
+# p [Keyid:john0]
+def badQuery() :
+    bid="John%s_ID.pem"% #VAL#
+    bID=ABAC.ID(bid)
+    b=bID.id_keyid()
+
+    aID=ABAC.ID("John0_ID.pem")
+    a=aID.id_keyid()
+    
+    role = ABAC.Role(a,"likes")
+    p = ABAC.Role(b)
+    
+    print "\n===bad============ john0.likes <- johnX "
+    starttime = datetime.datetime.now()
+    out = ctxt.query(role, p)
+    endtime = datetime.datetime.now()
+    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=goodQuery()
+elapsed_micro=get_micro(e_time)
+sys.stderr.write("%d %d GOOD_1(micro)\n" % (cred_count,elapsed_micro))
+
+elapsed_good=timedelta()
+k=10
+while(k):
+    e_time=goodQuery()
+    elapsed_good=elapsed_good+e_time
+    k=k-1
+    if(k==9):
+       elapsed_micro=get_micro(e_time)
+       sys.stderr.write("%d %d GOOD_2(micro)\n" % (cred_count,elapsed_micro))
+
+    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/10))
+
+
+###############################################################
+
+e_time=badQuery()
+elapsed_micro=get_micro(e_time)
+sys.stderr.write("%d %d BAD_1(micro)\n" % (cred_count,elapsed_micro))
+
+elapsed_bad=timedelta()
+k=10
+while(k):
+    e_time=badQuery()
+    elapsed_bad=elapsed_bad+e_time
+    k=k-1
+    if(k==9):
+        elapsed_micro=get_micro(e_time)
+        sys.stderr.write("%d %d BAD_2(micro)\n" % (cred_count,elapsed_micro))
+
+    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/10))
Index: examples/scaling_tests/daisychain/likes_python/base/RESULT
===================================================================
--- examples/scaling_tests/daisychain/likes_python/base/RESULT	(revision 248530744daa5aba8e076649b532945a14660457)
+++ 	(revision )
@@ -1,3 +1,0 @@
-
-===bad============ johnN.after <- john0 
-YAP query failed
