diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-02 08:39:35 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-02 08:39:35 +0200 |
| commit | b3327d17f9f5c7080b05d6d5457cf25550d40ad9 (patch) | |
| tree | 090e66047c14c9183058bd68a8d4afc12b48f399 /internal/eventloop.go | |
| parent | 38620359537d77ab10acb888d266d3c6eb16fc9b (diff) | |
Add --open support for live flamegraph browser launch
Diffstat (limited to 'internal/eventloop.go')
| -rw-r--r-- | internal/eventloop.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/eventloop.go b/internal/eventloop.go index 41ab48b..50494dc 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -26,6 +26,8 @@ type eventLoopConfig struct { pathFilter string liveFlamegraph bool liveInterval time.Duration + liveOpen bool + liveOpenCommand string collapsedFields []string countField string flamegraphName string @@ -282,7 +284,11 @@ func (e *eventLoop) run(ctx context.Context, rawCh <-chan []byte) { if e.liveTrie != nil { fmt.Println("Starting live flamegraph server") go func() { - if err := flamegraph.ServeLive(ctx, e.liveTrie, e.cfg.liveInterval); err != nil && ctx.Err() == nil { + liveOptions := flamegraph.LiveServerOptions{ + AutoOpenBrowser: e.cfg.liveOpen, + OpenCommand: e.cfg.liveOpenCommand, + } + if err := flamegraph.ServeLiveWithOptions(ctx, e.liveTrie, e.cfg.liveInterval, liveOptions); err != nil && ctx.Err() == nil { fmt.Println("Live flamegraph server error:", err) } }() |
