MCPcopy
hub / github.com/livekit/livekit / benchmarkLoadBalancedPool

Function benchmarkLoadBalancedPool

pkg/sfu/receiver_test.go:179–204  ·  view source on GitHub ↗
(b *testing.B, wp *workerpool.WorkerPool, numProcs, step, downTracks int)

Source from the content-addressed store, hash-verified

177}
178
179func benchmarkLoadBalancedPool(b *testing.B, wp *workerpool.WorkerPool, numProcs, step, downTracks int) {
180 for b.Loop() {
181 start := atomic.NewUint64(0)
182 step := uint64(step)
183 end := uint64(downTracks)
184
185 var wg sync.WaitGroup
186 wg.Add(numProcs)
187 for p := 0; p < numProcs; p++ {
188 wp.Submit(func() {
189 defer wg.Done()
190 for {
191 n := start.Add(step)
192 if n >= end+step {
193 return
194 }
195
196 for i := n - step; i < n && i < end; i++ {
197 writeRTP()
198 }
199 }
200 })
201 }
202 wg.Wait()
203 }
204}
205
206func writeRTP() {
207 s := []byte("simulate some work")

Callers 1

BenchmarkWriteRTPFunction · 0.85

Calls 3

writeRTPFunction · 0.85
DoneMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected