Skip to content

smelt.metrics.perf

Tier: UiHost - Requires a terminal UI; calling these from headless mode raises.

Visibility: Public - Stable Lua API intended for user config and plugins.

Perf instrumentation toggle, clear, and snapshot. UiHost-only.

smelt.metrics.perf.clear

fun(): nil

Clear all accumulated perf samples (durations and value gauges).

smelt.metrics.perf.enabled

fun(): boolean

Return whether perf instrumentation collection is enabled.

smelt.metrics.perf.set_enabled

fun(on: boolean): nil

Toggle perf instrumentation collection on/off. Disabled by default; enable to populate snapshot for the F12 debug panel.

smelt.metrics.perf.snapshot

fun(): table

Return the current perf snapshot as { durations, values, enabled } with per-label count, last, p50, p95, p99, max, total fields. Powers detailed diagnostics; prefer snapshot_top for live UI panels.

smelt.metrics.perf.snapshot_top

fun(limit: integer?): table

Return a cheap live perf snapshot with only the top limit duration rows and no value rows. Intended for panels that refresh frequently.