dubfi.profile_util

Profiling and performance monitoring utilities.

Added in version 0.1.0: (initial release)

Functions

timer(f[, log])

Log duration of wall clock time of function call.

profile_fnc(fnc[, target])

Profile function and save result to file (decorator).

monitor_memory([interval, log_fn])

Create daemon thread that logs memory usage.

_monitor_memory_thread(interval, log_fn)

Log memory usage to log_fn in infinite loop.

Module Contents

dubfi.profile_util.timer(f, log=log)[source]

Log duration of wall clock time of function call.

dubfi.profile_util.profile_fnc(fnc, target=None)[source]

Profile function and save result to file (decorator).

dubfi.profile_util.monitor_memory(interval=10, log_fn=log.info)[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.

Return type:

None

dubfi.profile_util._monitor_memory_thread(interval, log_fn)[source]

Log memory usage to log_fn in infinite loop.

Parameters:

interval (float)

Return type:

None