1

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?

hbstha123
  • 1,260
  • 11
  • 23

2 Answers2

1

you can also calculate manually the elapsed time:

a = time()

# ...

b = time()
println(b-a)
MarcMush
  • 1,439
  • 6
  • 13
0

I also found an alternative way to do this:

using Dates
a = now()
#...
b = now()
b - a
hbstha123
  • 1,260
  • 11
  • 23