summaryrefslogtreecommitdiff
path: root/src-py/util.py
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-16 17:14:32 +0200
committerAlon Levy <alon@pobox.com>2014-12-16 17:14:32 +0200
commitc7d026b1d504323a8c61d51b726e5e8d2337fc4b (patch)
tree75607d07c90beb8024e34afd2bab3503dcaccda4 /src-py/util.py
parentdff765d765085fe2ee172abc606f4f8b25a39c27 (diff)
parent38078c537f642806e4849dc99c07d679f816fe23 (diff)
Merging rhizi-server into rhizi, back to a single repo
Merge remote-tracking branch 'old-server/master' into wip/map-nodes-by-id_minimize-name-use
Diffstat (limited to 'src-py/util.py')
-rw-r--r--src-py/util.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src-py/util.py b/src-py/util.py
new file mode 100644
index 00000000..e8840114
--- /dev/null
+++ b/src-py/util.py
@@ -0,0 +1,22 @@
+"""
+code with no better place to go
+"""
+import time
+
+def debug_log_duration(method):
+ """
+ dubug call durations - use example:
+
+ neo4j_util.post = util.debug_log_duration(neo4j_util.post)
+ """
+
+ def timed(*args, **kw):
+ t_0 = time.time()
+ result = method(*args, **kw)
+ t_1 = time.time()
+ dt = t_1 - t_0
+
+ print ('%2.2f sec, function: %r' % (dt, method.__name__))
+ return result
+
+ return timed