diff options
Diffstat (limited to 'internal/flags')
| -rw-r--r-- | internal/flags/flags.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 4dd32cc..6eafa5e 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -19,10 +19,13 @@ var ( } once sync.Once pidFilter atomic.Int64 + tidFilter atomic.Int64 tuiExportEnable atomic.Bool ) func init() { + pidFilter.Store(-1) + tidFilter.Store(-1) tuiExportEnable.Store(true) } @@ -72,6 +75,7 @@ type Flags struct { func Get() Flags { out := singleton out.PidFilter = int(pidFilter.Load()) + out.TidFilter = int(tidFilter.Load()) out.TUIExportEnable = tuiExportEnable.Load() return out } @@ -81,6 +85,11 @@ func SetPidFilter(pid int) { pidFilter.Store(int64(pid)) } +// SetTidFilter updates the active TID filter used for subsequent tracing runs. +func SetTidFilter(tid int) { + tidFilter.Store(int64(tid)) +} + // SetTUIExportEnable toggles TUI snapshot export file writing. func SetTUIExportEnable(enabled bool) { tuiExportEnable.Store(enabled) @@ -118,6 +127,7 @@ func parse() { fmt.Sprintf("Count field to collapse, valid are: %v", validCollapsedCounts)) flag.Parse() pidFilter.Store(int64(singleton.PidFilter)) + tidFilter.Store(int64(singleton.TidFilter)) tuiExportEnable.Store(singleton.TUIExportEnable) singleton.TracepointsToAttach = extractTracepointFlags(*tracepointsToAttach) |
