Created
January 21, 2013 20:34
-
-
Save Velrok/4589075 to your computer and use it in GitHub Desktop.
copy from http://www.andreas-jung.com/contents/a-python-decorator-for-measuring-the-execution-time-of-methods more professional solution may be http://mg.pov.lt/profilehooks/
This file contains hidden or 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 time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
print '%r (%r, %r) %2.2f sec' % \ | |
(method.__name__, args, kw, te-ts) | |
return result | |
return timed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment