summaryrefslogtreecommitdiff
path: root/internal/flamegraph
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-12 23:26:02 +0200
committerPaul Buetow <paul@buetow.org>2026-03-12 23:26:02 +0200
commit28338f46461c684f1448878a5d9dcd7f2121f7d2 (patch)
treedc367c25c342c557100670c962b0e8deceb7dae7 /internal/flamegraph
parentf28dab3d42c6e4a33642b990f60f69abc2d89f07 (diff)
fix: restore legacy flamegraph trace output mode
Diffstat (limited to 'internal/flamegraph')
-rw-r--r--internal/flamegraph/recorder.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/flamegraph/recorder.go b/internal/flamegraph/recorder.go
new file mode 100644
index 0000000..432e509
--- /dev/null
+++ b/internal/flamegraph/recorder.go
@@ -0,0 +1,34 @@
+package flamegraph
+
+import "ior/internal/event"
+
+// Recorder aggregates event pairs and writes them to the legacy .ior.zst format.
+// Integration tests still use this artifact to assert trace output end-to-end.
+type Recorder struct {
+ name string
+ data iorData
+}
+
+// NewRecorder creates a recorder for one trace run.
+func NewRecorder(name string) *Recorder {
+ return &Recorder{
+ name: name,
+ data: newIorData(),
+ }
+}
+
+// AddPair folds one traced syscall pair into the aggregated output.
+func (r *Recorder) AddPair(pair *event.Pair) {
+ if r == nil || pair == nil {
+ return
+ }
+ r.data.addEventPair(pair)
+}
+
+// Write persists the aggregated trace output to a .ior.zst file.
+func (r *Recorder) Write() error {
+ if r == nil {
+ return nil
+ }
+ return r.data.serializeToFile(r.name)
+}