macro_rules! pause_stack {
() => { ... };
}
Expand description
Pause only the timers currently on the call stack
Unlike pause!()
which pauses all profiling globally, pause_stack!()
only affects timers that are currently active (created but not yet dropped).
New timers created after this call will still be recorded normally.
This is useful when you want to exclude specific nested operations from profiling without affecting other concurrent operations.
ยงExample
use quantum_pulse::{profile, pause_stack, unpause_stack, Operation};
use std::fmt::Debug;
#[derive(Debug)]
enum AppOperation {
OuterWork,
InnerWork,
}
impl Operation for AppOperation {}
profile!(AppOperation::OuterWork, {
do_outer_work();
// Pause only the OuterWork timer
pause_stack!();
// This work won't be included in OuterWork's time
do_excluded_work();
// But this new timer will still be recorded
profile!(AppOperation::InnerWork, {
do_inner_work();
});
// Resume the OuterWork timer
unpause_stack!();
do_outer_work();
});