summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-27 21:50:08 +0200
committerPaul Buetow <paul@buetow.org>2026-02-27 21:50:08 +0200
commit281a433b9ff39c0b290adfc901bdf47cc486491f (patch)
treeb7389fabb8cfc5dbd66275f3cfe5a3fb98cd2b3a
parentf55212d9c02b87b2d6e15f62b2ce5b992b9d3045 (diff)
flags: change default flamegraph order to comm-first
-rw-r--r--README.md4
-rw-r--r--internal/flags/flags.go2
-rw-r--r--internal/flags/flags_test.go14
-rw-r--r--internal/flamegraph/nativesvg.go2
4 files changed, 19 insertions, 3 deletions
diff --git a/README.md b/README.md
index 19282f7..08775aa 100644
--- a/README.md
+++ b/README.md
@@ -60,9 +60,11 @@ sudo cp -v ./libelf/libelf.a /usr/lib64/
## Native Flamegraph Generation
Flamegraphs are generated natively by `ior` from `.ior.zst` data files; no external flamegraph tool is required.
+When `-fields` is omitted, the default stack order is `comm,path,tracepoint` (bottom to top).
+To change grouping order, pass `-fields` explicitly in the desired order.
```sh
-./ior -ior=trace.ior.zst -fields=pid,path,tracepoint -count=count
+./ior -ior=trace.ior.zst -fields=comm,path,tracepoint -count=count
```
This generates an SVG and starts an embedded web server. The terminal prints a URL like:
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