1 use std::time::Instant;
3 pub struct ScopeTimer {
11 pub fn new(name: &'static str) -> Self {
12 ScopeTimer { start: Instant::now(), name }
16 #[cfg(debug_assertions)]
17 impl Drop for ScopeTimer {
19 println!("{} took {:?}", self.name, self.start.elapsed());
24 macro_rules! time_scope {
27 let _magical_scope_timer_ = ScopeTimer::new("scope");
31 let _magical_scope_timer_ = ScopeTimer::new($name);