summaryrefslogtreecommitdiff
path: root/internal/flamegraph/flamegraph.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-03-18 22:32:53 +0200
committerPaul Buetow <paul@buetow.org>2025-03-18 22:32:53 +0200
commitdbcd2f6dc2a4b842ebcfa5dbfc7990befa27267c (patch)
tree6ccbb822a472eb20dd1008f73a649e4aaa4db8f0 /internal/flamegraph/flamegraph.go
parent6010e057e2d0593a6c6b50f4c7aee301a86a478a (diff)
add race detector
Diffstat (limited to 'internal/flamegraph/flamegraph.go')
-rw-r--r--internal/flamegraph/flamegraph.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/flamegraph/flamegraph.go b/internal/flamegraph/flamegraph.go
index 223389d..d5d7e96 100644
--- a/internal/flamegraph/flamegraph.go
+++ b/internal/flamegraph/flamegraph.go
@@ -21,7 +21,11 @@ func New() Flamegraph {
Ch: make(chan *event.Pair, 4096),
Done: make(chan struct{}),
}
- for range runtime.NumCPU() / 2 {
+ numWorkers := runtime.NumCPU() / 4
+ if numWorkers == 0 {
+ numWorkers = 1
+ }
+ for range numWorkers {
f.workers = append(f.workers, newWorker())
}
return f