diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-08 23:18:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-08 23:18:52 +0300 |
| commit | 75c483ec6443f731cc6f2149c4738547eb602c6f (patch) | |
| tree | 4875b619864a5eeeb8faff84f475c21382acb499 /internal/eventloop_exit.go | |
| parent | f86699a94bdde7d973ba5d6fa3e7ca4ab2f234fb (diff) | |
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.
Diffstat (limited to 'internal/eventloop_exit.go')
| -rw-r--r-- | internal/eventloop_exit.go | 8 |
1 files changed, 4 insertions, 4 deletions
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 } |
