StopWatches.jl is like TimerOutputs.jl but designed for thread-friendliness.
julia> using StopWatches
julia> f() = @stopwatch sleep(0.01);
julia> g() = @stopwatch :longer sleep(0.1);
julia> f()
julia> f()
julia> g()
The timing can be obtained via, e.g.,
julia> df = StopWatches.time_dataframe()
2×8 DataFrame
Row │ average_time total_time ncalls tag file line fullname pkgid
│ Quantity… Quantity… Int64 Union… Union… Int64 Tuple… Union…
─────┼─────────────────────────────────────────────────────────────────────────────
1 │ 0.0111036 s 0.0222073 s 2 REPL[2] 1 (:Main,)
2 │ 0.101307 s 0.101307 s 1 longer REPL[3] 1 (:Main,)
@stopwatch([tag], code)
: measure the times to executecode
.StopWatches.clear()
: reset timing counters.
Measurement API is also available from StopWatchesBase
package. StopWatches
simply re-expose these APIs.
StopWatches.summary()
: display summary data.StopWatches.time_dataframe()
: export summary data as aDataFrame
.StopWatches.time_table()
: export summary data as a table.
- Profiling · The Julia Language
- EventTracker.jl: Track all individual timings.
- TimerOutputs.jl: Formatted output of timed sections in Julia.
- JuliaPerf/*.jl