Skip to content

Instantly share code, notes, and snippets.

@lramosduarte
Created November 24, 2017 15:47
Show Gist options
  • Save lramosduarte/65adbc1ba35a3f27a2895e2f53584a7f to your computer and use it in GitHub Desktop.
Save lramosduarte/65adbc1ba35a3f27a2895e2f53584a7f to your computer and use it in GitHub Desktop.
timming functions python
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