I would like to get the time spent on the cell execution in addition to the original output from cell.
To this end, I tried %%timeit -r1 -n1 but it does
you may also want to look in to python's profiling magic command %prunwhich gives something like -
def sum_of_lists(N):
total = 0
for i in range(5):
L = [j ^ (j >> i) for j in range(N)]
total += sum(L)
return total
then
%prun sum_of_lists(1000000)
will return
14 function calls in 0.714 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
5 0.599 0.120 0.599 0.120 :4()
5 0.064 0.013 0.064 0.013 {built-in method sum}
1 0.036 0.036 0.699 0.699 :1(sum_of_lists)
1 0.014 0.014 0.714 0.714 :1()
1 0.000 0.000 0.714 0.714 {built-in method exec}
I find it useful when working with large chunks of code.