Jump to content

User:Ema/Profiling Python

From Wikitech

Generating profile data

$ python -m cProfile -o out.profile whatever.py

Analysis

import pstats
p = pstats.Stats('out.profile')
p.sort_stats('cumulative').print_stats(10)

GUI

$ runsnakerun out.profile

Call graphs

$ pyprof2calltree -k -i myscript.cprof

See also