Build your Rust binary with debug symbols and use perf record and perf report to analyze CPU usage and find performance bottlenecks.
Build your Rust binary with debug symbols and run perf to record CPU samples, then generate a report to identify hotspots.
cargo build --release
perf record -g ./target/release/your_binary_name
perf report
This workflow captures a call graph of your application's execution, allowing you to see exactly which functions consume the most CPU time.
Profiling is like using a speed camera to find which parts of your code are running too slowly. You build your program normally, run it while a tool records what the computer is doing, and then look at a report to see where the time is being spent. This helps you fix performance bottlenecks without guessing.