blob: 0f49568c618e81223468b07403118d4f72e32e95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package flamegraph
import (
"context"
"ior/internal/event"
"sync"
)
type worker struct {
iod iorData
done chan struct{}
}
func newWorker() worker {
return worker{iod: newIorData()}
}
func (w worker) run(ctx context.Context, wg *sync.WaitGroup, ch <-chan *event.Pair) {
defer wg.Done()
for {
select {
case ev, ok := <-ch:
if !ok {
return
}
w.iod.addEventPair(ev)
ev.Recycle()
case <-ctx.Done():
return
}
}
}
|