summaryrefslogtreecommitdiff
path: root/internal/ior.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-20 11:38:19 +0300
committerPaul Buetow <paul@buetow.org>2026-05-20 11:38:19 +0300
commit9310b54d439d4a1a8d4d337987aa63884df0af76 (patch)
treec6fb38085891a04ce81672f977af316a2e96b2fd /internal/ior.go
parent5fd613562e2aa2ab3aac3349f44db88330046c1c (diff)
feat: add syscall aggregate sampling infrastructure (task 17)
Diffstat (limited to 'internal/ior.go')
-rw-r--r--internal/ior.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/ior.go b/internal/ior.go
index decdf12..3afb09a 100644
--- a/internal/ior.go
+++ b/internal/ior.go
@@ -242,6 +242,9 @@ func wireRuntimeBindings(rt *tuiRuntime, bindings runtime.TraceRuntimeBindings)
// live-filter setter so the TUI can swap filters without restarting BPF probes.
func makeTUIEventLoopConfigurer(ctx context.Context, cfg flags.Config, rt *tuiRuntime) func(*eventLoop) {
var recorderWarningOnce sync.Once
+ type aggregateSink interface {
+ IngestSyscallAggregates([]statsengine.SyscallAggregate)
+ }
return func(el *eventLoop) {
// Seed the event loop's filter from config so subsequent reads via
// el.Filter() see the same filter the trace was started with.
@@ -271,6 +274,9 @@ func makeTUIEventLoopConfigurer(ctx context.Context, cfg flags.Config, rt *tuiRu
el.warningCb = func(message string) {
rt.streamBuf.Push(streamrow.NewWarning(rt.streamSeq.Next(), message))
}
+ if sink, ok := rt.snapSource.(aggregateSink); ok {
+ el.aggregateSink = sink
+ }
if bindings, ok := runtime.RuntimeBindingsFromContext(ctx); ok {
bindings.SetLiveFilterSetter(el.SetFilter)
}
@@ -566,6 +572,15 @@ func setupTraceInfra(
bpfModule.Close()
return nil, nil, nil, nil, nil, nil, func() {}, err
}
+ aggregateConsumer, err := newSyscallAggregateConsumer(bpfModule)
+ if err != nil {
+ cancel()
+ stopSignals()
+ rb.Stop()
+ bpfModule.Close()
+ return nil, nil, nil, nil, nil, nil, func() {}, err
+ }
+ el.aggregateSrc = aggregateConsumer
teardown = func() {
// Stop the ring-buffer polling goroutine before the module is closed.