Skip to main content

use_profiler

Function use_profiler 

Source
pub fn use_profiler() -> ProfilerHandle
Expand description

Obtains a ProfilerHandle registered against the current hook context slot.

Behaves like HookContext::use_hook: the same ProfilerHandle is returned on every render at the same hook index, so measurements pushed onto its entries signal remain visible across renders.

Use ProfilerHandle::measure for a single-shot “label + closure” form or ProfilerHandle::begin / [ProfilerHandle::end] for the split-timer form. Reads of ProfilerHandle::entries inside a render closure subscribe the render to new entries.

§Returns

  • ProfilerHandle - The profiler handle. Returns the factory result directly when no hook context is active (e.g. when called outside a render cycle).