flow monitor

543 views
Skip to first unread message

Amir Reda

unread,
Apr 7, 2014, 10:07:09 AM4/7/14
to ns-3-...@googlegroups.com
dear all
i want make a flow monitor for my network i need it to begin at a certain time and monitor packets of certain size 1000

this part of code where m_dataStart is the time when flow monitor begin

  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor;

  monitor-> Start (Seconds (m_dataStart));

  monitor = flowmon.InstallAll();

i have tried to use
monitor -> m_packetsizebin = 1000; to monitor the packet size but it was private

so how can i do both conditions

--
Warmest regards and best wishes for a good health,urs sincerely
mero

Konstantinos

unread,
Apr 7, 2014, 11:06:12 AM4/7/14
to ns-3-...@googlegroups.com
Hi,

There is an Attribute for PacketSizeBin in FlowMonitor class which can be set as any other attribute
  • PacketSizeBinWidth: The width used in the packetSize histogram.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 20
    • Flags: construct write read

Amir Reda

unread,
Apr 7, 2014, 2:32:59 PM4/7/14
to ns-3-...@googlegroups.com
dear sir
thanks for your reply, here is the code i wrote and it gives me an error i think there are no reason for it


  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor;

  Config::SetDefault ("ns3::FlowMonitor::StartTime",TimeValue (Seconds (m_dataStart)));
  Config::SetDefault ("ns3::FlowMonitor::PacketSizeBinWidth", DoubleValue (1000));
 //Print per flow statistics
  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 iter = stats.begin (); iter != stats.end (); ++iter)
    {
  Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);
       std::cout << "Time: "<< Simulator :: Now() <<"Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress;
      std::cout << "Tx Packets = " << iter->second.txPackets;
      std::cout << "Rx Packets = " << iter->second.rxPackets;
      std::cout << "Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024  << " Kbps";
    }

  monitor = flowmon.InstallAll();


  Simulator::Stop (Seconds (m_totalTime));
  AnimationInterface anim ("aerorp.xml");

  Simulator::Run ();
  monitor->SerializeToXmlFile("aerorp.flowmon", true, true);

  Simulator::Destroy ();

the error is
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Trace file generated is AeroRP_2Nodes_100SimTime.tr
Creating 2 anNodes.
[node 1] [Time 0]AeroRPRoutingProtocol:NotifyAddAddress(0x80c6a20,  interface , 1,  address , m_local=10.1.1.1; m_mask=255.255.255.0; m_broadcast=10.1.1.255; m_scope=2; m_secondary=0)
[node 1] [Time 0]AeroRPRoutingProtocol:NotifyInterfaceUp(0x80c6a20, 10.1.1.1)
[node 2] [Time 0]AeroRPRoutingProtocol:NotifyAddAddress(0x80c7578,  interface , 1,  address , m_local=10.1.1.2; m_mask=255.255.255.0; m_broadcast=10.1.1.255; m_scope=2; m_secondary=0)
[node 2] [Time 0]AeroRPRoutingProtocol:NotifyInterfaceUp(0x80c7578, 10.1.1.2)
[node 0] [Time 0]AeroRPRoutingProtocol:NotifyAddAddress(0x80c8348,  interface , 1,  address , m_local=10.1.1.3; m_mask=255.255.255.0; m_broadcast=10.1.1.255; m_scope=2; m_secondary=0)
[node 0] [Time 0]AeroRPRoutingProtocol:NotifyInterfaceUp(0x80c8348, 10.1.1.3)
[node 0] [Time 0]AeroRPRoutingProtocol:Start(0x80c8348)
[node 1] [Time 0]AeroRPRoutingProtocol:Start(0x80c6a20)
[node 2] [Time 0]AeroRPRoutingProtocol:Start(0x80c7578)

Starting simulation for 100 s ...

Program received signal SIGSEGV, Segmentation fault.
0xb7b552d4 in ns3::Time::Time (this=0xbfffe878, o=...) at ./ns3/nstime.h:175
175        : m_data (o.m_data)
(gdb) backtrace
#0  0xb7b552d4 in ns3::Time::Time (this=0xbfffe878, o=...)
    at ./ns3/nstime.h:175
#1  0xb6bcf9f3 in ns3::FlowMonitor::CheckForLostPackets (this=0x0)
    at ../src/flow-monitor/model/flow-monitor.cc:305
#2  0x0805bb69 in AeroRPSimulation::CaseRun (this=0xbfffedb8, nWifis=2,
    nSinks=1, totalTime=100, rate=..., phyMode=..., nodeSpeed=1200,
    dataStart=30, printRoutes=true, CSVfileName=...)
    at ../scratch/aero2dtest.cc:310
#3  0x0805a987 in main (argc=1, argv=0xbffff054)
    at ../scratch/aero2dtest.cc:192
(gdb)

any way the function  CheckForLostPackets() doesn't receive any arg the flow monitor has 2 func with the name CheckForLostPackets () one has no arg which i use and the other one receive time arg

so how can i solve this prblem




--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, 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/d/optout.

Tommaso Pecorella

unread,
Apr 7, 2014, 4:55:52 PM4/7/14
to ns-3-...@googlegroups.com, amir...@msn.com
#1  0xb6bcf9f3 in ns3::FlowMonitor::CheckForLostPackets (this=0x0)

You used an invalid pointer.

T.
Reply all
Reply to author
Forward
0 new messages