Created
July 13, 2017 03:04
-
-
Save wangqr/d93c29f80a3807387b6adea220295635 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(func, *args, **kwargs): | |
import time | |
if time.__dict__.get('perf_counter'): | |
timer = time.perf_counter | |
else: | |
timer = time.clock | |
a = timer() | |
ret = func(*args, **kwargs) | |
b = timera() | |
print('[ INFO ] Elapsed %f sec' % (b-a)) | |
return ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment