nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Debug

Description

Debug readout sampling shared by the backends: frame timing and skip counts, RTS statistics, draw counts, and the rows the debug windows show.

Synopsis

Documentation

isDebugActive :: DebugSamplerRef -> IO Bool Source #

Debug HUD cadence is driven by actual snapshot consumption: a snapshot query (refreshDebugSnapshot) refreshes smLastQueryT, so the 4 Hz refresh loop only runs while a stats window is being built. An open window alone does not count as activity, or the event loop would wake every refresh period while any floating window is open.

debugRefreshDue :: DebugSamplerRef -> IO Bool Source #

Whether the published snapshot is older than debugRefreshSec.

refreshDebugSnapshot :: DebugSamplerRef -> IORef s -> (CoreDebugSnapshot -> IO s) -> IO s Source #

The published snapshot, rebuilt at most every debugRefreshSec and cached in between. A due query samples the core stats and hands them to build, which adds the backend's fields: window size and mouse position are left 0 for it to fill. Every query marks the readout active (isDebugActive).