INNER CODE UNIT · Rust
Some
jerthz/scion · external/profiling/src/lib.rs:37
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();
let avg = total / count as u128;
let min = times.iter().min().unwrap();
let max = times.iter().max().unwrap();