Sometimes I execute a method that takes a long time to calculate
In [1]:
long_running_invocation()
Out[1]:
Often I’m interested to know how long it took, so I have to write this:
In[2]:
import time
start = time.time()
long_running_invocation()
end = time.time()
print end - start
Out[2]: 1024
Is there a way to set up my IPython laptop so that it automatically prints the execution time of each call that I make, as in the following example?
In [1]:
long_running_invocation()
Out[1] (1.59s):
source
share