Struct puffin::ThreadProfiler [−][src]
pub struct ThreadProfiler { /* fields omitted */ }
Expand description
Collects profiling data for one thread
Implementations
pub 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);
.
Returns position where to write scope size once the scope is closed.
Do something with the thread local ThreadProfiler