MCPcopy Create free account
hub / github.com/ActiveState/code / wrapper

Function wrapper

recipes/Python/577323_A_Profiling_Tool/recipe-577323.py:28–32  ·  view source on GitHub ↗
(*args, **argd)

Source from the content-addressed store, hash-verified

26
27def timing(func):
28 def wrapper(*args, **argd):
29 start_time = time.time()
30 ret = func(*args, **argd)
31 print 'function: %s used %.2f seconds' % (func.__name__, time.time()-start_time)
32 return ret
33 functools.update_wrapper(wrapper, func)
34
35 return wrapper

Callers

nothing calls this directly

Calls 2

funcFunction · 0.50
timeMethod · 0.45

Tested by

no test coverage detected