diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-16 17:37:42 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-16 17:37:42 +0200 |
| commit | ade19de410e0a789a921ec1666b278b2a64176d6 (patch) | |
| tree | c4c54b106de93609ca7bb70a20fd4be696715dbe /src/server/util.py | |
| parent | c7d026b1d504323a8c61d51b726e5e8d2337fc4b (diff) | |
moving files around after repository merger
Diffstat (limited to 'src/server/util.py')
| -rw-r--r-- | src/server/util.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/util.py b/src/server/util.py new file mode 100644 index 00000000..e8840114 --- /dev/null +++ b/src/server/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 |
