Struct puffin::GlobalProfiler
source · [−]pub struct GlobalProfiler { /* private fields */ }
Expand description
Singleton. Collects profiling data from multiple threads
and passes them on to different FrameSink
s.
Implementations
sourceimpl GlobalProfiler
impl GlobalProfiler
sourcepub fn lock() -> MutexGuard<'static, Self>
pub fn lock() -> MutexGuard<'static, Self>
Access to the global profiler singleton.
sourcepub fn new_frame(&mut self)
pub fn new_frame(&mut self)
You need to call this once at the start of every frame.
It is fine to call this from within a profile scope.
sourcepub fn report(&mut self, info: ThreadInfo, stream_info: &StreamInfoRef<'_>)
pub fn report(&mut self, info: ThreadInfo, stream_info: &StreamInfoRef<'_>)
Report some profiling data. Called from ThreadProfiler
.
sourcepub fn add_sink(&mut self, sink: FrameSink) -> FrameSinkId
pub fn add_sink(&mut self, sink: FrameSink) -> FrameSinkId
Tells GlobalProfiler
to call this function with each new finished frame.
The returned FrameSinkId
can be used to remove the sink with Self::remove_sink()
.
pub fn remove_sink(&mut self, id: FrameSinkId) -> Option<FrameSink>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for GlobalProfiler
impl Send for GlobalProfiler
impl !Sync for GlobalProfiler
impl Unpin for GlobalProfiler
impl !UnwindSafe for GlobalProfiler
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more