diff options
| author | J08nY | 2024-07-15 14:45:28 +0200 |
|---|---|---|
| committer | J08nY | 2024-07-15 14:45:28 +0200 |
| commit | 73e3bf1951e9c98d4f9d097e96ffac48601fd11e (patch) | |
| tree | 63c9d7b6b7899557895ef6573cd68ffc9211eb41 /test/utils.py | |
| parent | d71a02135dedff150d208746ffd9722e42e90959 (diff) | |
| download | pyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.tar.gz pyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.tar.zst pyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.zip | |
Diffstat (limited to 'test/utils.py')
| -rw-r--r-- | test/utils.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/utils.py b/test/utils.py index 1b00ef7..5d1e80f 100644 --- a/test/utils.py +++ b/test/utils.py @@ -11,6 +11,10 @@ from cProfile import Profile as cProfiler class RawTimer: + start: int + end: int + duration: float + def __enter__(self): self.start = time.perf_counter_ns() @@ -20,8 +24,17 @@ class RawTimer: class Profiler: - def __init__(self, prof_type: Union[Literal["py"], Literal["c"], Literal["raw"]], output_directory: str, benchmark_name: str): - self._prof: Union[PyProfiler, cProfiler, RawTimer] = {"py": PyProfiler, "c": cProfiler, "raw": RawTimer}[prof_type]() + def __init__( + self, + prof_type: Union[Literal["py"], Literal["c"], Literal["raw"]], + output_directory: str, + benchmark_name: str, + ): + self._prof: Union[PyProfiler, cProfiler, RawTimer] = { + "py": PyProfiler, + "c": cProfiler, + "raw": RawTimer, + }[prof_type]() self._prof_type: Union[Literal["py"], Literal["c"], Literal["raw"]] = prof_type self._root_frame = None self._state = "out" |
