diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-09 10:53:18 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-09 10:53:18 +0300 |
| commit | 8da473aed2c3e901615294df398b26db5aea6032 (patch) | |
| tree | a62807c29441c56776910558ece56361202f7bb2 /internal/tui/common | |
| parent | f3aed5203b309f1d452a5dc3f05c1ecba8e1134b (diff) | |
add auto-reset timer for dashboard aggregates
Live flamegraph trie and stats engine grow unboundedly during long
traces. Add a periodic auto-reset (same effect as the 'r' key) so they
stay bounded.
- New CLI flag -resetTimer=30s (default 30s, 0 disables).
- Hotkey I cycles the cadence: off -> 15s -> 30s -> 60s -> 5m -> off.
Custom intervals (e.g. -resetTimer=47s) advance to the first preset
greater than the current value, then wrap to off.
- autoResetTickMsg carries a generation counter so changing the cadence
drops in-flight ticks scheduled under the previous interval.
- Dashboard chrome shows 'auto-reset: 30s' or 'auto-reset: off'.
Diffstat (limited to 'internal/tui/common')
| -rw-r--r-- | internal/tui/common/keys.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/tui/common/keys.go b/internal/tui/common/keys.go index 1dd2833..315edef 100644 --- a/internal/tui/common/keys.go +++ b/internal/tui/common/keys.go @@ -35,6 +35,12 @@ type KeyMap struct { Enter key.Binding Esc key.Binding Refresh key.Binding + // AutoReset toggles/cycles the dashboard's auto-reset timer. The + // timer periodically clears aggregate state (same as Refresh) to + // prevent unbounded growth of the flamegraph trie and stats engine. + // Bound to capital `I` because lowercase `t` is the TID picker; we + // keep `i` unbound so future use isn't blocked. + AutoReset key.Binding } // Keys contains the default shared key map. @@ -72,6 +78,7 @@ func DefaultKeyMap() KeyMap { Enter: keyBinding("select", "enter"), Esc: keyBinding("back", "esc"), Refresh: keyBinding("reset baseline", "r"), + AutoReset: keyBinding("auto-reset", "I"), } } @@ -113,6 +120,7 @@ func (k KeyMap) DashboardStatusHelpSections() []HelpSection { k.Probes, k.Record, k.Refresh, + k.AutoReset, k.Quit, } if help := k.Export.Help(); help.Key != "" || help.Desc != "" { @@ -152,7 +160,7 @@ func (k KeyMap) DashboardFullHelp() [][]key.Binding { if help := k.Export.Help(); help.Key != "" || help.Desc != "" { controls = append(controls, k.Export) } - controls = append(controls, k.DirGroup, k.SelectPID, k.SelectTID, k.Probes, k.Record, k.Refresh, k.Quit) + controls = append(controls, k.DirGroup, k.SelectPID, k.SelectTID, k.Probes, k.Record, k.Refresh, k.AutoReset, k.Quit) controls = append(controls, k.Visualize, k.Metric, k.Sort, k.ReverseSort, k.Filter, k.FilterUndo) return [][]key.Binding{ |
