Skip to content

Commit

Permalink
Export num_stack_mappings to track the number of in-flight stack map…
Browse files Browse the repository at this point in the history
…pings and tasks in application (JuliaLang#51301)
  • Loading branch information
NHDaly authored and RAI CI (GitHub Action Automation) committed May 28, 2024
1 parent e1b3c7c commit b7b423c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gc-stacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ static void free_stack(void *stkbuf, size_t bufsz)
}
#endif

JL_DLLEXPORT uint32_t jl_get_num_stack_mappings(void)
{
return jl_atomic_load_relaxed(&num_stack_mappings);
}

const unsigned pool_sizes[] = {
128 * 1024,
Expand Down
6 changes: 6 additions & 0 deletions test/threads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,9 @@ end
@test_throws ArgumentError @macroexpand(@threads 1) # arg isn't an Expr
@test_throws ArgumentError @macroexpand(@threads if true 1 end) # arg doesn't start with for
end

@testset "num_stack_mappings metric" begin
@test @ccall(jl_get_num_stack_mappings()::Cint) >= 1
# There must be at least two: one for the root test task and one for the async task:
@test fetch(@async(@ccall(jl_get_num_stack_mappings()::Cint))) >= 2
end

0 comments on commit b7b423c

Please sign in to comment.