pub struct FrameTimer { /* private fields */ }Expand description
Frame time tracker that measures per-frame GPU durations.
Implementations§
Source§impl FrameTimer
impl FrameTimer
Sourcepub fn new(max_history: usize) -> Self
pub fn new(max_history: usize) -> Self
Create a new frame timer with the given history capacity.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Mark the start of a frame.
Sourcepub fn end_frame(&mut self) -> Option<Duration>
pub fn end_frame(&mut self) -> Option<Duration>
Mark the end of a frame, recording the duration.
Sourcepub fn last_frame_time(&self) -> Option<Duration>
pub fn last_frame_time(&self) -> Option<Duration>
Return the latest frame duration.
Sourcepub fn average_frame_time(&self) -> Option<Duration>
pub fn average_frame_time(&self) -> Option<Duration>
Return the average frame time over the history window.
Sourcepub fn current_fps(&self) -> Option<f64>
pub fn current_fps(&self) -> Option<f64>
Return the current FPS based on average frame time.
Sourcepub fn total_frames(&self) -> u64
pub fn total_frames(&self) -> u64
Return the total number of frames measured.
Sourcepub fn stats(&self) -> Option<TimingStats>
pub fn stats(&self) -> Option<TimingStats>
Return statistics over the history window.
Sourcepub fn history_len(&self) -> usize
pub fn history_len(&self) -> usize
Return the number of samples in the history.
Trait Implementations§
Source§impl Clone for FrameTimer
impl Clone for FrameTimer
Source§fn clone(&self) -> FrameTimer
fn clone(&self) -> FrameTimer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FrameTimer
impl RefUnwindSafe for FrameTimer
impl Send for FrameTimer
impl Sync for FrameTimer
impl Unpin for FrameTimer
impl UnsafeUnpin for FrameTimer
impl UnwindSafe for FrameTimer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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