TimerOutputs.jl

I am trying to time a piece of code. Here is a MWE:

using TimerOutputs

function x()
    @timeit to "Timing" a = 3 + 4
end

x()

I get the error: “to” is not defined. What is my error? Thanks.

Solved the problem. I am missing the line:

const to = TimerOutput();

which many examples online did not show.

3 Likes

All examples in the docs do show it, however:

My apologies. My mind obviously filtered it out. In any case, I got it working and love it.

3 Likes