ThreadLocalCounters.jl

Author JuliaConcurrent
Popularity
1 Star
Updated Last
2 Years Ago
Started In
October 2021

ThreadLocalCounters

Dev CI

ThreadLocalCounters.jl provides a macro @tlc to associate a counter to a code location.

julia> using ThreadLocalCounters

julia> hello_world() = @tlc hello_world;

The installed counters can be enumerated using ThreadLocalCounters.list:

julia> ThreadLocalCounters.list(; all = true)
1-element Vector{ThreadLocalCounters.Internal.ThreadLocalCounter}:
 [0] hello_world @Main #= REPL[2]:2 =#

The thread-local counter is incremented each time the program hits the associated code location:

julia> hello_world();

julia> ThreadLocalCounters.list()
1-element Vector{ThreadLocalCounters.Internal.ThreadLocalCounter}:
 [1] hello_world @Main #= REPL[2]:2 =#

julia> hello_world();

julia> ThreadLocalCounters.list()
1-element Vector{ThreadLocalCounters.Internal.ThreadLocalCounter}:
 [2] hello_world @Main #= REPL[2]:2 =#

Used By Packages

No packages found.