pub struct GpuTimer { /* private fields */ }Expand description
High-level GPU timer that manages multiple named timing regions.
Implementations§
Source§impl GpuTimer
impl GpuTimer
Sourcepub fn with_config(config: GpuTimerConfig) -> Self
pub fn with_config(config: GpuTimerConfig) -> Self
Create a new GPU timer with the given configuration.
Sourcepub fn begin_region(&mut self, label: &str) -> usize
pub fn begin_region(&mut self, label: &str) -> usize
Begin a named timing region. Returns the index for stopping it later.
Sourcepub fn end_region(&mut self, index: usize) -> Option<Duration>
pub fn end_region(&mut self, index: usize) -> Option<Duration>
End a timing region by index, recording the sample.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Begin a new frame for the frame timer.
Sourcepub fn stats_for_label(&self, label: &str) -> Option<TimingStats>
pub fn stats_for_label(&self, label: &str) -> Option<TimingStats>
Get timing statistics for a specific label.
Sourcepub fn frame_stats(&self) -> Option<TimingStats>
pub fn frame_stats(&self) -> Option<TimingStats>
Get the frame timer statistics.
Sourcepub fn current_fps(&self) -> Option<f64>
pub fn current_fps(&self) -> Option<f64>
Get the current FPS.
Sourcepub fn is_over_budget(&self) -> bool
pub fn is_over_budget(&self) -> bool
Check if the average frame time exceeds the target.
Sourcepub fn sample_count(&self) -> usize
pub fn sample_count(&self) -> usize
Return the total number of samples recorded.
Sourcepub fn current_frame_number(&self) -> u64
pub fn current_frame_number(&self) -> u64
Return the current frame number.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if timing collection is enabled.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable timing collection.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuTimer
impl RefUnwindSafe for GpuTimer
impl Send for GpuTimer
impl Sync for GpuTimer
impl Unpin for GpuTimer
impl UnsafeUnpin for GpuTimer
impl UnwindSafe for GpuTimer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more