MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / timer

Function timer

code/basics/timer_decorator.py:33–39  ·  view source on GitHub ↗
(Fn)

Source from the content-addressed store, hash-verified

31import time
32
33def timer(Fn):
34 def inner(*args, **kwargs):
35 Ts = time.time()
36 Fn(*args, **kwargs)
37 Te = time.time()
38 print(f'dT = {Te-Ts:.3f} seconds')
39 return inner
40
41@timer
42def sleeper(sec):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected