Skip to main content

env_threshold_ms

Macro env_threshold_ms 

Source
macro_rules! env_threshold_ms {
    ($name:expr) => { ... };
}
Expand description

Reads a millisecond-threshold environment variable once and caches it.

Expands to an Option<f64>: None when the variable is unset or does not parse, Some(threshold) otherwise. A threshold of 0 is preserved rather than treated as absent, so 0 means “report every frame” — the setting used to capture a full trace.

if let Some(threshold) = env_threshold_ms!("CRANPOSE_FRAME_STAGE_TELEMETRY_MS") {
    if elapsed_ms >= threshold {
        log::info!("[frame-stage] {elapsed_ms:.2}ms");
    }
}