-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add symbolize
feature for online symbolization
#22
Conversation
3e91fa8
to
f825061
Compare
This patch adds a `symbolize` feature which performs online symbolization of profiles using the `backtrace` crate. This is often much more convenient than having to manually obtain binaries and symbolize the profiles, and matches the behavior of e.g. the `pprof-rs` CPU profiler. It will also allow emitting e.g. flamegraph SVGs directly, which I'll submit in a follow-up PR. Online symbolization uses a fair amount of memory for symbol caches, but this is often a worthwhile tradeoff.
f825061
to
0b146a1
Compare
Hi @umanwizard, just a friendly ping in case y'all missed this. |
Thanks and sorry for the delay. Did you test with stack traces that have inlined functions? Did it work correctly / can you provide an example .pprof ? |
No worries.
No, I haven't tested it. I think it should mostly just work as long as there's sufficient debug info ( I'll have a look over the weekend and get back to you. |
Confirming that inlined functions work as expected, using: #[inline(never)]
fn allocate(size: usize) -> Vec<u8> {
allocate_inline(size)
}
#[inline(always)]
fn allocate_inline(size: usize) -> Vec<u8> {
println!("allocating {size}b");
vec![9; size]
} Which yields profile.pb.gz: ![]() |
## Problem The code to generate symbolized pprof heap profiles and flamegraph SVGs has been upstreamed to the `jemalloc_pprof` crate: * polarsignals/rust-jemalloc-pprof#22 * polarsignals/rust-jemalloc-pprof#23 ## Summary of changes Use `jemalloc_pprof` to generate symbolized pprof heap profiles and flamegraph SVGs. This reintroduces a bunch of internal jemalloc stack frames that we'd previously strip, e.g. each stack now always ends with `prof_backtrace_impl` (where jemalloc takes a stack trace for heap profiling), but that seems ok.
This patch adds a
symbolize
feature which performs online symbolization of profiles using thebacktrace
crate.This is often much more convenient than having to manually obtain binaries and symbolize the profiles, and matches the behavior of e.g. the
pprof-rs
CPU profiler. It will also allow emitting e.g. flamegraph SVGs directly, which I'll submit in a follow-up PR.Online symbolization uses a fair amount of memory for symbol caches, but this is often a worthwhile tradeoff.