aboutsummaryrefslogtreecommitdiff
path: root/test/utils.py
diff options
context:
space:
mode:
authorJ08nY2024-07-15 14:45:28 +0200
committerJ08nY2024-07-15 14:45:28 +0200
commit73e3bf1951e9c98d4f9d097e96ffac48601fd11e (patch)
tree63c9d7b6b7899557895ef6573cd68ffc9211eb41 /test/utils.py
parentd71a02135dedff150d208746ffd9722e42e90959 (diff)
downloadpyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.tar.gz
pyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.tar.zst
pyecsca-73e3bf1951e9c98d4f9d097e96ffac48601fd11e.zip
Diffstat (limited to 'test/utils.py')
-rw-r--r--test/utils.py17
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"