Skip to content

Commit

Permalink
I also added this message to tell you about the new flags
Browse files Browse the repository at this point in the history
```
julia> PProf.Allocs.pprof()
β”Œ Info: πŸ‘‹  Welcome to PProf!
β”‚
β”‚ Consider trying `skip_jl_dispatch = true` as well, for a cleaner Graph view.
β”‚ The current options are best for the Flamegraph view.
β”‚
β”” Now outputting your profile...
Main binary filename not available.
Serving web UI on http://localhost:62261
"alloc-profile.pb.gz"
```
  • Loading branch information
NHDaly committed Jul 30, 2023
1 parent be83b31 commit 6bfc861
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Allocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function pprof(alloc_profile::Profile.Allocs.AllocResults = Profile.Allocs.fetch
skip_gc_internal::Bool = true,
frame_for_type::Bool = true,
)
PProf.log_greeting(skip_jl_dispatch)
period = UInt64(0x1)

@assert !isempty(basename(out)) "`out=` must specify a file path to write to. Got unexpected: '$out'"
Expand Down
19 changes: 19 additions & 0 deletions src/PProf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function pprof(data::Union{Nothing, Vector{UInt}} = nothing,
skip_jl_dispatch::Bool = false,
skip_gc_internal::Bool = false,
)
log_greeting(skip_jl_dispatch)
if data === nothing
data = if isdefined(Profile, :has_meta)
copy(Profile.fetch(include_meta = false))
Expand Down Expand Up @@ -299,6 +300,22 @@ function pprof(data::Union{Nothing, Vector{UInt}} = nothing,
out
end

log_once::Bool = false
function log_greeting(skip_jl_dispatch)
if !log_once
global log_once = true
if !skip_jl_dispatch
@info """πŸ‘‹ Welcome to PProf!
Consider trying `skip_jl_dispatch = true` as well, for a cleaner Graph view.
The current options are best for the Flamegraph view.
Now outputting your profile...
"""
end
end
end

function _escape_name_for_pprof(name)
# HACK: Apparently proto doesn't escape func names with `"` in them ... >.<
# TODO: Remove this hack after https://github.com/google/pprof/pull/564
Expand Down Expand Up @@ -384,6 +401,8 @@ function refresh(; webhost::AbstractString = "localhost",
proc[] = pprof_jll.pprof() do pprof_path
open(pipeline(`$pprof_path -http=$webhost:$webport $relative_percentages_flag $file`))
end

sleep(1) # Wait for the server to start. This is usually long enough.
end

"""
Expand Down

0 comments on commit 6bfc861

Please sign in to comment.