dubfi.core.profile_util¶
Profiling and performance monitoring utilities.
Added in version 0.1.0: (initial release)
Functions¶
|
Log duration of wall clock time of function call. |
|
Profile function and save result to file (decorator). |
|
Create daemon thread that logs memory usage. |
|
Log memory usage to log_fn in infinite loop. |
Module Contents¶
- dubfi.core.profile_util.timer(f, log=log)[source]¶
Log duration of wall clock time of function call.
- dubfi.core.profile_util.profile_fnc(fnc, target=None)[source]¶
Profile function and save result to file (decorator).
- dubfi.core.profile_util.monitor_memory(interval: float = 10, log_fn=log.info, count: int = -1) int[source]¶
Create daemon thread that logs memory usage.
- Parameters:
interval (float) – logging interval in seconds
log_fn (callable) – output function, can be print or log.info or similar. This function should take one string as argument.
count (int, optional) – stop after this number of log message