From bcd854084554e72708bfcc17457b3063af88dda2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 14 Mar 2025 21:17:32 +0200 Subject: add sleep to fix CPU spin add memprofile pdf report --- internal/flamegraph/flamegraph.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/flamegraph/flamegraph.go') 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) } } } -- cgit v1.2.3