(b *testing.B, numProcs, step, downTracks int)
| 150 | } |
| 151 | |
| 152 | func 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 | |
| 179 | func benchmarkLoadBalancedPool(b *testing.B, wp *workerpool.WorkerPool, numProcs, step, downTracks int) { |
| 180 | for b.Loop() { |
no test coverage detected