diff options
| author | J08nY | 2024-07-16 16:33:26 +0200 |
|---|---|---|
| committer | J08nY | 2024-07-16 16:33:26 +0200 |
| commit | eea57d6019d7b13a3c9e01cf1ecb11b132e5e291 (patch) | |
| tree | a89f8e3f5ff6aee78e8bfb7c3617b382c8f9bdf8 /test/utils.py | |
| parent | d6fc0ada881aad78543124bd2ffb63ce187b4e0f (diff) | |
| download | pyecsca-eea57d6019d7b13a3c9e01cf1ecb11b132e5e291.tar.gz pyecsca-eea57d6019d7b13a3c9e01cf1ecb11b132e5e291.tar.zst pyecsca-eea57d6019d7b13a3c9e01cf1ecb11b132e5e291.zip | |
Diffstat (limited to 'test/utils.py')
| -rw-r--r-- | test/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/utils.py b/test/utils.py index 5d1e80f..1276ad6 100644 --- a/test/utils.py +++ b/test/utils.py @@ -29,6 +29,7 @@ class Profiler: prof_type: Union[Literal["py"], Literal["c"], Literal["raw"]], output_directory: str, benchmark_name: str, + operations: int = 0 ): self._prof: Union[PyProfiler, cProfiler, RawTimer] = { "py": PyProfiler, @@ -40,6 +41,7 @@ class Profiler: self._state = "out" self._output_directory = output_directory self._benchmark_name = benchmark_name + self._operations = operations def __enter__(self): self._prof.__enter__() @@ -90,7 +92,7 @@ class Profiler: elif self._prof_type == "c": self._prof.print_stats("cumtime") # type: ignore elif self._prof_type == "raw": - print(f"{self._prof.duration:.4} s") # type: ignore + print(f"{self._prof.duration:.4f}s {(self._operations/self._prof.duration) if self._operations else '-':.1f}op/s") # type: ignore def get_time(self) -> float: if self._state != "out": |
