Skip to content

Commit

Permalink
Add system info to start of testsuite. Profile: don't spawn profile l…
Browse files Browse the repository at this point in the history
…istener on windows (#44639)

(cherry picked from commit 95da0d8)
  • Loading branch information
IanButterworth authored and KristofferC committed Mar 23, 2022
1 parent 01a01ef commit c5ac53c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 6 additions & 3 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,12 @@ function __init__()
delay = 0.001
end
init(n, delay, limitwarn = false)
PROFILE_PRINT_COND[] = Base.AsyncCondition()
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
errormonitor(Threads.@spawn(profile_printing_listener()))
@static if !Sys.iswindows()
# triggering a profile via signals is not implemented on windows
PROFILE_PRINT_COND[] = Base.AsyncCondition()
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
errormonitor(Threads.@spawn(profile_printing_listener()))
end
end

"""
Expand Down
10 changes: 8 additions & 2 deletions stdlib/Profile/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ let cmd = Base.julia_cmd()
script = """
using Profile
f(::Val) = GC.safepoint()
@profile for i = 1:10^3; f(Val(i)); end
@profile for i = 1:10^3
println(i)
f(Val(i))
end
println("done")
print(Profile.len_data())
"""
p = open(`$cmd -e $script`)
Expand All @@ -184,7 +188,9 @@ let cmd = Base.julia_cmd()
s = read(p, String)
close(t)
@test success(p)
@test parse(Int, s) > 100
@test !isempty(s)
@test occursin("done", s)
@test parse(Int, split(s, '\n')[end]) > 100
end

if Sys.isbsd() || Sys.islinux()
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ cd(@__DIR__) do
Distributed.remotecall_eval(Main, workers(), revise_init_expr)
end

println("""
Running parallel tests with:
nworkers() = $(nworkers())
nthreads() = $(Threads.nthreads())
Sys.CPU_THREADS = $(Sys.CPU_THREADS)
Sys.total_memory() = $(Base.format_bytes(Sys.total_memory()))
Sys.free_memory() = $(Base.format_bytes(Sys.free_memory()))
""")

#pretty print the information about gc and mem usage
testgroupheader = "Test"
workerheader = "(Worker)"
Expand Down

0 comments on commit c5ac53c

Please sign in to comment.