This commit is contained in:
Aleksey Kladov 2020-07-30 10:43:47 +02:00
parent 5e498546e8
commit f22af66c37

View File

@ -1,3 +1,4 @@
//! Like `std::time::Instant`, but also measures memory & CPU cycles.
use std::{
fmt,
time::{Duration, Instant},
@ -76,14 +77,3 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
// Unclear if we need this:
// https://github.com/jimblandy/perf-event/issues/8
impl Drop for StopWatch {
fn drop(&mut self) {
#[cfg(target_os = "linux")]
if let Some(mut counter) = self.counter.take() {
let _ = counter.disable();
}
}
}