summaryrefslogtreecommitdiff
path: root/internal/flamegraph/livetrie.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-27 18:52:23 +0200
committerPaul Buetow <paul@buetow.org>2026-02-27 18:52:23 +0200
commit5f23af510bd9031c515f2a3cc495bd996c795e69 (patch)
tree151d94f6ffacf7446b72481d51f8f8925d5dee8d /internal/flamegraph/livetrie.go
parent3783d23b8d608c3bf4a2dedd6b4bfb9165439bed (diff)
flamegraph: add live baseline reset hotkey
Diffstat (limited to 'internal/flamegraph/livetrie.go')
-rw-r--r--internal/flamegraph/livetrie.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/flamegraph/livetrie.go b/internal/flamegraph/livetrie.go
index e061add..6ca9bc3 100644
--- a/internal/flamegraph/livetrie.go
+++ b/internal/flamegraph/livetrie.go
@@ -82,6 +82,22 @@ func (lt *LiveTrie) Ingest(ep *event.Pair) {
ep.Recycle()
}
+// Reset clears the trie so live snapshots start from a new baseline.
+func (lt *LiveTrie) Reset() {
+ lt.mu.Lock()
+ lt.root = &trieNode{
+ childMap: make(map[string]*trieNode),
+ }
+ lt.maxDepth = 0
+ lt.version.Add(1)
+ lt.mu.Unlock()
+
+ lt.cacheMu.Lock()
+ lt.cacheVersion = 0
+ lt.cacheJSON = nil
+ lt.cacheMu.Unlock()
+}
+
// Version returns the current ingest version of the trie.
func (lt *LiveTrie) Version() uint64 {
return lt.version.Load()