time_this¶
-
lsst.utils.timer.time_this(log: Optional[LsstLoggers] = None, msg: Optional[str] = None, level: int = 10, prefix: Optional[str] = 'timer', args: Iterable[Any] = (), mem_usage: bool = False, mem_child: bool = False, mem_unit: u.Quantity = Unit("byte"), mem_fmt: str = '.0f') → Iterator[None]¶ Time the enclosed block and issue a log message.
Parameters: - log :
logging.Logger, optional Logger to use to report the timer message. The root logger will be used if none is given.
- msg :
str, optional Context to include in log message.
- level :
int, optional Python logging level to use to issue the log message. If the code block raises an exception the log message will automatically switch to level ERROR.
- prefix :
str, optional Prefix to use to prepend to the supplied logger to create a new logger to use instead. No prefix is used if the value is set to
None. Defaults to “timer”.- args : iterable of any
Additional parameters passed to the log command that should be written to
msg.- mem_usage :
bool, optional Flag indicating whether to include the memory usage in the report. Defaults, to False.
- mem_child :
bool, optional Flag indication whether to include memory usage of the child processes.
- mem_unit :
astropy.units.Unit, optional Unit to use when reporting the memory usage. Defaults to bytes.
- mem_fmt :
str, optional Format specifier to use when displaying values related to memory usage. Defaults to ‘.0f’.
- log :