Performance Measurement (Get the Packet Delay)
[Description]
When we use iperf, we can easily get the throughput. But not for packet end-to-end delay. So I will show another method to get the delay
[Topology]
H1---(1ms delay)----S1---(1ms delay)----H2
[mininet script]
|
#!/usr/bin/env python from mininet.cli
import CLI from mininet.net import Mininet from mininet.link
import Link,TCLink,Intf from mininet.node
import RemoteController if '__main__' == __name__:
net = Mininet(link=TCLink)
h1 = net.addHost('h1')
h2 = net.addHost('h2')
s1 = net.addSwitch('s1')
c0 = net.addController('c0',
controller=Controller, ip='127.0.0.1', port=6633)
linkopts0=dict(bw=20,
delay='1ms', loss=0)
net.addLink(h1, s1, cls=TCLink, **linkopts0)
net.addLink(s1, h2, cls=TCLink, **linkopts0)
net.build()
c0.start()
s1.start([c0])
CLI(net) net.stop() |
[Execution]

Use the following command at the sender and receiver to capture packets sent and received. (check https://www.tcpdump.org/tcpdump_man.html for tcpdump parameters)

Here we use iperf to transmit packets from h1 to h2

After transmitting, we can get “sent” and “received” files. The contents of “sent” or “received” are something like
|
1523169506.233021 ARP, Ethernet (len 6), IPv4 (len 4), Request
who-has 10.0.0.2 tell 10.0.0.1, length 28 1523169506.243542 IP (tos
0x0, ttl 64, id 11325, offset 0, flags [DF], proto
UDP (17), length 1498) 10.0.0.1.43143 >
10.0.0.2.5001: UDP, length 1470 1523169506.352674 IP (tos
0x0, ttl 64, id 11344, offset 0, flags [DF], proto
UDP (17), length 1498) 10.0.0.1.43143 > 10.0.0.2.5001: UDP,
length 1470 1523169506.469647 IP (tos
0x0, ttl 64, id 11355, offset 0, flags [DF], proto
UDP (17), length 1498) 10.0.0.1.43143 >
10.0.0.2.5001: UDP, length 1470 1523169506.587640 IP (tos
0x0, ttl 64, id 11378, offset 0, flags [DF], proto
UDP (17), length 1498) 10.0.0.1.43143 >
10.0.0.2.5001: UDP, length 1470 1523169506.704671 IP (tos
0x0, ttl 64, id 11388, offset 0, flags [DF], proto
UDP (17), length 1498) 10.0.0.1.43143 > 10.0.0.2.5001: UDP, length 1470 …………………………………………………………………………………………. |
Now we need to get the packet sent (or received) time and IP identification from these two files.

Before combining the sent and received files, we need to sort the sent and received file.
![]()
Then combined these two files.
![]()
cat combined. (The first column is id, the second is sent time, and the third is received time)

Add the line number and get the end-to-end delay
![]()


Dr. Chih-Heng Ke (smallko@gmail.com)
Department of Computer Science and
Information Engineering,
National Quemoy
University, Kinmen, Taiwan.