Crate partial_callgrind
source ·Expand description
Easy to use client requests to start/stop callgrind at specific location of your code for precise profiling (100% Rust).
For now only x86_64 is supported.
Examples
Skip Vec
initialization code and profile only sort.
Compile in release mode and then use valgrind --tool=callgrind --collect-atstart=no --instr-atstart=no {exec}
.
use partial_callgrind::{start, stop};
use rand::Rng;
fn main() {
let mut rng = rand::thread_rng();
let mut data: Vec<u8> = (0..10_000).into_iter().map(|_| rng.gen::<u8>()).collect();
start();
data.sort();
stop();
}
Functions
- Start instrumentation and toggle collection state. With
--collect-atstart=no
option, callgrind’s collection state is disabled at the beginning. - Toggle collection state and stop instrumentation.