summaryrefslogtreecommitdiffstats
path: root/vendor/perf-event/examples/println.rs
blob: 8760e3dcdb876dfed3c07bb8775e4dbd769d338f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use perf_event::Builder;

fn main() -> std::io::Result<()> {
    let mut counter = Builder::new().build()?;

    let vec = (0..=51).collect::<Vec<_>>();

    counter.enable()?;
    println!("{:?}", vec);
    counter.disable()?;

    println!("{} instructions retired", counter.read()?);

    Ok(())
}