summaryrefslogtreecommitdiff
path: root/internal/flamegraph/flamegraph.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-03-14 21:17:32 +0200
committerPaul Buetow <paul@buetow.org>2025-03-14 21:17:32 +0200
commitbcd854084554e72708bfcc17457b3063af88dda2 (patch)
tree3f16024994dfaa2cc0e00a57c3586de2664fb15d /internal/flamegraph/flamegraph.go
parent4e5ec5ec19baab4cfdda66622d86117d32b3b020 (diff)
add sleep to fix CPU spin
add memprofile pdf report
Diffstat (limited to 'internal/flamegraph/flamegraph.go')
-rw-r--r--internal/flamegraph/flamegraph.go4
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)
}
}
}