import cProfile
def startProfiling(pr):
pr.enable()
def stopProfiling(pr):
import pstats, cStringIO
pr.disable()
s = cStringIO.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
ps.print_stats()
print(s.getvalue())
if enable_profiling:
pr = cProfile.Profile()
startProfiling(pr)
...
if enable_profiling:
stopProfiling(pr)
setSSQueryDefaults(timeoutsec=600
Optimization
- Published on Oct 17, 2021
- 1 minute(s) read
Was this article helpful?