Skip to main content

begin_deep_profiling

Function begin_deep_profiling 

Source
pub fn begin_deep_profiling() -> Option<DeepProfilingGuard>
Expand description

Ask for samples, for as long as the returned guard is held.

None means the profile does not permit sampling. That check lives here rather than at each call site, so a consumer cannot start collection by forgetting it.

The guard is the whole reason this is not a bare start()/stop() pair: an early return, a ?, or a panic on the way out of a profiling request would otherwise leave the collectors running for the life of the process, which is the failure this function exists to prevent.