summaryrefslogtreecommitdiff
path: root/internal/flamegraph/livetrie.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 13:36:51 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 13:36:51 +0200
commitef12ce837176bd21deb455eb50a6c839af02b510 (patch)
treec262ceeda0b419236a4b0b1826df8eb5e418b852 /internal/flamegraph/livetrie.go
parent10c5d48413afaef88626419d8c4bf9fbf6f1c902 (diff)
Add live flamegraph test modes and dynamic synthetic live feed
Diffstat (limited to 'internal/flamegraph/livetrie.go')
-rw-r--r--internal/flamegraph/livetrie.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/flamegraph/livetrie.go b/internal/flamegraph/livetrie.go
index db46af5..0d42b6b 100644
--- a/internal/flamegraph/livetrie.go
+++ b/internal/flamegraph/livetrie.go
@@ -88,6 +88,12 @@ func (lt *LiveTrie) invalidateCache() {
// Ingest adds one event pair into the live trie and recycles the pair.
func (lt *LiveTrie) Ingest(ep *event.Pair) {
record := eventPairToRecord(ep)
+ lt.AddRecord(record)
+ ep.Recycle()
+}
+
+// AddRecord adds one already-decoded flamegraph record into the live trie.
+func (lt *LiveTrie) AddRecord(record IterRecord) {
value := record.Cnt.ValueByName(lt.countField)
lt.mu.Lock()
@@ -95,8 +101,6 @@ func (lt *LiveTrie) Ingest(ep *event.Pair) {
lt.addLocked(frames, value)
lt.version.Add(1)
lt.mu.Unlock()
-
- ep.Recycle()
}
// Reset clears the trie so live snapshots start from a new baseline.