-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Allow profiles to set -Cforce-frame-pointers #15333
Copy link
Copy link
Labels
A-profilesArea: profilesArea: profilesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Metadata
Metadata
Assignees
Labels
A-profilesArea: profilesArea: profilesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
When profiling Rust code on Linux using
perf, I can either useperf recordwith--call-graph=dwarfor I can enable frame pointers during the build by passing-Cforce-frame-pointersto 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 callingaddr2lineafter 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-pointersas 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.