labm8.prof¶
Profiling API for timing critical paths in code.
-
labm8.prof.
disable
()¶
-
labm8.prof.
enable
()¶
-
labm8.prof.
is_enabled
()¶
-
labm8.prof.
isrunning
(name)¶ Check if a timer is running.
Parameters: name (str, optional) – The name of the timer to check. Returns: True if timer is running, else False. Return type: bool
-
labm8.prof.
profile
(fun, *args, **kwargs)¶ Profile a function.
-
labm8.prof.
start
(name)¶ Start a new profiling timer.
Parameters: - name (str, optional) – The name of the timer to create. If no name is given, the resulting timer is anonymous. There can only be one anonymous timer.
- unique (bool, optional) – If true, then ensure that timer name is unique. This is to prevent accidentally resetting an existing timer.
Returns: Whether or not profiling is enabled.
Return type: bool
-
labm8.prof.
stop
(name, file=<open file '<stderr>', mode 'w'>)¶ Stop a profiling timer.
Parameters: name (str) – The name of the timer to stop. If no name is given, stop the global anonymous timer. Returns: Whether or not profiling is enabled. Return type: bool Raises: KeyError
– If the named timer does not exist.
-
labm8.prof.
timers
()¶ Iterate over all timers.
Returns: An iterator over all time names. Return type: Iterable[str]