From b79a868fbc85cd7fb2829e978174629ab8a9c986 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Feb 2026 23:52:55 +0200 Subject: tui: add top-level model and run entrypoint --- internal/flags/flags.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/flags/flags.go') diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 6010b51..8760d33 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -8,6 +8,7 @@ import ( "slices" "strings" "sync" + "sync/atomic" bpf "github.com/aquasecurity/libbpfgo" ) @@ -15,6 +16,7 @@ import ( var ( singleton Flags once sync.Once + pidFilter atomic.Int64 ) const flamegraphToolDefault = "$HOME/git/FlameGraph/flamegraph.pl" @@ -64,7 +66,14 @@ type Flags struct { } func Get() Flags { - return singleton + out := singleton + out.PidFilter = int(pidFilter.Load()) + return out +} + +// SetPidFilter updates the active PID filter used for subsequent tracing runs. +func SetPidFilter(pid int) { + pidFilter.Store(int64(pid)) } func Parse() { @@ -100,6 +109,7 @@ func parse() { flag.StringVar(&singleton.FlamegraphTool, "flamegraphTool", "", "Path to the flamegraph tool (e.g. flamegraph.pl or inferno-flamegraph)") flag.Parse() + pidFilter.Store(int64(singleton.PidFilter)) if singleton.FlamegraphTool == "" { singleton.FlamegraphTool = flamegraphToolDefault -- cgit v1.2.3