| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
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
- debugRefreshSec :: Double
- blend :: Double -> Double -> Double
- data RtsStatsSnapshot = RtsStatsSnapshot {
- rtsEnabled :: !Bool
- rtsGcs :: !Word32
- rtsMajorGcs :: !Word32
- rtsAllocMb :: !Double
- rtsLiveMb :: !Double
- rtsMaxMemMb :: !Double
- rtsCopiedMb :: !Double
- rtsGcPct :: !Double
- rtsLastGcGen :: !Word32
- rtsLastGcMs :: !Double
- rtsCaps :: !Int
- rtsCpus :: !Int
- readRtsSnapshot :: IO RtsStatsSnapshot
- data CoreDebugSnapshot = CoreDebugSnapshot {
- dbgPresentFps :: !Double
- dbgLoopFps :: !Double
- dbgFrameMs :: !Double
- dbgUiMs :: !Double
- dbgRenderMs :: !Double
- dbgPresentMs :: !Double
- dbgPresents :: !Word64
- dbgSkips :: !Word64
- dbgVerts :: !Int
- dbgIndices :: !Int
- dbgCmds :: !Int
- dbgWinW :: !Float
- dbgWinH :: !Float
- dbgMouseX :: !Float
- dbgMouseY :: !Float
- dbgRts :: !RtsStatsSnapshot
- emptyCoreDebugSnapshot :: CoreDebugSnapshot
- data DebugSampler = DebugSampler {
- smPresentEma :: !Double
- smLoopEma :: !Double
- smLastPresentT :: !Double
- smLastDebugT :: !Double
- smLastQueryT :: !Double
- smPresents :: !Word64
- smSkips :: !Word64
- smUiMs :: !Double
- smRenderMs :: !Double
- smPresentMs :: !Double
- smFrameMs :: !Double
- smVerts :: !Int
- smIndices :: !Int
- smCmds :: !Int
- smRatePresents :: !Word64
- smRateT :: !Double
- type DebugSamplerRef = IORef DebugSampler
- newDebugSampler :: IO DebugSamplerRef
- noteDebugLoop :: DebugSamplerRef -> Float -> IO ()
- noteDebugSkip :: DebugSamplerRef -> IO ()
- isDebugActive :: DebugSamplerRef -> IO Bool
- debugRefreshDue :: DebugSamplerRef -> IO Bool
- noteDebugPresent :: DebugSamplerRef -> Double -> Double -> Double -> Double -> Int -> Int -> Int -> IO ()
- refreshDebugSnapshot :: DebugSamplerRef -> IORef s -> (CoreDebugSnapshot -> IO s) -> IO s
- formatFpsRows :: CoreDebugSnapshot -> [(Text, Text)]
- formatDrawRows :: CoreDebugSnapshot -> [(Text, Text)]
- formatCoreRtsRows :: CoreDebugSnapshot -> [(Text, Text)]
Documentation
data RtsStatsSnapshot Source #
Constructors
| RtsStatsSnapshot | |
Fields
| |
Instances
| Eq RtsStatsSnapshot Source # | |
Defined in NanoUI.Debug Methods (==) :: RtsStatsSnapshot -> RtsStatsSnapshot -> Bool # (/=) :: RtsStatsSnapshot -> RtsStatsSnapshot -> Bool # | |
| Show RtsStatsSnapshot Source # | |
Defined in NanoUI.Debug Methods showsPrec :: Int -> RtsStatsSnapshot -> ShowS # show :: RtsStatsSnapshot -> String # showList :: [RtsStatsSnapshot] -> ShowS # | |
data CoreDebugSnapshot Source #
Constructors
| CoreDebugSnapshot | |
Fields
| |
Instances
| Eq CoreDebugSnapshot Source # | |
Defined in NanoUI.Debug Methods (==) :: CoreDebugSnapshot -> CoreDebugSnapshot -> Bool # (/=) :: CoreDebugSnapshot -> CoreDebugSnapshot -> Bool # | |
| Show CoreDebugSnapshot Source # | |
Defined in NanoUI.Debug Methods showsPrec :: Int -> CoreDebugSnapshot -> ShowS # show :: CoreDebugSnapshot -> String # showList :: [CoreDebugSnapshot] -> ShowS # | |
data DebugSampler Source #
Constructors
| DebugSampler | |
Fields
| |
type DebugSamplerRef = IORef DebugSampler Source #
noteDebugLoop :: DebugSamplerRef -> Float -> IO () Source #
noteDebugSkip :: DebugSamplerRef -> IO () Source #
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.
noteDebugPresent :: DebugSamplerRef -> Double -> Double -> Double -> Double -> Int -> Int -> Int -> IO () Source #
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).
formatFpsRows :: CoreDebugSnapshot -> [(Text, Text)] Source #
formatDrawRows :: CoreDebugSnapshot -> [(Text, Text)] Source #
formatCoreRtsRows :: CoreDebugSnapshot -> [(Text, Text)] Source #