Skip to content

tkf/StopWatches.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StopWatches: Simple intrusive time measurements

StopWatches.jl is like TimerOutputs.jl but designed for thread-friendliness.

Usage

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
─────┼─────────────────────────────────────────────────────────────────────────────
   10.0111036 s  0.0222073 s       2          REPL[2]      1  (:Main,)
   20.101307 s   0.101307 s        1  longer  REPL[3]      1  (:Main,)

API summary

Measurement API

  • @stopwatch([tag], code): measure the times to execute code.
  • StopWatches.clear(): reset timing counters.

Measurement API is also available from StopWatchesBase package. StopWatches simply re-expose these APIs.

Analysis API

  • StopWatches.summary(): display summary data.
  • StopWatches.time_dataframe(): export summary data as a DataFrame.
  • StopWatches.time_table(): export summary data as a table.

See also:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages