pub struct Guard { /* private fields */ }Expand description
RAII timing guard. Records elapsed time on drop.
16 bytes: fits in two registers on both x86_64 (rax+rdx) and aarch64 (x0+x1), eliminating all memory stores from the measurement window.
Uses a raw hardware counter (rdtsc / cntvct_el0) instead of
Instant::now() to minimize clock-read cost. The tsc-to-nanosecond
conversion happens in drop_cold, outside the measurement window.
Implementations§
Source§impl Guard
impl Guard
Sourcepub fn check(&self)
pub fn check(&self)
Check for thread migration after an .await point.
If the Guard has migrated to a different thread, pushes a phantom StackEntry onto the new thread’s stack so that children can update it via the normal parent fast path. Also registers the Guard as migrated so the original thread can clean up the orphaned entry.
No-op if still on the same thread. Idempotent: safe to call multiple times (skips if phantom already exists on current stack).