Created
December 30, 2019 02:39
-
-
Save dragonly/d3b199254df7d0f2e3946295c61b69bf to your computer and use it in GitHub Desktop.
python profile
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
profile = cProfile.Profile() | |
profile.enable() | |
''' | |
code to profile | |
''' | |
profile.disable() | |
s = io.StringIO() | |
ps = pstats.Stats(profile, stream=s).sort_stats('tottime').reverse_order() | |
ps.print_stats() | |
print(s.getvalue()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment