macro_rules! perf_scope {
($name:ident) => { ... };
}Expand description
Declares a named timer for the enclosing scope.
ⓘ
fn foo() {
perf_scope!(total);
do_something();
profile_log!(
target: "perf",
log::Level::Info,
"foo: {:?}",
total.elapsed(),
);
}Expands to nothing when the profile feature is disabled, so every use of
the declared binding must live inside a [macro@profile_log!] invocation
(or its own #[cfg(any(feature = "profile", debug_assertions))] gate).