MCPcopy Create free account
hub / github.com/THUDM/GLM / elapsed

Method elapsed

utils.py:144–158  ·  view source on GitHub ↗

Calculate the elapsed time.

(self, reset=True)

Source from the content-addressed store, hash-verified

142 self.started_ = False
143
144 def elapsed(self, reset=True):
145 """Calculate the elapsed time."""
146 started_ = self.started_
147 # If the timing in progress, end it first.
148 if self.started_:
149 self.stop()
150 # Get the elapsed time.
151 elapsed_ = self.elapsed_
152 # Reset the elapsed time
153 if reset:
154 self.reset()
155 # If timing was in progress, set it back.
156 if started_:
157 self.start()
158 return elapsed_
159
160 def __init__(self):
161 self.timers = {}

Callers 3

_trainFunction · 0.80
logMethod · 0.80
trainFunction · 0.80

Calls 3

stopMethod · 0.95
resetMethod · 0.95
startMethod · 0.95

Tested by

no test coverage detected