cargo: build with frame pointers #10226
Closed
+11
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Frame pointers are typically disabled by default (depending on CPU architecture), to improve performance. This frees up a CPU register, and avoids a couple of instructions per function call -- but this often doesn't matter on modern CPU architectures, and benchmarks did not show measurable overhead. However, it makes stack unwinding much more inefficient, since it has to use DWARF debug information instead, and gives worse results with e.g.
perf
and eBPF profiles. With continuous profiling, cheaper stack unwinding will likely be a net win, and allow us to use higher sampling resolution.The Rust standard library and jemalloc already enable frame pointers by default.
For more information, see https://www.brendangregg.com/blog/2024-03-17/the-return-of-the-frame-pointers.html.
Resolves #10224.
Summary of changes
Enable frame pointers in all builds, and use frame pointers for pprof-rs stack sampling.