INNER CODE UNIT · Rust

drop

jerthz/scion · external/profiling/src/lib.rs:25

    fn drop(&mut self) {
        if !PROFILING_ENABLED.load(Ordering::Relaxed) {
            return;
        }

        let elapsed = self.start.elapsed().as_nanos();

        // Store data instead of printing immediately
        if let Ok(mut data) = PROFILE_DATA.lock() {
            if data.is_none() {
                *data = Some(HashMap::new());
            }
            if let Some(map) = data.as_mut() {
                map.entry(self.name).or_insert_with(Vec::new).push(elapsed);
            }
        }
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…