I get about 300 entries from my cProfile output and had to scroll up a long time every time I use it.
Is there a way to make cProfile print only like, top 10 lines or something?
I get about 300 entries from my cProfile output and had to scroll up a long time every time I use it.
Is there a way to make cProfile print only like, top 10 lines or something?
You can sort by say 'cumulative' and show top N lines using print_stats(4). Without sorting on something watching the top N lines may not be of use.
From Python profiler official docs
import pstats
p = pstats.Stats('restats')
p.sort_stats('cumulative').print_stats(10)