Skip to main content

ad_hoc_event

Function ad_hoc_event 

Source
pub fn ad_hoc_event(weight: usize)
Available on crate feature dhat-compat only.
Expand description

Record one ad-hoc event with the given weight.

Two atomic operations per call; no allocation. Safe to call from any context, including transitively from inside the allocator hook.

ยงExample

use mod_alloc::dhat_compat::ad_hoc_event;

ad_hoc_event(1);     // one unit of work
ad_hoc_event(1024);  // a chunk of work