MCPcopy
hub / github.com/livekit/livekit / benchmarkLoadBalanced

Function benchmarkLoadBalanced

pkg/sfu/receiver_test.go:152–177  ·  view source on GitHub ↗
(b *testing.B, numProcs, step, downTracks int)

Source from the content-addressed store, hash-verified

150}
151
152func benchmarkLoadBalanced(b *testing.B, numProcs, step, downTracks int) {
153 for b.Loop() {
154 start := atomic.NewUint64(0)
155 step := uint64(step)
156 end := uint64(downTracks)
157
158 var wg sync.WaitGroup
159 wg.Add(numProcs)
160 for p := 0; p < numProcs; p++ {
161 go func() {
162 defer wg.Done()
163 for {
164 n := start.Add(step)
165 if n >= end+step {
166 return
167 }
168
169 for i := n - step; i < n && i < end; i++ {
170 writeRTP()
171 }
172 }
173 }()
174 }
175 wg.Wait()
176 }
177}
178
179func benchmarkLoadBalancedPool(b *testing.B, wp *workerpool.WorkerPool, numProcs, step, downTracks int) {
180 for b.Loop() {

Callers 1

BenchmarkWriteRTPFunction · 0.85

Calls 3

writeRTPFunction · 0.85
DoneMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected