Created
December 9, 2023 19:15
-
-
Save sizhky/02f3b5e8d01bf7dcb1eafef6d5f7a72f to your computer and use it in GitHub Desktop.
ticktock timer for time profiling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import perf_counter | |
class Ticker: | |
def __init__(self): | |
self.tik = perf_counter() | |
def __call__(self, arg, info=None, newl=False): | |
tok = perf_counter() | |
t = round(tok-self.tik, 3) | |
if newl: print() | |
print(f'{arg.upper()}:: {t:.3f}') | |
if info is not None: print(info) | |
self.tik = perf_counter() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment