summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-25 21:44:14 +0200
committerPaul Buetow <paul@buetow.org>2026-02-25 21:44:14 +0200
commitf6acb83f5b666659e34d092811fb9ff628a85494 (patch)
tree5a488bb146dba47f5c729226da07b07d340a611e
parent78dfb8ad0f844099280d102407449da0b456a84e (diff)
Add late-bound probe manager access for TUI
-rw-r--r--internal/ior.go2
-rw-r--r--internal/tui/tui.go26
2 files changed, 28 insertions, 0 deletions
diff --git a/internal/ior.go b/internal/ior.go
index d78c351..61c5e10 100644
--- a/internal/ior.go
+++ b/internal/ior.go
@@ -231,6 +231,8 @@ func runTraceWithContext(parentCtx context.Context, started chan<- struct{}, con
if err := mgr.AttachAll(flags.Get().ShouldIAttachTracepoint, tracepoints.List); err != nil {
return err
}
+ tui.SetProbeManager(mgr)
+ defer tui.SetProbeManager(nil)
// 4096 channel size, minimises event drops
ch := make(chan []byte, 4096)
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 5aff6a2..ea35b04 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"ior/internal/flags"
+ "ior/internal/probemanager"
"ior/internal/statsengine"
common "ior/internal/tui/common"
dashboardui "ior/internal/tui/dashboard"
@@ -41,6 +42,13 @@ type snapshotSource interface {
Snapshot() *statsengine.Snapshot
}
+// ProbeManager exposes runtime probe controls to TUI layers.
+type ProbeManager interface {
+ States() []probemanager.ProbeState
+ Toggle(syscall string) error
+ ActiveCount() (int, int)
+}
+
var dashboardSourceState struct {
mu sync.RWMutex
source snapshotSource
@@ -51,6 +59,11 @@ var eventStreamSourceState struct {
source *eventstream.RingBuffer
}
+var probeManagerState struct {
+ mu sync.RWMutex
+ manager ProbeManager
+}
+
// SetDashboardSnapshotSource sets the snapshot source used by dashboard mode.
func SetDashboardSnapshotSource(source snapshotSource) {
dashboardSourceState.mu.Lock()
@@ -65,6 +78,13 @@ func SetEventStreamSource(source *eventstream.RingBuffer) {
eventStreamSourceState.mu.Unlock()
}
+// SetProbeManager sets the probe manager used by TUI probe controls.
+func SetProbeManager(manager ProbeManager) {
+ probeManagerState.mu.Lock()
+ probeManagerState.manager = manager
+ probeManagerState.mu.Unlock()
+}
+
func getDashboardSnapshotSource() snapshotSource {
dashboardSourceState.mu.RLock()
defer dashboardSourceState.mu.RUnlock()
@@ -77,6 +97,12 @@ func getEventStreamSource() *eventstream.RingBuffer {
return eventStreamSourceState.source
}
+func getProbeManager() ProbeManager {
+ probeManagerState.mu.RLock()
+ defer probeManagerState.mu.RUnlock()
+ return probeManagerState.manager
+}
+
// Run starts the TUI program in alternate screen mode.
func Run() error {
return RunWithTraceStarter(defaultTraceStarter)