# TimerOutputs.jl : How to correctly stop timing?

**URL:** https://discourse.julialang.org/t/timeroutputs-jl-how-to-correctly-stop-timing/110924
**Category:** General Usage
**Created:** [February 28, 2024, 10:50pm UTC](https://discourse.julialang.org/t/timeroutputs-jl-how-to-correctly-stop-timing/110924 "2024-02-28T22:50:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)
#### Post date: [February 28, 2024, 10:50pm UTC](https://discourse.julialang.org/t/timeroutputs-jl-how-to-correctly-stop-timing/110924/1 "2024-02-28T22:50:01Z")

</div>

Hi all!

I have a need to “freeze” a timer object and ensure that it stops counting the time. I have the following example code:

```julia
using TimerOutputs

# Create a new timer object
const MyTimer = TimerOutput()

function simulation_step1()
    @timeit MyTimer "Step 1" sleep(0.1) # Simulating a computation-heavy task
end

function simulation_step2()
    @timeit MyTimer "Step 2" sleep(0.2) # Simulating a longer computation-heavy task
end

function simulation_step3()
    @timeit MyTimer "Step 3" sleep(0.05) # Simulating a shorter computation-heavy task
end

function run_simulation()
    simulation_step1()
    simulation_step2()
    simulation_step3()
end

run_simulation()

println(MyTimer)
disable_timer!(MyTimer)
sleep(5)
println(MyTimer)

```

Which produces:

![image](https://global.discourse-cdn.com/julialang/original/3X/4/3/433bcc0fed1de94a338aa19b26e6730308926d12.png)

Using `disable_timer!` it seems to correctly stop the inner timers so that they do not add up, but the “global” time is still counting.

How do I enforce/completely pause any tracking for a specific timer?

Kind regards

---

<div class="post-metadata">

### Author: ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)
#### Post date: [February 29, 2024, 7:24pm UTC](https://discourse.julialang.org/t/timeroutputs-jl-how-to-correctly-stop-timing/110924/2 "2024-02-29T19:24:44Z")

</div>

For anyone looking in the future, seems like it has been on the roadmap, but not possible to do unfortunately.

> <https://github.com/KristofferC/TimerOutputs.jl/issues/36>
>
> Sometimes you want to stop a timer but delay the printing of it. Could be done w…ith a \`stop!\` command. Should figure out if there is a point to adding \`start!\` to startup a timer from a stopped state.
