pytimings.timer¶
Main module.
Module Contents¶
Classes¶
Elapsed wall/system/user time for a section, all in seconds. |
|
Functions¶
|
Start timer on entering block scope, stop it (and optionally output) on exiting. |
|
Start timer on entering block scope, stop it (and optionally output) on exiting. |
|
Attributes¶
- class pytimings.timer.TimingDelta[source]¶
Bases:
NamedTupleElapsed wall/system/user time for a section, all in seconds.
- exception pytimings.timer.NoTimerError(section: str, timings: Timings | None = None, is_unstopped: bool = False)[source]¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
- class pytimings.timer.TimingData(name: str)[source]¶
-
- delta() TimingDelta[source]¶
- class pytimings.timer.Timings[source]¶
- _commited_deltas: dict[str, TimingDelta][source]¶
- _known_timers_map: dict[str, tuple[bool, TimingData | None]][source]¶
- stop(section_name: str | None = None) TimingDelta | None[source]¶
stop named section’s counter or all of them if section_name is None
- reset(section_name: str | None = None) None[source]¶
set elapsed time back to 0 for a given section or all of them if section_name is None
- delta(section_name: str) TimingDelta[source]¶
get the full delta tuple
- pytimings.timer.scoped_timing(section_name: str, log_function: collections.abc.Callable[[str], None] | None = None, timings: Timings | None = None, format: str = '') collections.abc.Iterator[None][source]¶
Start timer on entering block scope, stop it (and optionally output) on exiting.
The printout will only show walltime for the current scope. See
pytimings.timer.cummulative_scoped_timing()for a version with cummulative output.
- pytimings.timer.cummulative_scoped_timing(section_name: str, log_function: collections.abc.Callable[[str], None] | None = None, timings: Timings | None = None, format: str = '') collections.abc.Iterator[None][source]¶
Start timer on entering block scope, stop it (and optionally output) on exiting.
The printout will show the cummulated walltime for all scopes with this section name. See
pytimings.timer.scoped_timing()for a version with non-cummulative output.