Skip to content

Commit 36007b7

Browse files
Profile: print profile peek to stderr (#48291)
1 parent 388864a commit 36007b7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ function profile_printing_listener()
3939
wait(PROFILE_PRINT_COND[])
4040
peek_report[]()
4141
if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1"
42-
println("Saving heap snapshot...")
42+
println(stderr, "Saving heap snapshot...")
4343
fname = take_heap_snapshot()
44-
println("Heap snapshot saved to `$(fname)`")
44+
println(stderr, "Heap snapshot saved to `$(fname)`")
4545
end
4646
end
4747
catch ex
@@ -54,9 +54,9 @@ end
5454
# An internal function called to show the report after an information request (SIGINFO or SIGUSR1).
5555
function _peek_report()
5656
iob = IOBuffer()
57-
ioc = IOContext(IOContext(iob, stdout), :displaysize=>displaysize(stdout))
57+
ioc = IOContext(IOContext(iob, stderr), :displaysize=>displaysize(stderr))
5858
print(ioc, groupby = [:thread, :task])
59-
Base.print(stdout, String(take!(iob)))
59+
Base.print(stderr, String(take!(iob)))
6060
end
6161
# This is a ref so that it can be overridden by other profile info consumers.
6262
const peek_report = Ref{Function}(_peek_report)

stdlib/Profile/test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ if Sys.isbsd() || Sys.islinux()
199199
let cmd = Base.julia_cmd()
200200
script = """
201201
x = rand(1000, 1000)
202-
println("started")
202+
println(stderr, "started")
203203
while true
204204
x * x
205205
yield()
206206
end
207207
"""
208208
iob = Base.BufferStream()
209-
p = run(pipeline(`$cmd -e $script`, stderr = devnull, stdout = iob), wait = false)
209+
p = run(pipeline(`$cmd -e $script`, stderr = iob, stdout = devnull), wait = false)
210210
t = Timer(120) do t
211211
# should be under 10 seconds, so give it 2 minutes then report failure
212212
println("KILLING BY PROFILE TEST WATCHDOG\n")

0 commit comments

Comments
 (0)