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

**URL:** https://discourse.julialang.org/t/how-to-know-the-time-between-lines-not-for-a-specific-function/59558
**Category:** General Usage
**Created:** [April 18, 2021, 6:11pm UTC](https://discourse.julialang.org/t/how-to-know-the-time-between-lines-not-for-a-specific-function/59558 "2021-04-18T18:11:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![AlphaF20](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@AlphaF20](https://discourse.julialang.org/u/AlphaF20)
#### Post date: [April 18, 2021, 6:11pm UTC](https://discourse.julialang.org/t/how-to-know-the-time-between-lines-not-for-a-specific-function/59558/1 "2021-04-18T18:11:18Z")

</div>

From [Performance Tips · The Julia Language](https://docs.julialang.org/en/v1/manual/performance-tips/#Measure-performance-with-%5B@time%5D(@ref)-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

```julia
start_time = time.time()

```

and

```julia
finish_time = time.time()

```

between a couple of lines.

---

<div class="post-metadata">

### Author: ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)
#### Post date: [April 18, 2021, 6:15pm UTC](https://discourse.julialang.org/t/how-to-know-the-time-between-lines-not-for-a-specific-function/59558/2 "2021-04-18T18:15:23Z")

</div>

Would something like this work?

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

```

---

<div class="post-metadata">

### Author: ![AlphaF20](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@AlphaF20](https://discourse.julialang.org/u/AlphaF20)
#### Post date: [April 18, 2021, 6:22pm UTC](https://discourse.julialang.org/t/how-to-know-the-time-between-lines-not-for-a-specific-function/59558/3 "2021-04-18T18:22:42Z")

</div>

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