tbplas.Timer
- class tbplas.Timer
Class for measuring the time usage of function calls within programs.
- _start_time
time of last tic call
- Type:
Dict[str, float]
- _track_status
whether the slots are being tracked for measuring time usage
- Type:
Dict[str, bool]
- _time_usage
time usage between tic/toc calls
- Type:
Dict[str, float]
- _total_time_usage
overall time usage
- Type:
Dict[str, float]
- __init__() None
Methods
__init__
()Report time usage between tic/toc calls.
Report overall time usage.
reset
()Reset start time, track status and time usages.
tic
(slot)Begin tracking time usage for given slot.
toc
(slot)Stop tracking time usage for given slot.
- __init__() None
- report_time() None
Report time usage between tic/toc calls.
- Returns:
None
- Raises:
RuntimeError – if tracking for any slot has not ended
- report_total_time() None
Report overall time usage.
- Returns:
None
- Raises:
RuntimeError – if tracking for any slot has not ended
- reset() None
Reset start time, track status and time usages.
- Returns:
None
- tic(slot: str) None
Begin tracking time usage for given slot.
- Parameters:
slot – name of the slot
- Returns:
None
- toc(slot: str) None
Stop tracking time usage for given slot.
- Parameters:
slot – name of the slot
- Returns:
None
- Raises:
RuntimeError – if tracking for slot has not started
- __weakref__
list of weak references to the object (if defined)