diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-14 20:45:15 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-14 20:45:15 +0200 |
| commit | 8368f9986f9fac55a1f3869a4a99a7c077684c1c (patch) | |
| tree | e5c0dbac1158741ea04b4164281f1ead2a1e8262 /internal | |
| parent | 57bad06f0fc9f63078e97ce5871a28a93029c473 (diff) | |
fix pprof
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/eventloop.go | 1 | ||||
| -rw-r--r-- | internal/ior.go | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/internal/eventloop.go b/internal/eventloop.go index 0fc7387..08b53f6 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -61,6 +61,7 @@ func (e *eventLoop) stats() string { func (e *eventLoop) run(ctx context.Context, rawCh <-chan []byte) { if e.flags.FlamegraphEnable { + fmt.Println("Collecting flame graph stats, press Ctrl+C to stop") e.flamegraph.Start(ctx) } if e.flags.PprofEnable { diff --git a/internal/ior.go b/internal/ior.go index c7e4bf2..5e78645 100644 --- a/internal/ior.go +++ b/internal/ior.go @@ -67,6 +67,7 @@ func Run(flags flags.Flags) { } rb.Poll(300) + pprofDone := make(chan struct{}) var cpuProfile, memProfile *os.File if flags.PprofEnable { if cpuProfile, err = os.Create("ior.cpuprofile"); err != nil { @@ -76,6 +77,8 @@ func Run(flags flags.Flags) { panic(err) } pprof.StartCPUProfile(cpuProfile) + } else { + close(pprofDone) } loop := newEventLoop(flags) @@ -95,9 +98,11 @@ func Run(flags flags.Flags) { fmt.Println("Stoppig profiling, writing ior.cpuprofile and ior.memprofile") pprof.StopCPUProfile() pprof.WriteHeapProfile(memProfile) + close(pprofDone) } }() loop.run(ctx, ch) + <-pprofDone fmt.Println("Good bye... (unloading BPF tracepoints will take a few seconds...) after", time.Since(startTime)) } |
