Allow profiles to set -Cforce-frame-pointers #15333
Labels
A-profiles
Area: profiles
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-team-input
Status: Needs input from team on whether/how to proceed.
Problem
When profiling Rust code on Linux using
perf
, I can either useperf record
with--call-graph=dwarf
or I can enable frame pointers during the build by passing-Cforce-frame-pointers
to rustc. With frame pointers, a perf run is substantially faster to process. My understanding is that this is because stack traces can be captured in the kernel with eBPF, which can follow the frame pointers, whereas with debug info it's all done by callingaddr2line
after the fact.For a profiling run I just did, it took more than 8 minutes to process the perf data when using debug info and less than a second when using frame pointers.
I'd like to be able to turn on frame pointers for a particular profile in my
Cargo.toml
. Currently, I instead turn it on globally in my~/.cargo/config.toml
.Proposed Solution
Add
force-frame-pointers
as an option in cargo profiles. e.g.Notes
If it's agreed that this is a reasonable feature to add, I'm happy to implement it.
The text was updated successfully, but these errors were encountered: