crate::ix!();
#[derive(Setters,Getters,Debug)]
#[getset(get="pub",set="pub")]
pub struct PerformanceStats {
start_time: Instant,
end_time: Option<Instant>,
operators_executed: usize,
peak_memory_bytes: usize,
}
impl PerformanceStats {
pub fn start() -> Self {
Self {
start_time: Instant::now(),
end_time: None,
operators_executed: 0,
peak_memory_bytes: 0,
}
}
pub fn end(&mut self) {
self.end_time = Some(Instant::now());
}
pub fn total_duration(&self) -> Option<Duration> {
match self.end_time {
Some(t) => Some(t.duration_since(self.start_time)),
None => None,
}
}
}