A Better Rust Profiler
I want a better profiler for Rust. Here’s what a rust-analyzer benchmark looks like:
Here’s how I want to profile it:
First, the profiler prints to stderr:
Otherwise, if everything is setup correctly, the output is
profile-results folder contains the following:
- user, cpu, sys time
- cpu instructions
stats for caches & branches a-la
- top ten functions by cumulative time
- top ten functions by self-time
- top ten hot-spot
data.smth, which can be fed into some existing profiler UI (kcachegrind, firefox profiler, etc).
report.htmlwhich contains a basic interactive UI.
To tweak settings, the following API is available:
Naturally, the following also works and produces an aggregate profile:
I don’t know how this should work. I think I would be happy with a perf-based Linux-only implementation. The perf-event crate by Jim Blandy (co-author of “Programming Rust”) is good.
Have I missed something? Does this tool already exist? Or is it impossible for some reason?
Discussion on /r/rust.