1.2.1.14.1 Using Iperf
Iperf is a networking tool that helps to measure networking bandwidth and performance. The Iperf module can act as both a client and server for testing. Iperf has the ability to test both UDP and TCP. In the case of UDP, you can specify the size of the UDP datagrams. For TCP, Iperf measures the throughput of the payload.
To run Iperf, you will need a personal computer that has an Iperf application installed. There is an open source version that is maintained, as well as many other variants across the Internet.
Iperf is meant to be run on the command line. On the MPLAB Harmony TCP/IP Stack device side, there is also a built-in command console that can accept your different Iperf settings from a system console, such as the UART.
Iperf measures performance data in a unidirectional format. Therefore, the side that the server is running on is considered the receiver, and provides the most accurate performance values
iperf [ -s|-c <IP addr> ]
[ -u ]
[ -i <sec> ]
[ -b <bandwidth> ]
[ -t <time> ]
-s Runs the Iperf server. No IP address needs to be specified.
-c <IP addr> Runs the Iperf client. The IP address is the IP address of the server.
-u Sends UDP datagrams.
-i <sec> Specified the time interval, in seconds, that the display will be updated.
-b <bandwidth> Specifies the amount of data to try and send. This option is only valid with UDP datagrams.
-t <time> Amount of time, in seconds, to run the test.
To get a reasonable maximum benchmark/evaluation data for a device target, it is recommended to disable other modules, such as HTTP, client example, server example, etc., and find a uncongested network.
Running the Demonstration
- First, make sure the Iperf module and the System Console are enabled in your project.
- Then, rebuild and program your project into target board.
- After powering on the development board and associating the connected network, start the server side Iperf application first. If you start Iperf as a server on the development board in the console, this implies that you are trying to measure the device Ethernet receiver performance. If you start the Iperf server on a personal computer, you will be measuring MCHP device Ethernet transmit performance.
Iperf Running Example
The following tests show receiver and transmitter performance, respectively with the following settings:
- TCP TX and RX Socket Size = 512
- UDP TX and RX Socket Size = 512
- Built by MPLAB XC32 C/C++ Compiler without any optimization
- Personal Computer IP Address: 172.16.175.86
- Device IP Address: 172.16.175.54
Device under test as UDP server (receive):
- Command on the device: iperf -s -u -i 1
- Command on personal computer: iperf -c 172.16.175.54 -b 10M -i 1 -t 5
Personal computer as UDP server (device transmit)
- Command on personal computer: iperf -s -u -i 1
- Command on the device: iperf -c 172.16.175.86 -b 50M -i 1 -t 5
Device as TCP server (receiving):
- Command on the device under test: iperf -s -i 1
- Command on personal computer: iperf -c 172.16.175.54 -i 1 -t 5
Personal computer as TCP server (device transmit):
- Command on personal computer: iperf -s -i 1
- Command on the device: iperf -c 172.16.175.86 -x 10M -i 1 -t 5