ns3: Flow Monitor Module Part4 - 2 - Kasetsart Universityanan/myhomepage/wp-content/uploads/...Flow...

Post on 28-Sep-2020

7 views 0 download

transcript

Intelligent Wireless Network Group Department of Computer Engineering Faculty of Engineering, Kasetsart University http://iwing.cpe.ku.ac.th

Friday, 14 Sep 2013, 18:00 - 21:00

By Dr. Aphirak Jansang

ns3: Flow Monitor Module Part4 - 2

1

“FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

Resource

2

Flow Monitor Architecture

3 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

Flow Monitor Data Structures

4 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

Node A, Node B and Node C are installed the Flow Monitor framework

Per-probe flow statistics

5 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

timeFirstTxPacket, timeLastTxPacket begin and end times of the flow from the point of view of the sender

timeFirstRxPacket, timeLastRxPacket begin and end times of the flow from the point of view of the receiver

delaySum, jitterSum sum of delay and jitter values

txBytes, txPackets number of transmitted bytes and packets

rxBytes, rxPackets number of received bytes and packets

lostPackets number of definitely lost packets

timesForwarded the number of times a packet has been

reportedly forwarded, summed for all packets in the flow

FlowMonitor::FlowStats Attributes

6 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

delayHistogram, jitterHistogram, packetSizeHistogram

Histogram versions for the delay, jitter, and packet sizes, respectively

packetsDropped, bytesDropped discriminates the losses by a reason code

DROP NO ROUTE no IPv4 route found for a packet

DROP TTL EXPIRE a packet was dropped due to an IPv4 TTL field decremented and reaching zero

DROP BAD CHECKSUM a packet had a bad IPv4header checksum and had to be dropped

FlowMonitor::FlowStats Attributes

7 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

Performance Metrics Calculation

8 *From “FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3)”, Gustavo Carneiro, Pedro Fortuna and Manuel Ricardo.

Task: study impact of number of clients on average throughput with flowmon

Experiment setup

2-14 mobile clients

UDP CBR stream

512 Kbps per client

Packet size: 512 bytes

Walk-Through Example V (1)

9

Create mythird2.cc from mythird4-flowmon.cc

Modify the source so that OnOff application is installed on all WiFi stations

Change the line:

to

Walk-Through Example V (2)

10

$ cp scratch/mythird2.cc scratch/mythird4-flowmon.cc

ApplicationContainer apps = onoff.Install(wifiStaNodes);

ApplicationContainer apps = onoff.Install(wifiStaNodes.Get(nWifi-1));

Adding Flow Monitor include file

Installing Flow Monitor module to all nodes before Simulator::Run();

Walk-Through Example V (3)

11

FlowMonitorHelper flowmon;

Ptr<FlowMonitor> monitor = flowmon.InstallAll ();

Simulator::Run();

#include "ns3/flow-monitor-module.h"

Extract statistical result after Simulator::Run();

Walk-Through Example V (4)

12

Simulator::Run();

monitor->CheckForLostPackets ();

Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>

flowmon.GetClassifier());

std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

uint64_t bytesTotal = 0;

double lastRxTime=-1;

double firstRxTime=-1;

for (std::map<FlowId,FlowMonitor::FlowStats>::const_iterator i=stats.begin();i!=stats.end();

++i)

{

if (firstRxTime < 0)

firstRxTime = i->second.timeFirstRxPacket.GetSeconds();

else if (firstRxTime > i->second.timeFirstRxPacket.GetSeconds() )

firstRxTime = i->second.timeFirstRxPacket.GetSeconds();

if (lastRxTime < i->second.timeLastRxPacket.GetSeconds() )

lastRxTime = i->second.timeLastRxPacket.GetSeconds();

bytesTotal = bytesTotal + i->second.rxBytes;

}

Find 1st packet arrival time

Find last packet arrival

time

Report the number of WiFi stations in addition to the average throughput

Run the simulation script

Walk-Through Example V (5)

13

Simulator::Run();

.

.

.

std::cout << "Num clients = " << nWifi << " "

<< "Avg throughput = "

<< bytesTotal*8/(lastRxTime-firstRxTime)/1024

<< " kbits/sec" << std::endl;

.

.

.

Simulator::Destroy();

Study impact of number of mobile stations to packet delivery ratio

Hands-on Exercise

14