You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make jl_cumulative_compile_time_ns global (and reentrant).
Now, multiple tasks (on the same or different Threads) can start and stop compilation
time measurement, without interrupting each other.
Add `cumulative_compile_time_ns()` to return the cumulative compile time for a thread without stopping measurement.
```julia
julia> Base.cumulative_compile_time_ns_before() # enable constantly measuring compilation time
0x0000000000000000
julia> @time@eval module M ; f(x) = 2+x; end
0.006730 seconds (919 allocations: 55.212 KiB, 57.20% compilation time)
Main.M
julia> Base.cumulative_compile_time_ns()
0x00000000075246b3
julia> @time 2+2
0.000000 seconds
4
julia> Base.cumulative_compile_time_ns()
0x0000000007fe4a46
julia> @time@eval M.f(2)
0.003538 seconds (750 allocations: 46.247 KiB, 94.64% compilation time)
4
julia> Base.cumulative_compile_time_ns()
0x000000000831619e
```
Make jl_cumulative_compile_time_ns into a global, atomic variable.
Instead of keeping per-task compilation time, this change keeps a
global counter of compilation time, protected with atomic mutations.
Fixes#41739
```julia
julia> include("./compilation-task-migration-17-example.jl")
start thread: 2
end thread: 2
5.185706 seconds (3.53 M allocations: 2.570 GiB, 7.34% gc time, 15.57% compilation time)
julia> include("./compilation-task-migration-17-example.jl")
start thread: 3
WARNING: replacing module M.
end thread: 1
4.110316 seconds (18.23 k allocations: 2.391 GiB, 5.67% gc time, 0.24% compilation time)
```
0 commit comments