probe 0.5.2

Static instrumentation probes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use probe::probe_lazy;

fn main() {
    let mut iter = 0;
    loop {
        iter += 1;
        probe_lazy!(foo, iter, {
            // This delay is an exaggeration of the overhead of a probe argument, but it's only
            // incurred while something is attached to the probe, thanks to the semaphore.
            std::thread::sleep(std::time::Duration::from_secs(1));
            iter
        });
    }
}

// bcc/tools/trace.py -p $(pidof semaphore) 'u::foo:iter "iter = %d", arg1'