From 6bfc8610db718cd80dc81f9060a42972cce6377e Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Sat, 29 Jul 2023 23:04:44 -0400 Subject: [PATCH] I also added this message to tell you about the new flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` 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" ``` --- src/Allocs.jl | 1 + src/PProf.jl | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Allocs.jl b/src/Allocs.jl index b93f53b..8b0add7 100644 --- a/src/Allocs.jl +++ b/src/Allocs.jl @@ -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'" diff --git a/src/PProf.jl b/src/PProf.jl index 5dac743..9a54750 100644 --- a/src/PProf.jl +++ b/src/PProf.jl @@ -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)) @@ -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 @@ -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 """