STATS#
Classes#
- class utils.stats.track_system_stats(logger=None, disabled=False)[source]#
Bases:
object
A context manager that tracks the memory usage of the system. Tracks both CPU and GPU memory usage if available.
Usage:
with track_system_stats() as t: for i in range(100): ... # Do something t() cpu_res, gpu_res = t.cpu_res, t.gpu_res
- Parameters:
Functions#
- utils.stats.get_memory_mb()[source]#
Get the memory usage of the current process and its children.
- Returns:
A dictionary containing the memory usage of the current process and its children.
- The dictionary has the following keys:
self: The memory usage of the current process.
children: The memory usage of the children of the current process.
total: The total memory usage of the current process and its children.
- Return type: