Read and sort a saved profile run.

Section: Performance Hotspots

Inspect saved profile stats

python
python
import pstats

stats = pstats.Stats('profile.stats')
stats.sort_stats('cumtime').print_stats(30)

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
Save cProfile output to a file
Store profile stats for later analysis.
OpenIn sheetbashsame 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.