-
Notifications
You must be signed in to change notification settings - Fork 79
[dev] Profiling
Infernio edited this page Feb 7, 2022
·
6 revisions
Profiler calls for Python, copy-paste ready (because I keep forgetting the syntax and trudging through git reflog
is no fun).
You can set these up with PyCharm as live templates too.
See also [dev] Parent call tracing for a useful recipe for figuring out where those calls are coming from.
import cProfile, pstats, io
pr = cProfile.Profile()
pr.enable()
pr.disable()
s = io.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats('cumtime')
ps.print_stats()
bolt.deprint(s.getvalue())