Skip to content

Commit c2e45de

Browse files
committed
Use more accurate timer
1 parent b352834 commit c2e45de

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def video_play(self, video_file):
481481
print(self.video_reader, self.video_reader.isOpened())
482482
if self.video_reader.isOpened():
483483
while not self.stop:
484-
t1 = time.process_time()
484+
t1 = time.perf_counter()
485485
ret, frame = self.video_reader.read()
486486
if not ret:
487487
break

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def make_filename(prefix: str, ext: str):
4040
def time_function(func):
4141
"""Decorator to time a function."""
4242
def wrapper(*args, **kwargs):
43-
t1 = time.process_time()
43+
t1 = time.perf_counter()
4444
res = func(*args, **kwargs)
45-
t2 = time.process_time()
45+
t2 = time.perf_counter()
4646
print('%s took %0.3f ms' % (func.__name__, (t2-t1)*1000.0))
4747
return res
4848
return wrapper

0 commit comments

Comments
 (0)