Created
December 1, 2022 02:08
-
-
Save user454322/911e0a8eb34cd3fd2bf34551e3ce7035 to your computer and use it in GitHub Desktop.
Python profiling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import time | |
#... | |
def set_up(self): | |
#... | |
self.pr = cProfile.Profile() | |
self.pr.enable() | |
def tear_down(self): | |
#... | |
self.pr.disable() | |
#self.pr.print_stats(sort="tottime") | |
self.pr.dump_stats('/tmp/example.prof') | |
`snakeviz /tmp/example.prof` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment