Last active
October 4, 2016 09:20
-
-
Save nvdv/ec9fc3b4f01cc52c000f5855a06d9ba1 to your computer and use it in GitHub Desktop.
How profilers work - profiling decorator
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
def profile(func): | |
def wrapper(*args, **kwargs): | |
start_time = time.time() | |
result = func(*args, **kwargs) | |
print("Function %s run time is %f s" % ( | |
func.__name__, time.time() - start_time)) | |
return result | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment