summaryrefslogtreecommitdiff
path: root/src/server/util.py
blob: e8840114fa387eab4b8c7685e3d344d211495fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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