,

FlowMonitor for third.cc file in ns3

Flow monitor in ns3

third.cc 

See the video for full instruction and hands on


Step 1: 
Include the header

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

Step 2: 
include the follwing above the Simulator::Run()
// Flow monitor 
Ptr<FlowMonitor> flowMonitor;
FlowMonitorHelper flowHelper;
flowMonitor = flowHelper.InstallAll();

Include the following line after the Simulator::Run()

flowMonitor->SerializeToXmlFile("flowthird.xml", true, true);

$] ./waf --run scratch/third
thirdflow.xml

$] ./waf --run "scratch/third --nCsma=10 --nWifi=10"

We have done Step2: compilation


Step 3:
How to process .xml file

in ns3, there is a python file to rpocess the flowmonitor xml files.

copy the /home/pradeepkumar/ns-allinone-3.27/ns-3.27/src/flow-monitor/examples/flowmon-parse-results.py

Copy the file to ns-3.27/ or to the scratch/ folder.

To run this file

$] python scratch/flowmon-parse-results.py flowthird.xml
$] python scratch/flowmon-parse-results.py flowthirdex.xml

https://www.nsnam.com











6 comments: