Skip to content

Commit e39ae71

Browse files
NHDalyRAI CI (GitHub Action Automation)
authored andcommitted
Export num_stack_mappings to track the number of in-flight stack mappings and tasks in application (JuliaLang#51301)
1 parent 9e37aca commit e39ae71

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/gc-stacks.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ static void free_stack(void *stkbuf, size_t bufsz)
7676
}
7777
#endif
7878

79+
JL_DLLEXPORT uint32_t jl_get_num_stack_mappings(void)
80+
{
81+
return jl_atomic_load_relaxed(&num_stack_mappings);
82+
}
7983

8084
const unsigned pool_sizes[] = {
8185
128 * 1024,

test/threads.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,9 @@ end
327327
@test_throws ArgumentError @macroexpand(@threads 1) # arg isn't an Expr
328328
@test_throws ArgumentError @macroexpand(@threads if true 1 end) # arg doesn't start with for
329329
end
330+
331+
@testset "num_stack_mappings metric" begin
332+
@test @ccall(jl_get_num_stack_mappings()::Cint) >= 1
333+
# There must be at least two: one for the root test task and one for the async task:
334+
@test fetch(@async(@ccall(jl_get_num_stack_mappings()::Cint))) >= 2
335+
end

0 commit comments

Comments
 (0)