mantidimaging.core.utility.execution_timer module#
Context managers for logging execution time or profile of code.
These are not used in the code, but are here as developer tools. They can be used by wrapping the code of interest:
with ExecutionProfiler(msg="a_slow_function()"):
a_slow_function()
They will display to the performance log if a logger object is not given. See the developer docs to enable performance logging.
- class mantidimaging.core.utility.execution_timer.ExecutionProfiler(msg: str = 'Elapsed time', logger: ~logging.Logger = <Logger perf.mantidimaging.core.utility.execution_timer (WARNING)>, max_lines: int = 20, sort_by: str = 'cumtime')[source]#
Bases:
object
Context manager used to profile the execution of code in its context.