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§
source§impl 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.
This takes all completed profiling scopes from all threads, and sends it to the sinks.
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§
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