Created
January 6, 2014 22:01
-
-
Save almet/8290576 to your computer and use it in GitHub Desktop.
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 timeit(what): | |
def wrapper(fn): | |
def wrapped(*args, **kwargs): | |
start = datetime.datetime.now() | |
rv = fn(*args, **kwargs) | |
end = datetime.datetime.now() | |
with open('/tmp/timeit', 'a') as f: | |
f.write('%s start: %s' % (what, start.isoformat())) | |
f.write('%s end: %s' % (what, end.isoformat())) | |
f.write('\n\n') | |
return rv | |
return wrapped | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment