INNER CODE UNIT · Rust

total

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

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

/// Enable/disable profiling at runtime
pub fn set_profiling_enabled(enabled: bool) {
    PROFILING_ENABLED.store(enabled, Ordering::Relaxed);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…