From 79ad2c7df3422916a7ac83064f6ab71a32a333b1 Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 2 Aug 2022 15:37:48 -0400 Subject: [PATCH] fix tests --- stdlib/Profile/src/Profile.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index ff795aafa9158d..5778d16e893680 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -95,6 +95,10 @@ using keywords or in the order `(n, delay)`. """ function init(; n::Union{Nothing,Integer} = nothing, delay::Union{Nothing,Real} = nothing, limitwarn::Bool = true) n_cur = ccall(:jl_profile_maxlen_data, Csize_t, ()) + if n_cur == 0 && isnothing(n) && isnothing(delay) + # indicates that the buffer hasn't been initialized at all, so set the default + return default_init() + end delay_cur = ccall(:jl_profile_delay_nsec, UInt64, ())/10^9 if n === nothing && delay === nothing nthreads = Sys.iswindows() ? 1 : Threads.nthreads() # windows only profiles the main thread