diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-14 21:17:32 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-14 21:17:32 +0200 |
| commit | bcd854084554e72708bfcc17457b3063af88dda2 (patch) | |
| tree | 3f16024994dfaa2cc0e00a57c3586de2664fb15d /internal/flamegraph | |
| parent | 4e5ec5ec19baab4cfdda66622d86117d32b3b020 (diff) | |
add sleep to fix CPU spin
add memprofile pdf report
Diffstat (limited to 'internal/flamegraph')
| -rw-r--r-- | internal/flamegraph/flamegraph.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/flamegraph/flamegraph.go b/internal/flamegraph/flamegraph.go index cf1284e..9214f49 100644 --- a/internal/flamegraph/flamegraph.go +++ b/internal/flamegraph/flamegraph.go @@ -8,6 +8,7 @@ import ( "os" "path" "strings" + "time" ) type counter struct { @@ -55,11 +56,12 @@ func (f Flamegraph) Start(ctx context.Context) { default: select { case <-ctx.Done(): + defer close(f.Done) fmt.Println("Flamegraph processed last event") f.dump() - close(f.Done) return default: + time.Sleep(time.Millisecond * 10) } } } |
