sciris.sc_profiling

Profiling and CPU/memory management functions.

Highlights:

Functions

checkmem

Checks how much memory the variable or variables in question use by dumping them to file.

checkram

Measure actual memory usage, typically at different points throughout execution.

cpu_count

Alias to mp.cpu_count()

cpuload

Takes a snapshot of current CPU usage via psutil

loadbalancer

Delay execution while CPU load is too high -- a very simple load balancer.

memload

Takes a snapshot of current fraction of memory usage via psutil

mprofile

Profile the line-by-line memory required by a function.

profile

Profile the line-by-line time required by a function.

Classes

resourcemonitor

Asynchronously monitor resource (e.g.

Exceptions

LimitExceeded

Custom exception for use with the sc.resourcemonitor() monitor.