Last active
June 4, 2019 08:00
-
-
Save kzinmr/3c539c689c1802d8f5276e3812bffc73 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 contextlib | |
import time | |
@contextlib.contextmanager | |
def time_measure(ident): | |
tstart = time.time() | |
yield | |
elapsed = time.time() - tstart | |
print(f"{ident}: {elapsed} sec") | |
with time_measure('test_method:sum1'): | |
sum1 = sum(range(10, 1000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/cool-RR/PySnooper