summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph/renderer.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 15:21:01 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 15:21:01 +0200
commit4ff17c30120d657b966f8a55188ba167dc875e64 (patch)
tree62737caf6b8e7411c2437dd995d3de5ce6aeca99 /internal/tui/flamegraph/renderer.go
parent1530bf2856bbb32a6e0457596b55c07f3836a0ec (diff)
feat(tui): add flamegraph bytes metric toggle
Diffstat (limited to 'internal/tui/flamegraph/renderer.go')
-rw-r--r--internal/tui/flamegraph/renderer.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/tui/flamegraph/renderer.go b/internal/tui/flamegraph/renderer.go
index 3ae9a11..e4c4043 100644
--- a/internal/tui/flamegraph/renderer.go
+++ b/internal/tui/flamegraph/renderer.go
@@ -192,7 +192,7 @@ func semanticFrameColor(name string) (color.Color, bool) {
}
// RenderTerminalView renders a terminal flamegraph viewport from laid out frames.
-func RenderTerminalView(frames []tuiFrame, width, height, selectedIdx int, subtreeSet, matchSet, filterSet map[int]bool, globalTotal uint64, isDark, searchActive bool, searchQuery string) string {
+func RenderTerminalView(frames []tuiFrame, width, height, selectedIdx int, subtreeSet, matchSet, filterSet map[int]bool, globalTotal uint64, metricLabel string, isDark, searchActive bool, searchQuery string) string {
if width < minFlameWidth {
return common.PanelStyle.Render("Flame: terminal too narrow (need >= 60 columns)")
}
@@ -202,6 +202,9 @@ func RenderTerminalView(frames []tuiFrame, width, height, selectedIdx int, subtr
if len(frames) == 0 {
return common.PanelStyle.Render("Flame: waiting for data...")
}
+ if strings.TrimSpace(metricLabel) == "" {
+ metricLabel = "events"
+ }
filterActive := strings.TrimSpace(searchQuery) != ""
if filterActive {
@@ -267,13 +270,13 @@ func RenderTerminalView(frames []tuiFrame, width, height, selectedIdx int, subtr
if len(frames) > 0 {
frameCoverage = 100 * float64(visibleFrames) / float64(len(frames))
}
- status := fmt.Sprintf("Filter %q: %.1f%% system (%d/%d matches, %.1f%% frames shown) | Selected: %s total=%d depth=%d %.2f%% filter",
- searchQuery, filterSystemShare, pos, len(matches), frameCoverage,
- selected.Name, selected.Total, selected.Depth, selectedFilterShare)
+ status := fmt.Sprintf("Filter %q: %.1f%% %s (%d/%d matches, %.1f%% frames shown) | Selected: %s total(%s)=%d depth=%d %.2f%% filtered %s",
+ searchQuery, filterSystemShare, metricLabel, pos, len(matches), frameCoverage,
+ selected.Name, metricLabel, selected.Total, selected.Depth, selectedFilterShare, metricLabel)
return renderViewRows(toolbar, status, rowsForRender(frames, width, rowOffset, maxRow, barHeight, availableRows, selected.Path, subtreeSet, matchSet, selectedIdx, isDark, searchActive, filterActive), width)
} else {
- status := fmt.Sprintf("Selected: %s [%s] total=%d depth=%d col=%d width=%d share=%.2f%%",
- selected.Name, compactFramePath(selected.Path), selected.Total, selected.Depth, selected.Col, selected.Width, selectedSystemShare)
+ status := fmt.Sprintf("Selected: %s [%s] total(%s)=%d depth=%d col=%d width=%d share=%.2f%% %s",
+ selected.Name, compactFramePath(selected.Path), metricLabel, selected.Total, selected.Depth, selected.Col, selected.Width, selectedSystemShare, metricLabel)
return renderViewRows(toolbar, status, rowsForRender(frames, width, rowOffset, maxRow, barHeight, availableRows, selected.Path, subtreeSet, matchSet, selectedIdx, isDark, searchActive, filterActive), width)
}
}