use std::time::SystemTime;
pub struct Profiler {
time: SystemTime,
}
impl Profiler {
pub fn new() -> Self {
Self {
time: SystemTime::now(),
}
}
pub fn time(&mut self, title: &str) {
let now = SystemTime::now();
let elapsed = now.duration_since(self.time).unwrap();
println!("{title}: {elapsed:?}");
self.time = now;
}
}