From author's notes (@ben-foxmore):
The current usage of gettimeofday causes issues for us when performing
tests shortly after restarting a system. In our setup, this occurs
often as we restart the system before each test to ensure reliable
results. We already maintain our own version of iperf for some subtle
changes, but this change feels like it might be useful to upstream.
(It's also a reasonable size change, so we'd prefer not maintain it
with each new version of iperf.)
It uses clock_gettime on systems that have it available, and falls
back to gettimeofday when it's not. These two options use different
structures for storing time - clock_gettime uses timespec, and
gettimeofday uses timeval. To provide abstraction to which one is
available, a separate iperf_time struct is defined to store time.
timespec has nanosecond accuracy, while timeval only has microseconds.
For the purposes of iperf, I don't think nanosecond accuracy is
neccesary, so iperf_time only uses microseconds, throwing away any
additional accuracy. Currently I have used the MONOTONIC clock, as I
think we only need a consistent time interval measure.
There are lots of mixed tabs and spaces, most of them look OK if tabs are 8
characters wide, but this bit seems to have been written by someone whose editor
thinks they're 4 characters wide, so it looks all messed up.
This option simulates payload in iperf2, which is just repetitive pattern
(ASCII '0..9' repeating), as opposed to iperf3 where payload is random.
It might help in testing and reveal problems in networking gear with hardware
compression (including WiFi access points), where iperf2 and iperf3 perform
differently, just based on payload entropy.
Got the following error when running server side with -B option:
Server side:
./iperf3 -s -B <server_ipv4_address>
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
iperf3: error - unable to start stream listener: Bad file descriptor
-----------------------------------------------------------
Client side:
./iperf3 -c <server_ipv4_address> --sctp
iperf3: error - unable to start stream listener: No such file or directory
Similar fix as below for TCP:
commit eb1cfe5e162d08efdf18fa12cd6627cfdcd675a7
Author: Bruce A. Mah <bmah@es.net>
Date: Fri Aug 1 16:24:14 2014 -0700
Another iteration on issue #193, fixes -B with some TCP tests.
Signed-off-by: Jianwen Ji <jijianwen@gmail.com>
Don't count data for tests received after the end of a test.
This prevents is from reporting an incorrect number of bytes
received at the end of the test, which doesn't match up with the
sum of the data received during the test intervals.
Log late receives if debugging mode enabled.
Fixes#692.