usage: scalene [-h] [--version] [--column-width COLUMN_WIDTH] [--outfile OUTFILE] [--html] [--json] [--reduced-profile] [--profile-interval PROFILE_INTERVAL] [--cpu-only] [--profile-all] [--profile-only PROFILE_ONLY] [--profile-exclude PROFILE_EXCLUDE] [--use-virtual-time] [--cpu-percent-threshold CPU_PERCENT_THRESHOLD] [--cpu-sampling-rate CPU_SAMPLING_RATE] [--allocation-sampling-window ALLOCATION_SAMPLING_WINDOW] [--malloc-threshold MALLOC_THRESHOLD] [--program-path PROGRAM_PATH] [--memory-leak-detector] [--on | --off] Scalene: a high-precision CPU and memory profiler, version 1.4.0 https://github.com/plasma-umass/scalene command-line: % scalene [options] yourprogram.py or % python3 -m scalene [options] yourprogram.py in Jupyter, line mode: %scrun [options] statement in Jupyter, cell mode: %%scalene [options] your code here optional arguments: -h, --help show this help message and exit --version prints the version number for this release of Scalene and exits --column-width COLUMN_WIDTH Column width for profile output (default: 132) --outfile OUTFILE file to hold profiler output (default: stdout) --html output as HTML (default: text) --json output as JSON (default: text) --reduced-profile generate a reduced profile, with non-zero lines only (default: False) --profile-interval PROFILE_INTERVAL output profiles every so many seconds (default: inf) --cpu-only only profile CPU+GPU time (default: profile CPU+GPU, memory, and copying) --profile-all profile all executed code, not just the target program (default: only the target program) --profile-only PROFILE_ONLY profile only code in filenames that contain the given strings, separated by commas (default: no restrictions) --profile-exclude PROFILE_EXCLUDE do not profile code in filenames that contain the given strings, separated by commas (default: no restrictions) --use-virtual-time measure only CPU time, not time spent in I/O or blocking (default: False) --cpu-percent-threshold CPU_PERCENT_THRESHOLD only report profiles with at least this percent of CPU time (default: 1%) --cpu-sampling-rate CPU_SAMPLING_RATE CPU sampling rate (default: every 0.01s) --allocation-sampling-window ALLOCATION_SAMPLING_WINDOW Allocation sampling window size, in bytes (default: 1549351 bytes) --malloc-threshold MALLOC_THRESHOLD only report profiles with at least this many allocations (default: 100) --program-path PROGRAM_PATH The directory containing the code to profile (default: the path to the profiled program) --memory-leak-detector EXPERIMENTAL: report likely memory leaks (default: False) --on start with profiling on (default) --off start with profiling off When running Scalene in the background, you can suspend/resume profiling for the process ID that Scalene reports. For example: % python3 -m scalene yourprogram.py & Scalene now profiling process 12345 to suspend profiling: python3 -m scalene.profile --off --pid 12345 to resume profiling: python3 -m scalene.profile --on --pid 12345