summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/flamegraph')
-rw-r--r--internal/tui/flamegraph/async_refresh_test.go10
-rw-r--r--internal/tui/flamegraph/bench_test.go2
-rw-r--r--internal/tui/flamegraph/model_test.go24
-rw-r--r--internal/tui/flamegraph/stress_test.go4
-rw-r--r--internal/tui/flamegraph/testdata_test.go2
5 files changed, 21 insertions, 21 deletions
diff --git a/internal/tui/flamegraph/async_refresh_test.go b/internal/tui/flamegraph/async_refresh_test.go
index d6027de..73c1889 100644
--- a/internal/tui/flamegraph/async_refresh_test.go
+++ b/internal/tui/flamegraph/async_refresh_test.go
@@ -31,7 +31,7 @@ func TestRefreshFromLiveTrieCmdNilWhenNoTrie(t *testing.T) {
}
func TestRefreshFromLiveTrieCmdProducesSnapshotReady(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
ingestTwoEventsForAsync(t, trie)
m := NewModel(trie)
m.width = 120
@@ -65,7 +65,7 @@ func TestRefreshFromLiveTrieCmdProducesSnapshotReady(t *testing.T) {
}
func TestRefreshFromLiveTrieCmdCoalescesInFlight(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
ingestTwoEventsForAsync(t, trie)
m := NewModel(trie)
m.width = 80
@@ -80,7 +80,7 @@ func TestRefreshFromLiveTrieCmdCoalescesInFlight(t *testing.T) {
}
func TestRefreshFromLiveTrieCmdSkippedWhileUserDrives(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
ingestTwoEventsForAsync(t, trie)
m := NewModel(trie)
m.width = 80
@@ -106,7 +106,7 @@ func TestRefreshFromLiveTrieCmdSkippedWhileUserDrives(t *testing.T) {
}
func TestSnapshotReadyHandlerSnapsToTargetWhileDriving(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
ingestTwoEventsForAsync(t, trie)
m := NewModel(trie)
m.width = 120
@@ -144,7 +144,7 @@ func TestSnapshotReadyHandlerSnapsToTargetWhileDriving(t *testing.T) {
}
func TestViewCacheReusesContentWhenStateUnchanged(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
ingestTwoEventsForAsync(t, trie)
m := NewModel(trie)
m.width = 120
diff --git a/internal/tui/flamegraph/bench_test.go b/internal/tui/flamegraph/bench_test.go
index 33d77d1..d1d0955 100644
--- a/internal/tui/flamegraph/bench_test.go
+++ b/internal/tui/flamegraph/bench_test.go
@@ -284,7 +284,7 @@ func BenchmarkLiveTrieIngestAndSnapshot(b *testing.B) {
b.Run(fmt.Sprintf("%d_events", count), func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
for eventIdx := 0; eventIdx < count; eventIdx++ {
traceID := types.SYS_ENTER_READ
if eventIdx%2 == 0 {
diff --git a/internal/tui/flamegraph/model_test.go b/internal/tui/flamegraph/model_test.go
index e864e88..e9d16f7 100644
--- a/internal/tui/flamegraph/model_test.go
+++ b/internal/tui/flamegraph/model_test.go
@@ -42,7 +42,7 @@ func TestSetViewportAndDarkMode(t *testing.T) {
}
func TestRefreshFromLiveTrieTracksVersionAndSnapshot(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
m := NewModel(trie)
if changed := m.RefreshFromLiveTrie(); !changed {
@@ -58,7 +58,7 @@ func TestRefreshFromLiveTrieTracksVersionAndSnapshot(t *testing.T) {
}
func TestRefreshFromLiveTrieAllowsInitialLoadWhilePaused(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
m := NewModel(trie)
m.paused = true
@@ -74,7 +74,7 @@ func TestRefreshFromLiveTrieAllowsInitialLoadWhilePaused(t *testing.T) {
}
func TestRefreshFromLiveTriePausedBlocksAfterNavigableSnapshot(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
m := NewModel(trie)
m.paused = true
m.snapshot = &snapshotNode{Name: "root", Total: 1}
@@ -94,7 +94,7 @@ func TestRefreshFromLiveTriePausedBlocksAfterNavigableSnapshot(t *testing.T) {
}
func TestRefreshFromLiveTriePausedBlocksAfterAnySnapshot(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count", "count")
m := NewModel(trie)
m.paused = true
m.snapshot = &snapshotNode{Name: "root", Total: 1}
@@ -441,7 +441,7 @@ func TestMouseClickDirectDeepZoomUndoReturnsToRoot(t *testing.T) {
}
func TestStaticFixtureArrowTraversalVisitsAllFrames(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
coreflamegraph.SeedTestFlameData(trie)
m := NewModel(trie)
@@ -472,7 +472,7 @@ func TestStaticFixtureArrowTraversalVisitsAllFrames(t *testing.T) {
}
func TestLiveFixtureArrowTraversalWhileStreamingVisitsAllFrames(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
coreflamegraph.SeedTestLiveFlameData(trie, 0)
m := NewModel(trie)
@@ -531,7 +531,7 @@ func TestLiveFixtureArrowTraversalWhileStreamingVisitsAllFrames(t *testing.T) {
}
func TestSelectionRestoresByPathAcrossLiveRefresh(t *testing.T) {
- trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ trie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
coreflamegraph.SeedTestLiveFlameData(trie, 0)
m := NewModel(trie)
@@ -832,7 +832,7 @@ func TestControlPauseToggle(t *testing.T) {
}
func TestControlResetBaseline(t *testing.T) {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
m := NewModel(liveTrie)
m.snapshot = &snapshotNode{Name: "root", Total: 10}
m.frames = []tuiFrame{{Name: "root", Path: "root"}}
@@ -953,7 +953,7 @@ func TestViewFilterSelectionStatusUsesFilteredTotalAndKeepsContextVisible(t *tes
}
func TestControlCycleFieldOrderReconfiguresLiveTrie(t *testing.T) {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
m := NewModel(liveTrie)
initial := append([]string(nil), m.fieldPresets[m.fieldIndex]...)
expectedNextIdx := (m.fieldIndex + 1) % len(m.fieldPresets)
@@ -972,7 +972,7 @@ func TestControlCycleFieldOrderReconfiguresLiveTrie(t *testing.T) {
}
func TestControlMetricToggleReconfiguresLiveTrieCountField(t *testing.T) {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
m := NewModel(liveTrie)
m = pressFlameKey(t, m, tea.KeyPressMsg{Code: []rune{'b'}[0], Text: "b"})
@@ -1004,7 +1004,7 @@ func TestControlMetricToggleReconfiguresLiveTrieCountField(t *testing.T) {
}
func TestNewModelAlignsPresetIndexToLiveTrieFields(t *testing.T) {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
m := NewModel(liveTrie)
if got, want := m.fieldPresets[m.fieldIndex], []string{"comm", "path", "tracepoint"}; !reflect.DeepEqual(got, want) {
t.Fatalf("expected model field preset to align with trie fields, got %v want %v", got, want)
@@ -1012,7 +1012,7 @@ func TestNewModelAlignsPresetIndexToLiveTrieFields(t *testing.T) {
}
func TestNewModelAlignsCountFieldToLiveTrie(t *testing.T) {
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "bytes")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "bytes", "bytes")
m := NewModel(liveTrie)
if got, want := m.countField, "bytes"; got != want {
t.Fatalf("expected model count field to align with trie field, got %q want %q", got, want)
diff --git a/internal/tui/flamegraph/stress_test.go b/internal/tui/flamegraph/stress_test.go
index e53e4d5..e40d4f1 100644
--- a/internal/tui/flamegraph/stress_test.go
+++ b/internal/tui/flamegraph/stress_test.go
@@ -26,7 +26,7 @@ func TestStressHighEventRate(t *testing.T) {
)
allowedBudget := frameBudget * time.Duration(stressBudgetMultiplier())
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
var ingestWG sync.WaitGroup
type renderMetrics struct {
@@ -149,7 +149,7 @@ func TestStressRapidResize(t *testing.T) {
func TestStressZoomDuringRefresh(t *testing.T) {
t.Parallel()
- liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
ingestStressEvents(liveTrie, 200, 0)
model := NewModel(liveTrie)
diff --git a/internal/tui/flamegraph/testdata_test.go b/internal/tui/flamegraph/testdata_test.go
index c7d97b0..11fcb0c 100644
--- a/internal/tui/flamegraph/testdata_test.go
+++ b/internal/tui/flamegraph/testdata_test.go
@@ -29,7 +29,7 @@ const (
)
func generateTestTrie(depth, breadthPerLevel int) *coreflamegraph.LiveTrie {
- lt := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count")
+ lt := coreflamegraph.NewLiveTrie([]string{"comm", "path", "tracepoint"}, "count", "count")
comms := []string{"api", "db", "worker", "cache"}
traceIDs := []types.TraceId{
types.SYS_ENTER_READ,