Help In Flow Monitor

347 views
Skip to first unread message

Hadi

unread,
Jul 12, 2013, 7:08:14 AM7/12/13
to ns-3-...@googlegroups.com
Hi All,
Thank you for reading my post. 
I am trying to calculate the overall throughput for ad hoc wireless network (no access point is being used) I studied the flow monitor and I understand it now and I understand the following commands:
#include "ns3/flow-monitor-helper.h"
#include "ns3/flow-monitor-module.h"

Ptr<FlowMonitor>    mon;
FlowMonitorHelper flowhelp;
mon->SetAttribute("DelayBinWidth", DoubleValue(0.001));
mon->SetAttribute("JitterBinWidth", DoubleValue(0.001));
mon->SetAttribute("PacketSizeBinWidth", DoubleValue(20));
mon = flowhelp.InstallAll();

but the problem now that I cant find a documentation for the flow monitor that explains it in more detail so we can use it to find the throughput.

for example I cant understand the following lines :


// Calculate Throughput using Flowmonitor
//
  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll();
//
// Now, do the actual simulation.
//
  NS_LOG_INFO ("Run Simulation.");
  Simulator::Stop (Seconds(11.0));
  Simulator::Run ();

  monitor->CheckForLostPackets ();

  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
    {
	  Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
      if ((t.sourceAddress=="10.1.1.1" && t.destinationAddress == "10.1.2.2"))
      {
          std::cout << "Flow " << i->first  << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
          std::cout << "  Tx Bytes:   " << i->second.txBytes << "\n";
          std::cout << "  Rx Bytes:   " << i->second.rxBytes << "\n";
      	  std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / (i->second.timeLastRxPacket.GetSeconds() - i->second.timeFirstTxPacket.GetSeconds())/1024/1024  << " Mbps\n";
      }
     }
 
monitor->SerializeToXmlFile("lab-1.flowmon", true, true);


So please Help me and any one can show me the way in studying the flow monitor.
Thank you a lot.

doy

unread,
Jul 15, 2013, 2:03:27 AM7/15/13
to ns-3-...@googlegroups.com

hadi kasasbeh

unread,
Jul 15, 2013, 11:21:04 AM7/15/13
to ns-3-...@googlegroups.com
Thank you a lot Doy....wish you the best.......:)


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/eW2tC9UcwQU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages