Expand description
PerformanceView — Mean CPU usage label + frame-time sparkline.
Apps wire a SharedFrameHistory from their main loop into the
widget’s constructor, then push each completed frame’s wall time via
FrameHistory::push. The widget renders the rolling mean as
“Mean CPU usage: X.XX ms / frame” plus a sparkline graph below — same
presentation used in the agg-gui demo’s Backend panel and the egui
reference’s frame_history widget.
This is intentionally a minimal, self-contained widget (one Label child for glyph caching, one direct paint pass for the sparkline) so it drops into any container — a side panel, a popup window, a collapsing header — without extra plumbing.
Structs§
- Frame
History - Rolling buffer of recent frame times in milliseconds. Apps push from
the main loop; widgets read for display. Sized for ~1 second at
60 fps (matches the egui reference and the prior
demo_uicopy). - Performance
View - “Mean CPU usage” label stacked above a frame-time sparkline.
- RunMode
Desc - Dynamic label that mirrors the current run mode. Reactive — “Only running UI code when there are animations or input.” Continuous — “Running continuously as fast as possible. FPS: X.X”
- RunMode
Row - Reactive / Continuous segmented selector composed from two real
Buttonchildren that share anRc<Cell<RunMode>>. Used insidePerformanceViewwhensuper::PerformanceView::with_run_mode_selectoris wired; safe to use standalone for hosts that want the picker without the perf graph.
Enums§
- RunMode
- How the host’s event loop drives repaints.
Functions§
- paint_
sparkline - Paint a frame-time sparkline at
(x, y, w, h)in the activeDrawCtx’s coordinate space. Reads fromhistoryfor samples and draws an orange 16.7 ms (60 fps) reference line. Exposed in case a caller wants the graph without the surrounding label / padding. - shared_
frame_ history - Convenience: heap-allocate a fresh shared history. Equivalent to
Rc::new(RefCell::new(FrameHistory::new())). - shared_
run_ mode - Convenience: wrap a
RunModein theRc<Cell<…>>plumbing thatsuper::PerformanceView::with_run_mode_selectorexpects.
Type Aliases§
- Shared
Frame History - Shared handle to a
FrameHistory— passed to the widget at construction and to the platform shell so it can push samples.