1. Modify the file
1. Makefile in the root directory : shield the compilation of examples , if you don’t shield it, there will be a compilation error. We don’t use this tool, so shield it, as follows;
SUBDIRS = src #examples
2. src/Makefile: remove the " -pg " compilation option, shield the use of gprof (profiling tool), because the use of GNU tools in the project will cause compilation errors in android , we do not need to optimize this tool here;
Gprof introduction:
http://www.cnblogs.com/xuxm2007/archive/2012/02/28/2372057.html
2. Compile and install
1. Generate makefile _
Porting in the Android environment:
./configure --host=arm-linux-androideabi CC='arm-linux-androideabi-gcc --sysroot=/opt/android-ndk-r10b/platforms/android-9/arch-arm' CFLAGS=-static CXX='arm-linux-androideabi-g++ --sysroot=/opt/android-ndk-r10b/platforms/android-9/arch-arm' CXXFLAGS=-static --prefix=/usr/local/iperf3.1.3
Transplanting under the HiSilicon cross compiler environment:
./configure --host=arm-hisiv100nptl-linux CFLAGS=-static CXXFLAGS=-static --prefix=/usr/local/iperf3.1.3
Porting in X86 environment:
./configure CFLAGS=-static CXXFLAGS=-static --prefix=/usr/local/iperf3.1.3
Note: The function of -static is to compile the iperf3 tool and its dynamic library together, if not added, it must be used together with its dynamic library when using iperf3 ;
2. Compile and install
执行make distclean; make; make install;
3. Command use
Iperf is a network performance testing tool. Can test TCP and UDP bandwidth quality, can measure maximum TCP bandwidth, has various parameters and UDP characteristics, can report bandwidth, delay jitter and packet loss. Iperf has binary versions available for free use on both linux and windows platforms.
Iperf usage method and parameter description
Parameter Description
-s starts in server mode, eg : iperf -s
-c host starts in client mode, host is the server address, eg : iperf -c 222.35.11.23
General parameters
-f [kmKM] means to display the report in Kbits, Mbits, KBytes, MBytes respectively , the default unit is Mbits , eg : iperf -c 222.35.11.23 -f K
-i sec Display report interval in seconds, eg : iperf -c 222.35.11.23 -i 2
-l buffer size, the default is 8KB, eg : iperf -c 222.35.11.23 -l 16
-m display tcp maximum mtu value
-o outputs report and error messages to a file eg : iperf -c 222.35.11.23 -o ciperflog.txt
-p specifies the port used by the server or the port connected by the client eg : iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999
-u use udp protocol
-w specifies the TCP window size, the default is 8KB
-B bind a host address or interface (use this parameter when the host has multiple addresses or interfaces)
-C is compatible with the old version (used when the server and client versions are different)
-M sets the maximum mtu value of TCP packets
-N set TCP no delay
-V Transmit ipv6 packets
Server- specific parameters
-D Run iperf as a service , eg : iperf -s -D
-R stops the iperf service, for -D , eg : iperf -s -R
Client- side specific parameters
-d Simultaneous bidirectional transmission test
-n specifies the number of bytes transferred, eg : iperf -c 222.35.11.23 -n 100000
-r for two-way transmission test alone
-t test time, the default is 10 seconds , eg : iperf -c 222.35.11.23 -t 5
-F specifies the file to be transferred
-T specifies the ttl value
Applications
Use the iperf -s command to start Iperf in server mode, and use iperf -c to start client mode on the client .
iperf –s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
iperf -c 59.128.103.56
The above is tested using the default settings of the server and client
iperf -s -w 300K
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 300 KByte
------------------------------------------------------------
iperf -c 59.128.103.56 -f K -i 2 -w 300K
Set the report interval to 2 seconds, and open the TCP windows of both the server and the client to 300KB
iperf -c 59.128.103.56 -f K -i 2 -w 300K –n 1000000
The test transfers about 1MB of data
iperf -c 59.128.103.56 -f K -i 2 -w 300K –t 36
The test lasts 36 seconds
iperf -c 59.128.103.56 -f K -i 2 -w 300K -n 10400000 –d
Test two-way transmission
iperf -c 59.128.103.56 -f K -i 2 -w 300K –u
UDP test
Among them, the meaning of the -i parameter is the periodic report interval ( interval ), in seconds; in the above example, it means that information such as bandwidth is reported every 2 seconds.
Note: The command description is a reprinted article: http://blog.sina.com.cn/s/blog_49ab2ae20100cnig.html