Skip to main content

with_scope

Function with_scope 

Source
pub fn with_scope<F, R>(f: F) -> (R, PerfSnapshot)
where F: FnOnce() -> R,
Expand description

Scoped profiling: enable counters if they aren’t already, reset them, run f, and return (result, delta_snapshot).

The counters are left enabled after this returns — callers that want strict zero-overhead production eval should set_enabled(false) afterwards.