- lsst.utils.timer.timeMethod(_func: Any | None = None, *, metadata: MutableMapping | None = None, logger: Logger | None = None, logLevel: int = 10) Callable ¶
Measure duration of a method.
The method to wrap.
Metadata to use as override if the instance object attached to this timer does not support a
Logger to use when the class containing the decorated method does not have a
Log level to use when logging messages. Default is
Writes various measures of time and possibly memory usage to the metadata; all items are prefixed with the function name.
This decorator only works with instance methods of any class with these attributes:
import lsst.utils as utils import lsst.pipe.base as pipeBase class FooTask(pipeBase.Task): pass @utils.timeMethod def run(self, ...): # or any other instance method you want to time pass