diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-23 23:52:55 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-23 23:52:55 +0200 |
| commit | b79a868fbc85cd7fb2829e978174629ab8a9c986 (patch) | |
| tree | 6d80b9b1a45a43b8d251a518f3538817c34e3165 /internal/flags/flags.go | |
| parent | 570b7b5d9283b9e443e7da25661e9f2098cc2305 (diff) | |
tui: add top-level model and run entrypoint
Diffstat (limited to 'internal/flags/flags.go')
| -rw-r--r-- | internal/flags/flags.go | 12 |
1 files changed, 11 insertions, 1 deletions
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 |
