stopwatch package
Submodules
stopwatch.stopwatch module
Stopwatch class for timing portions of python code
- class stopwatch.stopwatch.Tick(id: int, name: str, time: float, duration: float, action: str)[source]
Bases:
object- id: int
- name: str
- time: float
- duration: float
- action: str
- class stopwatch.stopwatch.Stopwatch(precision=None)[source]
Bases:
objectStopwatch Instance
- A typical lifecycle of the stopwatch:
[creation] –> [start] –> [tick, pause, resume] –> [stop]
- property time_paused
Get pause-time between different ticks
- property time_active
- property time_total
- get_time_elapsed(start_key: int = 0, end_key: int = -1, exclude_pause: bool = True)[source]
Get time elapsed between different ticks
If there are multiple matches for start or end ticks, the following two ticks are selected: - the chronologically first matching tick for start - the chronologically last matching tick for end
- Parameters:
start_key (int or str)
- exclude_pause: bool
If True, pause-time is not counted. The default is True.
- Return type:
Total runtime (with or without pause-time)
- property time_elapsed
Get time elapsed between different ticks
If there are multiple matches for start or end ticks, the following two ticks are selected: - the chronologically first matching tick for start - the chronologically last matching tick for end
- Parameters:
start_key (int or str)
- exclude_pause: bool
If True, pause-time is not counted. The default is True.
- Return type:
Total runtime (with or without pause-time)
Module contents
Stopwatch class for timing your python code with support for pause, resume and multiple named-ticks.
- class stopwatch.Stopwatch(precision=None)[source]
Bases:
objectStopwatch Instance
- A typical lifecycle of the stopwatch:
[creation] –> [start] –> [tick, pause, resume] –> [stop]
- get_time_elapsed(start_key: int = 0, end_key: int = -1, exclude_pause: bool = True)[source]
Get time elapsed between different ticks
If there are multiple matches for start or end ticks, the following two ticks are selected: - the chronologically first matching tick for start - the chronologically last matching tick for end
- Parameters:
start_key (int or str)
- exclude_pause: bool
If True, pause-time is not counted. The default is True.
- Return type:
Total runtime (with or without pause-time)
- property time_active
- property time_elapsed
Get time elapsed between different ticks
If there are multiple matches for start or end ticks, the following two ticks are selected: - the chronologically first matching tick for start - the chronologically last matching tick for end
- Parameters:
start_key (int or str)
- exclude_pause: bool
If True, pause-time is not counted. The default is True.
- Return type:
Total runtime (with or without pause-time)
- property time_paused
Get pause-time between different ticks
- property time_total