pub struct TracySpan { /* private fields */ }Expand description
A profiling span that records the duration of a code region.
When Tracy is not available, this is a zero-cost no-op backed by
std::time::Instant. Call TracySpan::begin to start timing a region
and TracySpan::end to record the elapsed duration into the thread-local
ring buffer. For scoped (RAII) spans, prefer the span function which
returns a TracySpanGuard.
§Examples
use martensite_devtools::tracy::TracySpan;
let span = TracySpan::begin("encode_paint_list");
// ... work ...
span.end();Implementations§
Source§impl TracySpan
impl TracySpan
Sourcepub fn begin(name: &'static str) -> Self
pub fn begin(name: &'static str) -> Self
Begin a new profiling span with the given static name.
The start time is captured immediately via Instant::now.
§Examples
use martensite_devtools::tracy::TracySpan;
let span = TracySpan::begin("layout_pass");
span.end();Sourcepub fn end(&self)
pub fn end(&self)
Record the elapsed duration of this span into the thread-local ring buffer.
Calling end more than once is a no-op: subsequent calls find no start
time and record nothing.
§Examples
use martensite_devtools::tracy::TracySpan;
let span = TracySpan::begin("paint_pass");
span.end();
// A second end is a no-op.
span.end();Auto Trait Implementations§
impl !Freeze for TracySpan
impl !RefUnwindSafe for TracySpan
impl !Sync for TracySpan
impl Send for TracySpan
impl Unpin for TracySpan
impl UnsafeUnpin for TracySpan
impl UnwindSafe for TracySpan
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