Skip to main content

Module tui

Module tui 

Source
Expand description

Opt-in terminal dashboard for live metrics (RLG_TUI=1). Opt-in terminal dashboard for live observability metrics.

Set RLG_TUI=1 to spawn a background render thread that paints a non-clobbering sparkline dashboard at ~60 FPS. Enable the tui feature for automatic terminal size detection; otherwise falls back to 80x24.

Structsยง

TuiMetrics
Atomic counters for the TUI dashboard. Cache-line aligned (repr(align(64))).

Constantsยง

DEFAULT_TERMINAL_HEIGHT ๐Ÿ”’
Default terminal height when detection fails.
DEFAULT_TERMINAL_WIDTH ๐Ÿ”’
Default terminal width when detection fails.
LEVEL_BAR_WIDTH ๐Ÿ”’
Width of level-distribution bar charts (in block characters).
SPARKLINE_RING_SIZE ๐Ÿ”’
Number of throughput samples in the sparkline ring buffer (one per tick).
SPARK_CHARS ๐Ÿ”’
Sparkline characters indexed by intensity (0..=7).
TUI_TICK_INTERVAL_MS ๐Ÿ”’
TUI render interval in milliseconds (~60 FPS).

Functionsยง

build_fmt_line
Builds the format counts line from metrics.
compute_level_bars
Computes level bar rendering from metrics.
format_uptime ๐Ÿ”’
Formats an uptime duration as HH:MM:SS.
format_with_commas ๐Ÿ”’
Formats an integer with comma separators.
get_terminal_height ๐Ÿ”’
get_terminal_height_of
Returns the terminal height for the given handle, or 24 as fallback.
get_terminal_width ๐Ÿ”’
Returns the terminal width, or DEFAULT_TERMINAL_WIDTH as fallback.
render_level_bar ๐Ÿ”’
Renders a level bar: filled blocks + empty blocks, LEVEL_BAR_WIDTH chars wide.
render_sparkline ๐Ÿ”’
Renders a sparkline string from a circular buffer of throughput samples.
render_tick
Performs one tick of the TUI dashboard, returning the ANSI-formatted frame.
spawn_tui_thread
Spawns the background TUI renderer thread.