MCPcopy Create free account
hub / github.com/EryiXie/PlaneRecNet / start

Function start

utils/timer.py:54–73  ·  view source on GitHub ↗

Start timing the specific function. Note: If use_stack is True, only one timer can be active at a time. Once you stop this timer, the previous one will start again.

(fn_name, use_stack=True)

Source from the content-addressed store, hash-verified

52
53
54def start(fn_name, use_stack=True):
55 """
56 Start timing the specific function.
57 Note: If use_stack is True, only one timer can be active at a time.
58 Once you stop this timer, the previous one will start again.
59 """
60 global _running_timer, _disable_all
61
62 if _disable_all:
63 return
64
65 if use_stack:
66 if _running_timer is not None:
67 stop(_running_timer, use_stack=False)
68 _timer_stack.append(_running_timer)
69 start(fn_name, use_stack=False)
70 _running_timer = fn_name
71 else:
72 _start_times[fn_name] = 0
73 starter.record()
74
75
76def stop(fn_name=None, use_stack=True):

Callers 2

stopFunction · 0.85
__enter__Method · 0.85

Calls 2

stopFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected