extern crate pyroscope;
use std::sync::mpsc::channel;
use std::sync::mpsc::{Receiver, Sender};
use pyroscope::timer::Timer;
fn main() {
let mut timer = Timer::default().initialize();
let (tx, rx): (Sender<u64>, Receiver<u64>) = channel();
let (tx2, rx2): (Sender<u64>, Receiver<u64>) = channel();
timer.attach_listener(tx).unwrap();
timer.attach_listener(tx2).unwrap();
std::thread::spawn(move || {
while let Ok(time) = rx.recv() {
println!("Thread 1 Notification: {}", time);
}
});
std::thread::spawn(move || {
while let Ok(time) = rx2.recv() {
println!("Thread 2 Notification: {}", time);
}
})
.join()
.unwrap();
}