lsst.dax.apdb gd2a12a3803+0c2c227a2b
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
lsst.dax.apdb.timer.Timer Class Reference

Public Member Functions

 __init__ (self, str name="", bool doPrint=True)
 
Timer start (self)
 
Timer stop (self)
 
Timer dump (self)
 
str __str__ (self)
 
Timer __enter__ (self)
 
Any __exit__ (self, type|None exc_type, Any exc_val, Any exc_tb)
 

Protected Attributes

 _name
 
 _print
 
 _startReal
 
 _startUser
 
 _startSys
 
 _sumReal
 
 _sumUser
 
 _sumSys
 

Detailed Description

Instance of this class can be used to track consumed time.

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'):
        engine.execute('SELECT ...')

Constructor & Destructor Documentation

◆ __init__()

lsst.dax.apdb.timer.Timer.__init__ ( self,
str name = "",
bool doPrint = True )
Parameters
----------
name : `str`
    Timer name, will be printed together with statistics.
doPrint : `bool`
    If True then print statistics on exist from context.

Member Function Documentation

◆ __enter__()

Timer lsst.dax.apdb.timer.Timer.__enter__ ( self)
Enter context, start timer

◆ __exit__()

Any lsst.dax.apdb.timer.Timer.__exit__ ( self,
type | None exc_type,
Any exc_val,
Any exc_tb )
Exit context, stop and dump timer

◆ dump()

Timer lsst.dax.apdb.timer.Timer.dump ( self)
Dump timer statistics

◆ start()

Timer lsst.dax.apdb.timer.Timer.start ( self)
Start timer.

◆ stop()

Timer lsst.dax.apdb.timer.Timer.stop ( self)
Stop timer.

The documentation for this class was generated from the following file: