| 63 | |
| 64 | |
| 65 | class TicToc: |
| 66 | def __init__(self): |
| 67 | self.t = None |
| 68 | self.t_init = time.time() |
| 69 | |
| 70 | def tic(self): |
| 71 | self.t = time.time() |
| 72 | |
| 73 | def toc(self, total=False): |
| 74 | if total: |
| 75 | return (time.time() - self.t_init) * 1000 |
| 76 | |
| 77 | assert self.t, 'You forgot to call tic()' |
| 78 | return (time.time() - self.t) * 1000 |
| 79 | |
| 80 | def tocp(self, str): |
| 81 | t = self.toc() |
| 82 | log(f"{str} took {t:.4f}ms") |
| 83 | return t |
| 84 | |
| 85 | |
| 86 | class AccumDict: |
no outgoing calls
no test coverage detected