diff options
Diffstat (limited to 'internal/tui/flamegraph')
| -rw-r--r-- | internal/tui/flamegraph/controls.go | 14 | ||||
| -rw-r--r-- | internal/tui/flamegraph/model_test.go | 12 |
2 files changed, 22 insertions, 4 deletions
diff --git a/internal/tui/flamegraph/controls.go b/internal/tui/flamegraph/controls.go index 2033416..bd588b3 100644 --- a/internal/tui/flamegraph/controls.go +++ b/internal/tui/flamegraph/controls.go @@ -57,8 +57,16 @@ func (m *Model) cycleFieldOrder() { } func (m *Model) toggleCountField() { - next := "bytes" - if m.countField == "bytes" { + // 3-way cycle: count → bytes → duration → count. + // durationToPrev (inter-syscall gap) is reachable via the CLI flag but + // kept out of the toolbar cycle for now. + var next string + switch m.countField { + case "count": + next = "bytes" + case "bytes": + next = "duration" + default: next = "count" } if m.liveTrie != nil { @@ -168,6 +176,8 @@ func (m Model) countFieldLabel() string { return "events" case "bytes": return "bytes" + case "duration": + return "duration" default: return m.countField } diff --git a/internal/tui/flamegraph/model_test.go b/internal/tui/flamegraph/model_test.go index c2626cd..e864e88 100644 --- a/internal/tui/flamegraph/model_test.go +++ b/internal/tui/flamegraph/model_test.go @@ -987,12 +987,20 @@ func TestControlMetricToggleReconfiguresLiveTrieCountField(t *testing.T) { } m = pressFlameKey(t, m, tea.KeyPressMsg{Code: []rune{'b'}[0], Text: "b"}) - if got, want := m.countField, "count"; got != want { + if got, want := m.countField, "duration"; got != want { t.Fatalf("expected model count field %q after second toggle, got %q", want, got) } - if got, want := liveTrie.CountField(), "count"; got != want { + if got, want := liveTrie.CountField(), "duration"; got != want { t.Fatalf("expected live trie count field %q after second toggle, got %q", want, got) } + + m = pressFlameKey(t, m, tea.KeyPressMsg{Code: []rune{'b'}[0], Text: "b"}) + if got, want := m.countField, "count"; got != want { + t.Fatalf("expected model count field %q after third toggle, got %q", want, got) + } + if got, want := liveTrie.CountField(), "count"; got != want { + t.Fatalf("expected live trie count field %q after third toggle, got %q", want, got) + } } func TestNewModelAlignsPresetIndexToLiveTrieFields(t *testing.T) { |
