Skip to content

Instantly share code, notes, and snippets.

@MaddoxRauch
Last active November 19, 2021 04:21
Show Gist options
  • Save MaddoxRauch/431d1f3f2743c45173f1ccfd6ee16066 to your computer and use it in GitHub Desktop.
Save MaddoxRauch/431d1f3f2743c45173f1ccfd6ee16066 to your computer and use it in GitHub Desktop.
Just add import and class to python file, then you can use as a wrapper to functions using '@timetrack' to see how long it takes to execute. Or keep file separate and use 'from pyanal import TimeTrack' and use as wrapper.
import timeit
class TimeTrack:
def __init__(self, func):
start = timeit.default_timer()
func()
stop = timeit.default_timer()
print("Time to get %s" % (stop-start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment