INNER CODE UNIT · Rust
new
jerthz/scion · external/profiling/src/lib.rs:15
pub fn new(name: &'static str) -> Self {
Self {
name,
start: std::time::Instant::now(),
}
}
}
impl Drop for ProfileGuard {
#[inline(always)]
fn drop(&mut self) {
if !PROFILING_ENABLED.load(Ordering::Relaxed) {
return;
}
let elapsed = self.start.elapsed().as_nanos();
// Store data instead of printing immediately