iqm.benchmarks.utils.timeit

Contents

iqm.benchmarks.utils.timeit#

iqm.benchmarks.utils.timeit(f: Callable) Callable#

Decorator for calculating the amount of time a function takes to execute.

The decorated function returns a tuple where the first item is the original output, and the second item the execution time in seconds. Additionally, it will log the elapsed execution time on the DEBUG log level if it exceeds 1 second.

Parameters:

f (Callable) – The function whose execution we wish to time.

Returns:

Decorated function f.

Return type:

Callable