use std::thread;
use std::time::Duration;
use pmc::*;
fn main() {
let mut counter = CounterBuilder::default()
.attach_to(vec![0])
.allocate("inst_retired.any")
.expect("failed to allocate PMC");
let handle = counter.start().expect("failed to start counter");
for i in 1..10 {
println!("iteration {}: {}", i, handle);
thread::sleep(Duration::from_millis(100));
}
handle.stop();
println!("retired instructions: {}", counter.read().unwrap());
}