Struct puffin::ThreadProfiler
source · [−]pub struct ThreadProfiler { /* private fields */ }
Expand description
Collects profiling data for one thread
Implementations
sourceimpl ThreadProfiler
impl ThreadProfiler
sourcepub fn initialize(
now_ns: fn() -> NanoSecond,
reporter: fn(_: ThreadInfo, _: &StreamInfoRef<'_>)
)
pub fn initialize(
now_ns: fn() -> NanoSecond,
reporter: fn(_: ThreadInfo, _: &StreamInfoRef<'_>)
)
Explicit initialize with custom callbacks.
If not called, each thread will use the default nanosecond source (now_ns()
)
and report scopes to the global profiler (global_reporter()
).
For instance, when compiling for WASM the default timing function (now_ns()
) won’t work,
so you’ll want to call puffin::ThreadProfiler::initialize(my_timing_function, puffin::global_reporter);
.
sourcepub fn begin_scope(&mut self, id: &str, location: &str, data: &str) -> usize
pub fn begin_scope(&mut self, id: &str, location: &str, data: &str) -> usize
Returns position where to write scope size once the scope is closed.
pub fn end_scope(&mut self, start_offset: usize)
sourcepub fn call<R>(f: impl Fn(&mut Self) -> R) -> R
pub fn call<R>(f: impl Fn(&mut Self) -> R) -> R
Do something with the thread local ThreadProfiler
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ThreadProfiler
impl Send for ThreadProfiler
impl Sync for ThreadProfiler
impl Unpin for ThreadProfiler
impl UnwindSafe for ThreadProfiler
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