Coverage for kwave/utils/tictoc.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-10-24 11:52 -0700

1from time import perf_counter 

2 

3 

4class TicToc(object): 

5 start_time = -1 

6 

7 @staticmethod 

8 def tic(): 

9 TicToc.start_time = perf_counter() 

10 

11 @staticmethod 

12 def toc(reset: bool = False) -> float: 

13 passed_time = perf_counter() - TicToc.start_time 

14 if reset: 

15 TicToc.tic() 

16 return passed_time