MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / Timer

Class Timer

yolox/tracking_utils/timer.py:4–37  ·  view source on GitHub ↗

A simple timer.

Source from the content-addressed store, hash-verified

2
3
4class Timer(object):
5 """A simple timer."""
6 def __init__(self):
7 self.total_time = 0.
8 self.calls = 0
9 self.start_time = 0.
10 self.diff = 0.
11 self.average_time = 0.
12
13 self.duration = 0.
14
15 def tic(self):
16 # using time.time instead of time.clock because time time.clock
17 # does not normalize for multithreading
18 self.start_time = time.time()
19
20 def toc(self, average=True):
21 self.diff = time.time() - self.start_time
22 self.total_time += self.diff
23 self.calls += 1
24 self.average_time = self.total_time / self.calls
25 if average:
26 self.duration = self.average_time
27 else:
28 self.duration = self.diff
29 return self.duration
30
31 def clear(self):
32 self.total_time = 0.
33 self.calls = 0
34 self.start_time = 0.
35 self.diff = 0.
36 self.average_time = 0.
37 self.duration = 0.

Callers 4

image_demoFunction · 0.90
imageflow_demoFunction · 0.90
imageflow_demoFunction · 0.90
eval_seqFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected