pub struct FrameProfile {
pub render: RenderStats,
/* private fields */
}Expand description
Timing collected for one frame and read back by the profiler overlay.
The system timings are double-buffered: a frame accumulates into
current, and begin_frame rotates the just-finished frame into last
so a reader always sees a complete frame rather than a partial one.
Fields§
§render: RenderStatsRender-backend stats for the most recent drawn frame. Left at the default when no graphics backend is running.
Implementations§
Source§impl FrameProfile
impl FrameProfile
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Rotate the system-timing buffers at the start of a frame: the frame that just finished becomes the readable snapshot and the accumulator is cleared for the new frame.
Sourcepub fn record_system(&mut self, name: &'static str, micros: u32)
pub fn record_system(&mut self, name: &'static str, micros: u32)
Record one system’s CPU step time for the in-progress frame.
Sourcepub fn record_system_allocs(&mut self, name: &'static str, allocs: u32)
pub fn record_system_allocs(&mut self, name: &'static str, allocs: u32)
Record the heap allocations counted during one system’s step.
Sourcepub fn set_frame_allocs(&mut self, allocs: u32)
pub fn set_frame_allocs(&mut self, allocs: u32)
Record the heap allocations counted across the frame that just finished. Written at the end of a step rather than rotated: the value is complete the moment the frame is, so readers between steps see the latest frame.
Sourcepub fn system_timings(&self) -> &[(&'static str, u32)]
pub fn system_timings(&self) -> &[(&'static str, u32)]
System step times from the last fully completed frame, in step order.
Read by the runtime debug server’s profile command (a binary-only
module), so the lib build sees no caller.
Sourcepub fn system_allocs(&self) -> &[(&'static str, u32)]
pub fn system_allocs(&self) -> &[(&'static str, u32)]
Per-system heap-allocation counts from the last fully completed frame, in step order. Empty unless the frame loop sampled them (dev builds with the tracking allocator installed).
Sourcepub fn frame_allocs(&self) -> Option<u32>
pub fn frame_allocs(&self) -> Option<u32>
Heap allocations counted across the most recent frame, under the same
conditions as system_allocs.