pub struct Profile(/* private fields */);Expand description
Clones share one local collector. Construct a separate Profile per app or experiment. Clock must be lightweight/monotonic and must not reenter UI or graph work. The collector never calls it while borrowing its own samples. Attaching None disables instrumentation and all clock reads at call sites.
Implementations§
Source§impl Profile
impl Profile
pub fn new(clock: impl Fn() -> Duration + 'static) -> Self
pub fn native() -> Self
pub fn snapshot(&self) -> Snapshot
Sourcepub fn reset(&self) -> bool
pub fn reset(&self) -> bool
Reset counters and retire all in-flight spans. Refuse epoch exhaustion rather than charging an ancient span to a new measurement interval.
pub fn span(&self, phase: Phase) -> Span
Sourcepub fn recording(&self) -> Recording
pub fn recording(&self) -> Recording
Capture this interval without reading its clock. Native engines may measure on worker threads with their own monotonic clock and import fixed aggregates on the UI thread after joining that work. Reset retires these recordings just like spans; the collector remains local.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Profile
impl !Send for Profile
impl !Sync for Profile
impl !UnwindSafe for Profile
impl Freeze for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more