diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-11-17 19:50:46 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2014-11-17 19:50:46 +0200 |
| commit | 3bcc61d481e9332c3f254cf4f0bb4e79fa0a4b15 (patch) | |
| tree | decb150a0747ca463b5ed8e173f897303e9a426b /src-py/util.py | |
| parent | e6b5070143b20acc9b87e43e393194497b4fd4bb (diff) | |
server util code
Diffstat (limited to 'src-py/util.py')
| -rw-r--r-- | src-py/util.py | 22 |
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 |
