summaryrefslogtreecommitdiff
path: root/internal/flamegraph
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-10 19:08:42 +0200
committerPaul Buetow <paul@buetow.org>2026-03-10 19:08:42 +0200
commitb4935194b7cdbb9854d7716bd3ec70883358f03a (patch)
treeca9dbae416a8287d143bd24c739d97145c0302a7 /internal/flamegraph
parente9bdf85b11e9c75f19721384f1c1b34b0f2f4ea0 (diff)
task 433: lock in pair recycle safety
Diffstat (limited to 'internal/flamegraph')
-rw-r--r--internal/flamegraph/livetrie_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/flamegraph/livetrie_test.go b/internal/flamegraph/livetrie_test.go
index 53bdf1f..5d4ce47 100644
--- a/internal/flamegraph/livetrie_test.go
+++ b/internal/flamegraph/livetrie_test.go
@@ -48,6 +48,23 @@ func TestLiveTrieIngestIsAdditive(t *testing.T) {
}
}
+func TestLiveTrieIngestCopiesBeforeRecycle(t *testing.T) {
+ lt := NewLiveTrie([]string{"comm", "path"}, "count")
+
+ pair := newTestPair("svc", 42, 1001, "/tmp/a", 1, 2, 3)
+ lt.Ingest(pair)
+ pair.Recycle()
+
+ snap := decodeLiveSnapshot(t, lt)
+ leaf := findSnapshotPath(t, &snap, "svc", "/tmp", "/a")
+ if got, want := leaf.Value, uint64(1); got != want {
+ t.Fatalf("leaf value after recycle = %d, want %d", got, want)
+ }
+ if got, want := leaf.Total, uint64(1); got != want {
+ t.Fatalf("leaf total after recycle = %d, want %d", got, want)
+ }
+}
+
func TestLiveTrieCommTracepointPathAggregatesSameSyscallAcrossPaths(t *testing.T) {
lt := NewLiveTrie([]string{"comm", "tracepoint", "path"}, "count")
lt.AddRecord(IterRecord{