End test immediately when all number of blocks/bytes sent/received #1775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version of iperf3 (or development branch, such as
master
or3.1-STABLE
) to which this pull request applies:master
Issues fixed (if any): Lower throughtput numbers reported with v3.16 #1768
Brief description of code changes (suitable for use as a commit message):
Currently, after to change to multi-thread, when limiting the test by number of bytes (
-n
) or number of blocks (-k
), the test ends only when the current interval (-i
) ends and not when all the data was sent/received. This is because theselect()
no longer monitor the steams data. Therefore the throughput statistics are not properly calculated. I.e. for 1 second interval, if sending was done in 2.5 seconds, the statistics will be as if sending was done in 3 seconds. This is much worse if the interval period is larger.This suggested fix is using the self-pipe trick, based on this example. When
-n
or-k
are set, a self-pipe is added to the Client's select. When the limit is reached, one byte is written to the pipe to wake-up theselect()
in the main thread.