Coverage for src/extratools_core/debugtools.py: 0%

13 statements  

« prev     ^ index     » next       coverage.py v7.8.1, created at 2025-05-27 20:50 -0700

1import resource 

2import sys 

3import time 

4from functools import partial 

5 

6print2 = partial(print, file=sys.stderr) 

7 

8 

9def peakmem() -> int: 

10 return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss 

11 

12 

13__lasttime: float = 0 

14 

15 

16def stopwatch() -> float: 

17 global __lasttime # noqa: PLW0603 

18 

19 now: float = time.perf_counter() 

20 diff: float = now - __lasttime 

21 __lasttime = now 

22 

23 return diff