sc_profiling#

Profiling and CPU/memory management functions.

Highlights:

Classes

profile

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

cprofile

Function profiler, built off Python's built-in cProfile

tracecalls

Trace all function calls.

resourcemonitor

Asynchronously monitor resource (e.g. memory) usage and terminate the process if the specified threshold is exceeded.

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.

benchmark

Benchmark Python performance

mprofile

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

listfuncs

Enumerate all functions in the supplied arguments; used in sc.profile().

Exceptions

LimitExceeded

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