Commit bf44790
committed
fix(sender): remove busy-wait between reply arrival and next probe
The session sender loop only blocked in the select immediately after
sending a probe. When the reflected reply arrived, that select returned
after one RTT, the reply was drained at the top of the loop, and the
loop then spun on the zero-timeout select until the next 1-second
deadline: a pure busy-wait costing (interval - RTT) of one core per
interval, i.e. roughly one full core per sender session at the default
probe rate.
Move the wait out of the send branch: after draining replies and the
endtime check, block on select until the next probe deadline, or until
endtime once all probes have been sent. A reply still wakes the select
early and is drained normally, so timing, sequencing, statistics and
log output are unchanged.
Loopback validation (10 probes, -i 1000, local responder):
original: wall 9.07s, CPU 9.06s (100% of a core)
patched: wall 9.09s, CPU 0.07s (~1%)
0.0% loss, probes exactly 1s apart, reply log lines unchanged.
Full test suite: 12 passed.1 parent 885b986 commit bf44790
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
353 | | - | |
354 | 352 | | |
355 | 353 | | |
356 | 354 | | |
357 | 355 | | |
358 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
359 | 368 | | |
360 | 369 | | |
361 | 370 | | |
| |||
0 commit comments