diff service/reasoning/oneShot @ 250:c1287ab87add

fix oneshot. more time reportin Ignore-this: c99ce7d8d31a8ed45bdcb8d0ad08a3aa
author drewp@bigasterisk.com
date Tue, 09 Feb 2016 22:10:38 -0800
parents 745eff67ad40
children 79efb6fdcb95
line wrap: on
line diff
--- a/service/reasoning/oneShot	Tue Feb 09 22:01:19 2016 -0800
+++ b/service/reasoning/oneShot	Tue Feb 09 22:10:38 2016 -0800
@@ -3,7 +3,7 @@
 send a statement to the reasoning server for one update cycle. Args
 are s/p/o in n3 notation, with many prefixes predefined here.
 """
-import sys, restkit
+import sys, restkit, time
 s, p, o = sys.argv[1:]
 
 prefixes = {
@@ -22,8 +22,10 @@
 stmt = '%s %s %s .' % (expand(s), expand(p), expand(o))
 print "Sending: %s" % stmt
 
+t1 = time.time()
 reasoning = restkit.Resource("http://bang:9071/")
-reasoning.post("oneShot",
-               headers={"content-type": "text/n3"},
-               payload=stmt)
-
+ret = reasoning.post("oneShot",
+                     headers={"content-type": "text/n3"},
+                     payload=stmt)
+g = float(ret.headers['x-graph-ms'])
+print "%.1f ms for graph update; %.1f ms other overhead" % (g, 1000 * (time.time() - t1) - g)