Python/Profilers

From Omnia
Jump to navigation Jump to search

Python Profiling with Profilers

https://docs.python.org/3/library/profile.html

The files cProfile and profile can also be invoked as a script to profile another script. For example:

python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)

Sort order

-s
See https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats
'cumulative' SortKey.CUMULATIVE cumulative time
'cumtime' N/A cumulative time
-r reverse  # put at bottom