Created
December 21, 2011 17:25
-
-
Save kalloc/1506859 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
import time | |
def tracktime(f): | |
import time | |
def x(*a, **kw): | |
start = time.time() | |
res = f(*a, **kw) | |
print 'code work %d ms time'%((time.time()-start)*10**3) | |
return res | |
return x | |
@tracktime | |
def sleep(second): | |
print 'try to sleep %f sec' % (second) | |
time.sleep(second) | |
sleep(1) | |
sleep(0.01) | |
sleep(0.001) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment