Created
November 24, 2014 09:59
-
-
Save willcalderbank/62dc55864ce34e014e45 to your computer and use it in GitHub Desktop.
cProfile
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 | |
def do_cprofile(func): | |
def profiled_func(*args, **kwargs): | |
profile = cProfile.Profile() | |
try: | |
profile.enable() | |
result = func(*args, **kwargs) | |
profile.disable() | |
return result | |
finally: | |
profile.print_stats() | |
return profiled_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment