Skip to content

Add flamegraph feature #23

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

Merged
merged 1 commit into from
Mar 3, 2025
Merged

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Feb 22, 2025

This patch adds a flamegraph feature, which can generate interactive flamegraph SVGs using the inferno crate.

It adds a new method dump_flamegraph(), as well as dump_flamegraph_with_options() which takes a FlamegraphOptions (a re-export of inferno::flamegraph::Options). This works similarly to the pprof-rs CPU profiler.

It implies the symbolize feature from #22 which enables online profile symbolization.

Example flamegraph: profile.svg.gz (download and open since GitHub breaks the interactive SVG)

@erikgrinaker erikgrinaker force-pushed the flamegraph branch 2 times, most recently from 70c5788 to 277713f Compare February 22, 2025 12:29
@umanwizard umanwizard merged commit 3203343 into polarsignals:main Mar 3, 2025
2 checks passed
@erikgrinaker
Copy link
Contributor Author

TFTR! Would you mind cutting a new release sometime soon?

@umanwizard
Copy link
Collaborator

Just published v0.7.0.

BTW, we have a channel #rust-jemalloc-pprof on the Polar Signals discord server (https://discord.gg/knw3u5X9bs). It would be good to join if you plan to make more contributions or have any questions/issues that you want to discuss.

@erikgrinaker
Copy link
Contributor Author

Thanks!

I don't have any further changes planned right now, but I'll stop by the Discord when I do.

github-merge-queue bot pushed a commit to neondatabase/neon that referenced this pull request Mar 4, 2025
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants