Skip to content

JuliaConcurrent/ThreadLocalCounters.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 =#

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages