Created
November 24, 2017 15:47
-
-
Save lramosduarte/65adbc1ba35a3f27a2895e2f53584a7f to your computer and use it in GitHub Desktop.
timming functions python
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 tempo_executar_funcao(f): | |
def wrap(*args): | |
time1 = time.time() | |
ret = f(*args) | |
time2 = time.time() | |
# alterar se for python3 o print e nome de funcao | |
print '%s function took %0.3f ms' % (f.func_name, (time2-time1)*1000.0) | |
return ret | |
return wrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment