Skip to main content

Module hud

Module hud 

Source
Expand description

In-app diagnostic HUD overlay.

Activating F12 toggles a zero-allocation diagnostic overlay that displays:

  • A rolling 120-frame timing histogram (layout, paint, GPU wait).
  • Real-time dirty rect visualization.
  • Live WidgetArena slot utilization and compaction telemetry.

When the render feature is enabled, DiagnosticHud::render_hud encodes the overlay into a martensite_render::PaintList using simple fill, stroke, and text commands.

§Example

use martensite_devtools::hud::{DiagnosticHud, FrameTiming, Rect};

let mut hud = DiagnosticHud::new();
hud.toggle();
assert!(hud.is_enabled());

hud.record_frame(FrameTiming {
    layout_time_ns: 500_000,
    paint_time_ns: 300_000,
    gpu_wait_time_ns: 100_000,
    total_time_ns: 900_000,
});

hud.add_dirty_rect(Rect::new(0, 0, 100, 100));

Structs§

ArenaTelemetry
Arena memory telemetry data.
DiagnosticHud
The diagnostic HUD state.
DirtyRectTracker
Dirty rectangle tracking for visualization.
FrameHistogram
Rolling 120-frame timing histogram.
FrameTiming
Frame timing data for a single frame.
Rect
A rectangle for dirty rect tracking.