CoolFace
Apppublic

Shellbrady/LivePortrait5

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
timer.py30 linesDownload Raw Back to utils
1# coding: utf-82 3"""4tools to measure elapsed time5"""6 7import time8 9class Timer(object):10    """A simple timer."""11 12    def __init__(self):13        self.total_time = 0.14        self.calls = 015        self.start_time = 0.16        self.diff = 0.17 18    def tic(self):19        # using time.time instead of time.clock because time time.clock20        # does not normalize for multithreading21        self.start_time = time.time()22 23    def toc(self, average=True):24        self.diff = time.time() - self.start_time25        return self.diff26 27    def clear(self):28        self.start_time = 0.29        self.diff = 0.30