KristofferC / TimerOutputs.jl

Formatted output of timed sections in Julia
Other
653 stars 54 forks source link

Times converted to hours prematurely and incorrectly #149

Closed wcwitt closed 2 years ago

wcwitt commented 2 years ago

The following

using TimerOutputs
to = TimerOutput()
@timeit to "sleep 7 minutes" sleep(7*60)
show(to)

produces

 ────────────────────────────────────────────────────────────────────────────
                                    Time                    Allocations
                           ───────────────────────   ────────────────────────
     Tot / % measured:          1.17h /  99.8%           43.2MiB /   0.3%

 Section           ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────────────
 sleep 7 minutes        1    1.17h  100.0%   1.17h    142KiB  100.0%   142KiB
 ────────────────────────────────────────────────────────────────────────────

which is wrong.

I think it's just a bug in utilities.jl

    elseif t < 360e9
        value, units = t / 60e9, "m"
    else
        value, units = t / 360e9, "h"
    end

where the 360s should be 3600s.