Skip to content

Instantly share code, notes, and snippets.

@almet
Created January 6, 2014 22:01
Show Gist options
  • Save almet/8290576 to your computer and use it in GitHub Desktop.
Save almet/8290576 to your computer and use it in GitHub Desktop.
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