Skip to main content

martensite_devtools/
lib.rs

1//! Telemetry and in-app F12 developer HUD.
2//!
3//! This crate provides two subsystems for the v0.9.0 Developer Experience
4//! milestone:
5//!
6//! - [`tracy`]: Safe, allocation-free profiling span instrumentation that
7//!   records region durations into a thread-local ring buffer. The
8//!   DevTools overhead gate requires `< 0.1ms` per 60fps frame.
9//! - [`hud`]: In-app diagnostic HUD with a rolling 120-frame timing
10//!   histogram, dirty rect visualization, and WidgetArena slot
11//!   utilization telemetry.
12//!
13//! # Example
14//!
15//! ```
16//! use martensite_devtools::{tracy, hud::DiagnosticHud};
17//!
18//! // Profile a layout pass.
19//! let _guard = tracy::span("layout_pass");
20//!
21//! // Record frame timing for the HUD.
22//! let mut hud = DiagnosticHud::new();
23//! hud.record_frame(martensite_devtools::hud::FrameTiming {
24//!     layout_time_ns: 500_000,
25//!     paint_time_ns: 300_000,
26//!     gpu_wait_time_ns: 100_000,
27//!     total_time_ns: 900_000,
28//! });
29//! ```
30
31#![forbid(unsafe_code)]
32#![deny(missing_docs)]
33
34pub mod hud;
35pub mod tracy;
36
37#[cfg(test)]
38mod tests {
39    /// Smoke test verifying the crate compiles with `#![forbid(unsafe_code)]`.
40    #[test]
41    fn crate_compiles() {
42        // Compilation + test execution is the smoke test.
43    }
44}