Sort cProfile output by percall when profiling a Python script Sort cProfile output by percall when profiling a Python script python python

Sort cProfile output by percall when profiling a Python script


-s only uses the keys found under sort_stats.

calls (call count)cumulative (cumulative time)cumtime (cumulative time)file (file name)filename (file name)module (file name)ncalls (call count)pcalls (primitive call count)line (line number)name (function name)nfl (name/file/line)stdname (standard name)time (internal time)tottime (internal time)

Here's an example

python -m cProfile -s tottime myscript.py