Store profile stats for later analysis.

Section: Performance Hotspots

Save cProfile output to a file

bash
bash
python -m cProfile -o profile.stats app.py

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Performance Hotspots
Inspect saved profile stats
Read and sort a saved profile run.
OpenIn sheetpythonsame section
Show import statements as they happen
Print detailed import resolution activity.
Show garbage collector stats
Inspect GC activity when memory grows unexpectedly.
Print site-package configuration
Inspect interpreter paths and site initialization.
Force a garbage collection cycle
Useful for experiments while diagnosing leaks.