module documentation
This module provides a context manager to measure the elapsed time of a block of code. It can also be used as a decorator.
Example
with perfTimer(myCallback):
# do something
@perfTimer(lambda ms: print(f'someFunction took: {ms} ms'))
def someFunction():
# do something
| Function | perf |
Meassure and print the elapsed time. |
@contextmanager
def perfTimer(callback: Callable = print) -> Generator[ None, None, None]:
(source)
ΒΆ
Meassure and print the elapsed time.
| Parameters | |
callback:Callable | The output callback function. It will receive the elapsed ms (float) as the only argument. Default is print. |
| Returns | |
Generator[ | Undocumented |