INNER CODE UNIT · Rust

Ok

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

        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);
            }
        }
    }
}

/// Print accumulated profiling data
pub fn print_profile_stats() {
    if let Ok(mut data) = PROFILE_DATA.lock() {
        if let Some(map) = data.take() {
            for (name, times) in map.iter() {
                let count = times.len();
                let total: u128 = times.iter().sum();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…