Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. import contextlib
  2. import time
  3.  
  4. @contextlib.contextmanager
  5. def profile(caption = None):
  6. bef = time.time()
  7. yield
  8. aft = time.time()
  9. diff = aft - bef
  10. print "***", "profile", caption, diff * 1000.0, "ms"
Add Comment
Please, Sign In to add comment