LSST Applications g04a91732dc+cc8870d3f5,g07dc498a13+5aa0b8792f,g0fba68d861+80045be308,g1409bbee79+5aa0b8792f,g1a7e361dbc+5aa0b8792f,g1fd858c14a+f64bc332a9,g208c678f98+1ae86710ed,g35bb328faa+fcb1d3bbc8,g4d2262a081+47ad8a29a8,g4d39ba7253+9633a327c1,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+9633a327c1,g668ecb457e+25d63fd678,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+8b64ca622a,g89139ef638+5aa0b8792f,g89e1512fd8+04325574d3,g8d6b6b353c+9633a327c1,g9125e01d80+fcb1d3bbc8,g989de1cb63+5aa0b8792f,g9f33ca652e+b196626af7,ga9baa6287d+9633a327c1,gaaedd4e678+5aa0b8792f,gabe3b4be73+1e0a283bba,gb1101e3267+71e32094df,gb58c049af0+f03b321e39,gb90eeb9370+2807b1ad02,gcf25f946ba+8b64ca622a,gd315a588df+a39986a76f,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+4e42d81ab7,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,gfe73954cf8+a1301e4c20,w.2025.11
LSST Data Management Base Package
|
Public Member Functions | |
__init__ (self, str name, *MonAgent|logging.Logger args, _TagsType|None tags=None, int log_level=logging.INFO) | |
None | add_values (self, **int|float values) |
Timer | start (self) |
Timer | stop (self) |
Timer | dump (self) |
tuple[float, float, float] | accumulated (self) |
dict[str, int|float] | as_dict (self, str prefix="") |
str | __str__ (self) |
Timer | __enter__ (self) |
Any | __exit__ (self, type|None exc_type, Any exc_val, Any exc_tb) |
Protected Attributes | |
_name = name | |
list | _mon_agents = [] |
list | _loggers = [] |
_tags = tags | |
_log_level = log_level | |
float | _startReal = -1.0 |
float | _startUser = -1.0 |
float | _startSys = -1.0 |
float | _sumReal = 0.0 |
float | _sumUser = 0.0 |
float | _sumSys = 0.0 |
dict | _extra_values = {} |
Instance of this class can be used to track consumed time. Parameters ---------- name : `str` Timer name, will be use for reporting to both monitoring and logging. Typically the name should look like an identifier for ease of use with downstream monitoring software. *args : `MonAgent` or `logging.Logger` Positional arguments can include a combination of `MonAgent` and `logging.Logger` instances. They will be used to report accumulated times on exit from context or by calling `dump` method directly. tags : `~collections.abc.Mapping` [`str`, `str` or `int`], optional Keyword argument, additional tags added to monitoring report and logging output. log_level : `int`, optional Keyword argument, level used for logging output, default is `logging.INFO`. Notes ----- This class is also a context manager and can be used in a `with` statement. By default it prints consumed CPU time and real time spent in a context. Example: with Timer("SelectTimer", logger): engine.execute('SELECT ...')
lsst.dax.apdb.timer.Timer.__init__ | ( | self, | |
str | name, | ||
*MonAgent | logging.Logger | args, | ||
_TagsType | None | tags = None, | ||
int | log_level = logging.INFO ) |
Definition at line 73 of file timer.py.
Timer lsst.dax.apdb.timer.Timer.__enter__ | ( | self | ) |
Any lsst.dax.apdb.timer.Timer.__exit__ | ( | self, | |
type | None | exc_type, | ||
Any | exc_val, | ||
Any | exc_tb ) |
str lsst.dax.apdb.timer.Timer.__str__ | ( | self | ) |
Definition at line 162 of file timer.py.
tuple[float, float, float] lsst.dax.apdb.timer.Timer.accumulated | ( | self | ) |
Return accumulated real, user, and system times in seconds.
Definition at line 139 of file timer.py.
None lsst.dax.apdb.timer.Timer.add_values | ( | self, | |
**int | float | values ) |
Add values to dump together with timing information. Parameters ---------- **values : int | float Key/values to add to timer information.
Definition at line 101 of file timer.py.
dict[str, int | float] lsst.dax.apdb.timer.Timer.as_dict | ( | self, | |
str | prefix = "" ) |
Return timers and extra values as dictionary.
Definition at line 151 of file timer.py.
Timer lsst.dax.apdb.timer.Timer.dump | ( | self | ) |
Dump timer statistics
Definition at line 131 of file timer.py.
Timer lsst.dax.apdb.timer.Timer.start | ( | self | ) |
Timer lsst.dax.apdb.timer.Timer.stop | ( | self | ) |
Stop timer.
Definition at line 119 of file timer.py.