Run ❯
Get your
own Python
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
import cProfile, pstats def work(): s = 0 for i in range(20000): s += i*i return s pr = cProfile.Profile() pr.enable() work() pr.disable() pstats.Stats(pr).strip_dirs().sort_stats("time").print_stats(5)
2 function calls in 0.001 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 0.001 0.001 prog.py:3(work)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}