impuls.tools.machine_load

impuls.tools.machine_load.memory_usage_kb() int

Returns the memory usage of the current process in KiB. May be nopped out to return 0 on weird platforms.

class impuls.tools.machine_load.LoadTracker

Bases: object

LoadTracker is a simple context manager that tracks time and memory usage of the with body.

>>> with LoadTracker() as load:
...    # Some expensive operation (here: simple primality test)
...    n = 10358100653869
...    all(n % i != 0 for i in range(2, int(n ** .5) + 2))
True
>>> 0.0 < load.delta_time < 1.0
True
__enter__() Self
__exit__(*_: Any) None
property delta_rss: int
property delta_time: float