pub struct FrameLog { /* private fields */ }Expand description
The latest frames an app drew. Recording one is a push into a fixed buffer, so it can stay on while nobody is looking.
use std::time::Duration;
use ravenrs_core::{FrameLog, FrameSample};
let mut log = FrameLog::default();
log.record(FrameSample { update: Duration::from_millis(4), ..Default::default() });
assert_eq!(log.summary().total.median, Duration::from_millis(4));Implementations§
Source§impl FrameLog
impl FrameLog
Sourcepub fn record(&mut self, sample: FrameSample)
pub fn record(&mut self, sample: FrameSample)
Adds a frame, forgetting the oldest once the log is full.
Sourcepub fn measure(&self, seconds: f64) -> PerformanceResult
pub fn measure(&self, seconds: f64) -> PerformanceResult
Judges the frames recorded since the log was cleared, seconds ago.
Sourcepub fn samples(&self) -> impl Iterator<Item = &FrameSample>
pub fn samples(&self) -> impl Iterator<Item = &FrameSample>
The frames in the log, oldest first.
Sourcepub fn trace_json(&self) -> String
pub fn trace_json(&self) -> String
The frames in the log in the Trace Event format, which Perfetto
(https://ui.perfetto.dev) and chrome://tracing open.
Sourcepub fn summary(&self) -> FrameSummary
pub fn summary(&self) -> FrameSummary
The frames in the log, summed up.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FrameLog
impl RefUnwindSafe for FrameLog
impl Send for FrameLog
impl Sync for FrameLog
impl Unpin for FrameLog
impl UnsafeUnpin for FrameLog
impl UnwindSafe for FrameLog
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