- I first used the tool
flamegraph
(which relies onperf
) to profile my Rust application. It works at first until it throw segmentation fault which seems to be a bug inperf
. - I then tried to profile my Rust application using
valgrind
. It sort of works but I found another issue with it. It seems thatvalgrind
dumps performance data of public methods only. Manually marking methods aspub
successfully makesvalgrind
dump performance data for them but there were a few exceptions. I wonder is there any special configuration ofrustc
orvalgrind
that I missed or is this a compatible issue ofvalgrind
with Rust. - Does anyone have good experiences with other (CPU) profiling tools for Rust?
Did you add debug info to your release build? [profile.release] debug = true
in Cargo.toml
. This should give you data for private methods too.
On macOS I use Xcode Instruments.app.
Yes, I do have debug = true
for the release profile. And I've tried the dev profile too. Both of them have the same issue. I'm using flamegraph and valgrind in Ubuntu 20.04 (via Docker).
Extra flag that might help with perf build RUSTFLAGS="-g -Cforce-frame-pointers=on"
I tend to run perf record
with -m 1M
I've used [cargo flamegraph] (https://crates.io/crates/flamegraph) successfully in the past. Maybe it will work better or more easily than the flamegraph you used?
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.