INNER CODE UNIT · Rust

print_profile_stats

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

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();
                let avg = total / count as u128;
                let min = times.iter().min().unwrap();
                let max = times.iter().max().unwrap();

                eprintln!(
                    "[profile] {} | calls: {} | avg: {}ns | min: {}ns | max: {}ns | total: {}µs",
                    name, count, avg, min, max, total / 1000
                );
            }
        }
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…