From 75c483ec6443f731cc6f2149c4738547eb602c6f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 8 May 2026 23:18:52 +0300 Subject: swap global filter in place to skip BPF reattach Changing the global filter used to call stopTrace + beginTraceCmd, which detached and re-attached every tracepoint and re-loaded the BPF object. On heavily loaded I/O systems that took several seconds and showed an 'Attaching tracepoints...' overlay each time. The probe set never depends on the global filter (ShouldIAttachTracepoint only reads CLI regex flags), so the restart was gratuitous. Now the eventloop holds its filter behind atomic.Pointer with SetFilter / Filter accessors, and the trace starter registers el.SetFilter via the runtime bindings as a SetLiveFilterSetter callback. applyGlobalFilter and undoGlobalFilter call runtime.applyLiveFilter first; only if no trace is running do they fall back to the full restart path. --- internal/eventloop_exit.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/eventloop_exit.go') diff --git a/internal/eventloop_exit.go b/internal/eventloop_exit.go index e97688a..5f6442c 100644 --- a/internal/eventloop_exit.go +++ b/internal/eventloop_exit.go @@ -111,7 +111,7 @@ func (e *eventLoop) handleFdExit(ep *event.Pair, fdEv *types.FdEvent) bool { } } ep.Comm = e.comm(fdEv.GetTid()) - if !e.filter.MatchPair(ep) { + if !e.Filter().MatchPair(ep) { ep.Recycle() return false } @@ -152,7 +152,7 @@ func (e *eventLoop) handleDup3Exit(ep *event.Pair, dup3Ev *types.Dup3Event) bool fd := int32(dup3Ev.Fd) ep.File = e.fdState().resolve(fd, dup3Ev.Pid) ep.Comm = e.comm(dup3Ev.GetTid()) - if !e.filter.MatchPair(ep) { + if !e.Filter().MatchPair(ep) { ep.Recycle() return false } @@ -233,7 +233,7 @@ func (e *eventLoop) handleNullExit(ep *event.Pair, nullEv *types.NullEvent) bool } } ep.Comm = e.comm(nullEv.GetTid()) - if !e.filter.MatchPair(ep) { + if !e.Filter().MatchPair(ep) { ep.Recycle() return false } @@ -244,7 +244,7 @@ func (e *eventLoop) handleFcntlExit(ep *event.Pair, fcntlEv *types.FcntlEvent) b ep.Comm = e.comm(fcntlEv.GetTid()) fd := int32(fcntlEv.Fd) ep.File = e.fdState().resolve(fd, fcntlEv.Pid) - if !e.filter.MatchPair(ep) { + if !e.Filter().MatchPair(ep) { ep.Recycle() return false } -- cgit v1.2.3