Also time exceptions
@@ -2045,7 +2045,9 @@ cdef class Timer:
@contextlib.contextmanager
def timed(self, operation: str):
ts_start = time.monotonic()
+ try:
yield
+ finally:
ts_end = time.monotonic()
duration = ts_end - ts_start
series = self._durations.setdefault(operation, [])
