From 61738aae4b2092f5ab8d88242f855c60e36e418d Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Sun, 15 Jan 2023 18:50:38 -0500 Subject: [PATCH 1/2] Profile: print profile peek to stderr --- stdlib/Profile/src/Profile.jl | 8 ++++---- stdlib/Profile/test/runtests.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index f016e19cd3e05..ba2d7390a214c 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -39,9 +39,9 @@ function profile_printing_listener() wait(PROFILE_PRINT_COND[]) peek_report[]() if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1" - println("Saving heap snapshot...") + println(stderr, "Saving heap snapshot...") fname = take_heap_snapshot() - println("Heap snapshot saved to `$(fname)`") + println(stderr, "Heap snapshot saved to `$(fname)`") end end catch ex @@ -54,9 +54,9 @@ end # An internal function called to show the report after an information request (SIGINFO or SIGUSR1). function _peek_report() iob = IOBuffer() - ioc = IOContext(IOContext(iob, stdout), :displaysize=>displaysize(stdout)) + ioc = IOContext(IOContext(iob, stderr), :displaysize=>displaysize(stderr)) print(ioc, groupby = [:thread, :task]) - Base.print(stdout, String(take!(iob))) + Base.print(stderr, String(take!(iob))) end # This is a ref so that it can be overridden by other profile info consumers. const peek_report = Ref{Function}(_peek_report) diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index 1246dcf25a82c..6e6ce845b30ef 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -206,7 +206,7 @@ if Sys.isbsd() || Sys.islinux() end """ iob = Base.BufferStream() - p = run(pipeline(`$cmd -e $script`, stderr = devnull, stdout = iob), wait = false) + p = run(pipeline(`$cmd -e $script`, stderr = iob, stdout = devnull), wait = false) t = Timer(120) do t # should be under 10 seconds, so give it 2 minutes then report failure println("KILLING BY PROFILE TEST WATCHDOG\n") From 200e5081e84675024fd9387a09b719670ad3c564 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 16 Jan 2023 09:24:01 -0500 Subject: [PATCH 2/2] fix test --- stdlib/Profile/test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index 6e6ce845b30ef..2a39640d215ed 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -199,7 +199,7 @@ if Sys.isbsd() || Sys.islinux() let cmd = Base.julia_cmd() script = """ x = rand(1000, 1000) - println("started") + println(stderr, "started") while true x * x yield()