Ghilder Ghilder
Ghilder Ghilder

Reputation: 47

Total Jupyter notebook elapsed time

I've used the usefull hint described in vForce's answer on "Simple way to measure cell execution time in ipython notebook" to get each Notebook cell elapsed time. But how can i get the total notebook elapsed time at the end of the "Run all"?

Upvotes: 1

Views: 361

Answers (1)

Wender
Wender

Reputation: 1001

import time

def elapsed_time(start, end):
    hours, rem = divmod(end-start, 3600)
    minutes, seconds = divmod(rem, 60)
    print("Elapsed Time: {:0>2}:{:0>2}:{:05.2f}"
                .format(int(hours),int(minutes),seconds))

#Test

#First cell of your notebook 
start = time.time()
# Anothers cells ...

#Two last line of Notebook
end = time.time()
elapsed_time(start, end)

Upvotes: 0

Related Questions