diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-26 23:33:55 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-26 23:33:55 +0200 |
| commit | 4ca34f040203c8e31603bbb39fd38632b68067d8 (patch) | |
| tree | eed81b39e169eb6d0cd7d2eca6b338c7c0914ba4 /internal/ior.go | |
| parent | e5cb5db2292ae84680935767d455a777125e0fe9 (diff) | |
tui: add paused stream CSV export and foreground editor open
Diffstat (limited to 'internal/ior.go')
| -rw-r--r-- | internal/ior.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/internal/ior.go b/internal/ior.go index a910fc0..a19d2f7 100644 --- a/internal/ior.go +++ b/internal/ior.go @@ -272,9 +272,17 @@ func runTraceWithContext(parentCtx context.Context, started chan<- struct{}, con origPrintCb(ep) } } - duration := time.Duration(flags.Get().Duration) * time.Second - logln("Probing for", duration) - ctx, cancel := context.WithTimeout(parentCtx, duration) + cfg := flags.Get() + ctx := parentCtx + cancel := func() {} + if shouldAutoStopByDuration(cfg) { + duration := time.Duration(cfg.Duration) * time.Second + logln("Probing for", duration) + ctx, cancel = context.WithTimeout(parentCtx, duration) + } else { + logln("Probing until stopped...") + ctx, cancel = context.WithCancel(parentCtx) + } defer cancel() signalCh := make(chan os.Signal, 1) @@ -318,3 +326,7 @@ func signalTraceStarted(started chan<- struct{}) { } close(started) } + +func shouldAutoStopByDuration(cfg flags.Flags) bool { + return cfg.PlainMode || cfg.FlamegraphEnable || cfg.PprofEnable +} |
