Network Response Time Measurement (NRTM)
The Network Response Time Measurement (NRTM) tool measures an Ethernet frame's round-trip time (RTT) through a reflector. If the time spent in the reflector is negligible, the measured RTT provides a good approximation of the latency accumulated across these layers on a given machine:
- The NL2
- The NIC driver
- The NIC hardware
NRTM can be used in three modes:
- Raw Ethernet: In this mode, NRTM sends raw Ethernet frames and expects the reflector to send back identical Ethernet frames. The reflector can be an external machine running an echo server program at the Ethernet layer (see the RawReflector sample), or, preferably, the NIC hardware if configured in a MAC Loopback test mode.
- UDP: In this mode, NRTM sends UDP packets on a given port and expects the reflector to return those UDP packets. Note that NRTM does not use the TCP/IP Stack. It creates the transmitted UDP packets. See the UdpReflector sample for a UDP Echo server example. The UDP mode is less efficient than the Raw Ethernet mode because the UDP reflector generally introduces much more latency and jitter. However, in some environments where Raw Ethernet mode is not possible, UDP mode is the only workable solution to estimate network latency.
- EtherCAT: In this mode, NRTM sends EtherCAT request packets and expects the reflector (an EtherCAT SubDevice) to process them and send back EtherCAT response packets. Note that NRTM does not use the EtherCAT Stack, it creates the transmitted EtherCAT packets. This mode is the most efficient because the introduced latency is extremely low (a few nanoseconds) and deterministic. The drawback is that it requires an EtherCAT SubDevice and supports only 100 Mbps connections.
Command Line Arguments
The first argument passed to the NRTM application is the name of the network interface to use, followed by command arguments chosen from the options below:
/physical
Uses the Physical Queue API (default).
/logical
Uses the Logical Queue API instead of the default Physical Queue API.
/raw
Uses the Raw Ethernet mode (default).
/udp
Uses the UDP mode instead of the default Raw Ethernet mode.
/ecat
Uses the EtherCAT mode instead of the default Raw Ethernet mode.
/duration <number>
Specifies the duration of the test, in seconds. The default value is 1.
/txq <number>
Specifies the index of the Transmit Queue to use. The default value is 0.
/rxq <number>
Specifies the index of the Receive Queue to use. The default value is 0.
/pktlen <number>
Specifies the length of the transmitted packets, in bytes, including the 14-byte Ethernet header but excluding the 4-byte FCS. The default value is 60.
/mac <macaddress>
Specifies the Destination MAC Address to use. This is only relevant in Raw Ethernet mode. The default value is broadcast.
/destip <ipaddress>
Specifies the Destination IP Address to use. This is only relevant in UDP mode.
/srcip <ipaddress>
Specifies the Source IP Address to use. This is only relevant in UDP mode.
/destport <number>
Specifies the Destination UDP Port to use. This is only relevant in UDP mode.
/srcport <number>
Specifies the Source UDP Port to use. This is only relevant in UDP mode.
Example
At the end of the measurement period, NRTM prints a report as a histogram. The following is an example of the output generated by this command: rtssrun Nrtm I226 /ecat /physical
Nrtm.rtss: Using EtherCAT packet: 48 bytes (2 commands)
Waiting for the Physical Tx Queue to be ready...
Physical Tx Queue is ready.
Nrtm.rtss: Starting Network Response Time Measurements with Physical Queue API. Packet length = 60. Test duration = 1s
| 0 - | 16 us: | 0 |
| 17 - | 18 us: | 43944 |
| 18 - | 19 us: | 9094 |
| 19 - | 20 us: | 945 |
| 20 - | 21 us: | 4 |
| 21 - | 22 us: | 2 |
| 22 - | 23 us: | 4 |
| 23 - | 24 us: | 1 |
| 24 - | 25 us: | 2 |
| 25 - | 26 us: | 7 |
| 26 - | 27 us: | 4 |
| 27 - | 28 us: | 3 |
| 28 - | 29 us: | 2 |
| 29 - | 30 us: | 3 |
| 30 - | 1000 us: | 0 |
Statistics based on 54015 RTT measurements:
min=17.411us, avg=17.853us, max=29.872us