Skip to content

Commit

Permalink
make report print customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Dec 4, 2021
1 parent 01b4268 commit 6a38e9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ end
const PROF_PEEK_COND = Ref{Base.AsyncCondition}()
function prof_peek()
wait(PROF_PEEK_COND[])
Base.require(Base.PkgId(Base.UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")).profile_peek_report()
Base.require(Base.PkgId(Base.UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")).profile_peek_report[]()
Threads.@spawn prof_peek()
end

Expand Down
10 changes: 5 additions & 5 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const nmeta = 4 # number of metadata fields per block (threadid, taskid, cpu_cyc
precompile_script = """
import Profile
Profile.@profile sleep(1)
Profile.profile_peek_report()
Profile.profile_peek_report[]()
"""

# deprecated functions: use `getdict` instead
Expand Down Expand Up @@ -41,10 +41,10 @@ macro profile(ex)
end


# An internal function called to show the report after a `ctrl-z` profile "peek".
function profile_peek_report()
print(groupby = :thread)
end

# An internal function called to show the report after an information request (SIGINFO or SIGUSR1).
# This is a ref so that it can be overridden.
const profile_peek_report = Ref{Function}(() -> print(groupby = [:thread, :task]))
get_peek_duration() = ccall(:jl_get_profile_peek_duration, Float64, ())
set_peek_duration(t::Float64) = ccall(:jl_set_profile_peek_duration, Cvoid, (Float64,), t)

Expand Down

0 comments on commit 6a38e9c

Please sign in to comment.