From 281a433b9ff39c0b290adfc901bdf47cc486491f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 27 Feb 2026 21:50:08 +0200 Subject: flags: change default flamegraph order to comm-first --- internal/flags/flags.go | 2 +- internal/flags/flags_test.go | 14 ++++++++++++++ internal/flamegraph/nativesvg.go | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'internal') diff --git a/internal/flags/flags.go b/internal/flags/flags.go index dccbe0d..8785ea9 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -144,7 +144,7 @@ func parse() { // If future kernels regress, add targeted exclusions here. if *fields == "" { - singleton.CollapsedFields = []string{"pid", "path", "tracepoint"} + singleton.CollapsedFields = []string{"comm", "path", "tracepoint"} } else { singleton.CollapsedFields = strings.Split(*fields, ",") } diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go index b4d47d2..872a597 100644 --- a/internal/flags/flags_test.go +++ b/internal/flags/flags_test.go @@ -74,3 +74,17 @@ func TestParseLiveDefaults(t *testing.T) { t.Fatalf("default live interval = %v, want %v", cfg.LiveInterval, time.Second) } } + +func TestParseDefaultCollapsedFieldsOrder(t *testing.T) { + cfg := parseForTest(t) + + want := []string{"comm", "path", "tracepoint"} + if len(cfg.CollapsedFields) != len(want) { + t.Fatalf("default collapsed fields len = %d, want %d", len(cfg.CollapsedFields), len(want)) + } + for i := range want { + if cfg.CollapsedFields[i] != want[i] { + t.Fatalf("default collapsed fields[%d] = %q, want %q", i, cfg.CollapsedFields[i], want[i]) + } + } +} diff --git a/internal/flamegraph/nativesvg.go b/internal/flamegraph/nativesvg.go index 89a3e6b..8a2bcd5 100644 --- a/internal/flamegraph/nativesvg.go +++ b/internal/flamegraph/nativesvg.go @@ -12,7 +12,7 @@ import ( // // Flamegraphs are generated natively by ior from .ior.zst data files; no external // flamegraph tool is required. The CLI typically drives this via the -ior flag, -// which reads trace data, aggregates it into a trie of stack frames (e.g. pid,path,tracepoint) +// which reads trace data, aggregates it into a trie of stack frames (e.g. comm,path,tracepoint) // and renders a self-contained SVG that can be viewed in a browser. type NativeSVG struct { fields []string -- cgit v1.2.3