pythontimejupyter-notebookjuliaijulia-notebook

How to measure execution time of entire jupyter notebook comprising of different cells in JULIA?


I have a script written in JULIA language in Jupyter notebook. The script is divided into different cells. I'd like to calculate the execution time of not only a single line or cell, but the entire script comprising all the cells. In Python, I could do it using

#In the beginning of script
import time
a = time.time()
...
...
#At the end of script
b= time.time()
b - a

I'd like to have something similar to calculate the execution time of the entire script in JULIA. I tried using

@time begin
...
end

However, this works with a single line or cell only and does not seem to work when I put the statements in the beginning and end of the script if they are in different cells. How can I get the execution time of the entire script comprising all cells?


Solution

  • you can also calculate manually the elapsed time:

    a = time()
    
    # ...
    
    b = time()
    println(b-a)