INNER CODE UNIT · Rust
avg
jerthz/scion · external/profiling/src/lib.rs:51
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
);
}
}
}
}
/// Enable/disable profiling at runtime
pub fn set_profiling_enabled(enabled: bool) {
PROFILING_ENABLED.store(enabled, Ordering::Relaxed);
}