ytm.utils.Timer#

class ytm.utils.Timer#

Bases: object

Context manager for measuring elapsed wall-clock time.

Examples

>>> with Timer() as timer:
...     do_work()
>>> print(timer.elapsed)
property elapsed: float#

Elapsed time in seconds. Must be accessed after the context exits.

Returns:
float

Wall-clock seconds between __enter__ and __exit__.

Raises:
RuntimeError

If accessed before the context has exited.