Scalene is a high-performance diagnostic utility designed to measure resource consumption during the execution of Python applications. It functions as a line-level monitor, providing granular insights that pinpoint the specific source code responsible for performance overhead.
The tool distinguishes itself through statistical profiling that captures stack traces and resource usage without requiring manual instrumentation of the source code. It tracks CPU, GPU, and memory consumption by intercepting library-level calls and hardware driver commands, allowing for the analysis of both managed and native code.
Beyond standard CPU and memory tracking, the profiler supports multi-process resource monitoring and identifies memory leaks by locating allocations that remain unreleased. It maps these performance metrics directly to source code lines, facilitating the identification of bottlenecks in complex applications and GPU-accelerated computational tasks.