Measuring Tools and Scripts » History » Version 4

Version 3 (Cuadro, Juan Pablo, 12/14/2014 03:07 AM) → Version 4/19 (Cuadro, Juan Pablo, 12/14/2014 03:08 AM)

h1. Measuring Tools

-----

h2. EL470

The Newtec EL470 versions that Telecom Bretagne owns have no protocol testing capabilities. However, when in ACM mode, the ACM controller (the HUB) keeps a log file containing the modulation and coding schemes as well as bitrate and Es/N0 estimates . This is information is stored in a .csv file containing the following:

<pre>
Timestamp,Demod,RqModCod,EsNo,CarrierBitrate
2014-12-12 15:05:19,1,16APSK-2/3,11.20,1445835
2014-12-12 15:05:24,1,16APSK-2/3,10.72,1324072
2014-12-12 15:05:28,1,16APSK-2/3,10.61,1324072
2014-12-12 15:05:31,1,16APSK-2/3,10.66,1324072
2014-12-12 15:05:34,1,8PSK-3/4,10.19,1313479
2014-12-12 15:05:37,1,8PSK-3/4,11.87,1313479
2014-12-12 15:05:41,1,8PSK-3/4,10.40,1313479
2014-12-12 15:06:47,1,QPSK-5/6,6.93,884389
2014-12-12 15:06:51,1,QPSK-5/6,8.18,884389
2014-12-12 15:06:56,1,QPSK-5/6,7.02,825503
</pre>

It is unclear though what the logging frequency is. We have determined that this rate depends on the rate at which Es/N0 estimates change. From the csv file we can extract the following information:

* Timestamp (in seconds)
* Modcod parameter (modulation + coding rate)
* Estimate of E ~s~ / N ~0~
* Information bitrate (in bps)

h2. Traffic generation and capture

In order to measure performance at the application level we will use _Iperf_. _Iperf_ is a tool to generate streams of TCP and UDP traffic as well as measuring throughput and other statistics. It has a client and server functionality, and can measure the throughput between the two ends. In order to have a finer control over the values obtained, we will capture all traffic using _tcpdump_ and perform an offline calculation of throughput using pcaptput.py.

notice. We will generate a UDP data stream in order to test throughput.

To setup Iperf we will have to launch it on both the HUB PC (as client) and Station PC (as server). Since the HUB PC will be the one sending packets it has to be setup as a server. Likewise, the Station PC must be setup as a server.

<pre><code class="Terminal">
# STATION PC LISTENING ON PORT 5201

$ iperf -s -u -i1 -p 5201
------------------------------------------------------------
Server listening on UDP port 5201
Receiving 1470 byte datagrams
UDP buffer size: 192 KByte (default)
------------------------------------------------------------
</code></pre>

<pre><code class="Terminal">
# HUB PC STARTS UDP DATA STREAM DES_PORT = 5201

$ iperf -c 10.0.0.130 -u -t <duration in secs> -b <bandwidth> -l <udp size> -p 5201
------------------------------------------------------------
Client connecting to 10.0.0.130, UDP port 5201
Sending <udp size> byte datagrams
UDP buffer size: 9.00 KByte (default)
------------------------------------------------------------
</code></pre>

At the same time the Station PC must capture all incoming traffic, we will use the following command:

<pre><code class="Terminal">
# CAPTURE INCOMING TRAFFIC
$ tcpdump -w output_file_name.pcap
</code></pre>

h1. Scripts

-----

In order to process obtained data we have created multiple scripts to parse and display results. Please download (), inside you will find measurements taken in the course of this project as well as well as the follwoing scripts:

* *pcaptput.py* : Calculates throughput metrics from .pcap file.
* *bulk_pcaptput* : Bash script to run pcaptput.py on all data and generate .tput files.
* *ConsolidateRun.m* : MATLAB class to import and consolidate .pcap as well as .tput data.
* *bulk_consolidate_results.m* : MATLAB script to generate all graphs in this wiki.

There is also README for further clarification.

h2. pcaptput.py

_pcaptput.py_ is a small python script we wrote in order to calculate application (UDP) throughput as well as layer 3 end-to-end throughput considering only IP packets (header + payload). It uses the "dpkt":http://code.google.com/p/dpkt/. library which is a "fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols" Python library.

<pre><code class="Python">
#!/usr/bin/python2.6

# pcaptput.py

import sys, dpkt
if len(sys.argv) != 2:
raise ValueError('.pcap file needs to be specified.')

filename = sys.argv[1];
udpPort = 5201
tRes = 1
periodn = 0
baseTimeStamp = 0
iter = 0
# Total IP packet counter
ipBitCount = 0
# UDP payload counter
udpBitCount = 0
print 'Time[s]', 'IP-Throughput[bps]', 'UDP-Throughput[bps]'
for timeStamp, buf in dpkt.pcap.Reader(open(filename, 'r')):
iter += 1
if iter == 1:
baseTimeStamp = timeStamp
# Get ethernet frame
eth = dpkt.ethernet.Ethernet(buf)
# Check for pure IP traffic only (no ARP packets)
if type(eth.data) != dpkt.ip.IP:
continue
ip = eth.data
ts = timeStamp - baseTimeStamp
# Histogram bins
if ts >= periodn * tRes:
print periodn * tRes, ipBitCount / tRes, udpBitCount / tRes
periodn += 1
udpBitCount = 0
ipBitCount = 0
# Counters
ipBitCount += ip.len * 8
if isinstance(ip.data, dpkt.udp.UDP) and (udpPort == ip.data.dport):
udpBitCount += ip.data.ulen * 8
</code></pre>

Usage is as follows:

<pre><code class="Terminal">
$ ./pcaptput.py input.pcap > output.tput
</code></pre>

<pre><code class="Terminal">
Time[s] IP-Throughput[bps] UDP-Throughput[bps]
0 0 0
1 4688 0
2 3984 96
3 754720 742944
4 775552 763872
5 860544 847584
6 903040 889440
7 1019904 1004544
8 1083648 1067328
9 1221760 1203360
10 1296128 1276608
11 903040 889440
12 764928 753408
13 807424 795264
14 860544 847584
15 956160 941760
16 988032 973152
</code></pre>

Which leads to the following output: