How to know the time between lines, not for a specific function

From Performance Tips · The Julia Language@time-and-pay-attention-to-memory-allocation
it seems to me that @time is for a specific function

Is there any method to know the time for a few lines have been executed? E.g., in python, one may write

start_time = time.time()

and

finish_time = time.time()

between a couple of lines.

Would something like this work?

@time begin
    x = f()
    y = g()
    z = h(x, y)
    t = 2 + 2
end
1 Like

Thank you so much! It works! Also consistent with just @time with function!