Discard Routing Packets from flowmonitor

23 views
Skip to first unread message

OverPowered

unread,
Aug 10, 2017, 12:03:34 AM8/10/17
to ns-3-users
Hi,
 i have flow monitor code which is.
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll(); 

Simulator::Run ();
monitor->CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

float txPacketsum = 0,
rxPacketsum = 0,
DropPacketsum = 0,
LostPacketsum = 0,
Delaysum = 0,
txBytessum = 0, 
rxBytessum = 0, 
First = 1,
s1 = 2.5,
dp = 0;

  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator stats = flowStats.begin();
             stats != flowStats.end(); ++stats) {
            tempThroughput = stats->second.rxBytes * 8.0 / (stats->second.timeLastRxPacket.GetSeconds() -
                                                            stats->second.timeFirstTxPacket.GetSeconds()) / 1024;
            delay = stats->second.delaySum.GetSeconds();
            pdr = stats->second.txPackets / stats->second.rxPackets;

            dataset.Add((double) stats->first, (double) tempThroughput);
            dataset2.Add((double) stats->first, (double) delay);
            dataset3.Add((double) stats->first, (double) pdr);

        }


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

txBytessum += i->second.txBytes;
txPacketsum += i->second.txPackets;
rxPacketsum += i->second.rxPackets;
rxBytessum += i->second.rxBytes;
LostPacketsum += i->second.lostPackets;
DropPacketsum += i->second.packetsDropped.size();
Delaysum += i->second.delaySum.GetSeconds();
dataset.Add(First, ((rxBytessum * 8.0) / 1000) );
dp = i->second.txPackets - i->second.rxPackets - i->second.lostPackets;
First = i->first * s1;

}

plot.AddDataset (dataset);
plot2.AddDataset (dataset2);
plot3.AddDataset (dataset3);

std::cout << "\n\t ----------------RESULT-------------------\n\n ";
std::cout << "\t  All Tx Packets: " << txPacketsum << "\n";
std::cout << "\t  All Tx Bytes: " << txBytessum << "\n";
std::cout << "\t  All Rx Packets: " << rxPacketsum << "\n";
std::cout << "\t  All Rx Bytes: " << rxBytessum << "\n";
std::cout << "\t  All Lost Packets: " << LostPacketsum << "\n";
std::cout << "\t  All Drop Packets: " << dp << "\n";
std::cout << "\t  All Drop Bytes: " << DropPacketsum << "\n";
std::cout << "\t  Total Delay: " << Delaysum << "\n";
std::cout << "\t  Delay per Packet: " << Delaysum / txPacketsum << "\n";
std::cout << "\t  Packets Delivery Ratio: " << ((rxPacketsum * 100) / txPacketsum) << "%" << "\n";
std::cout << "\t  Throughput: " << (rxBytessum * 8.0) / 1024    << " Kbps\n";
std::cout << "\n" << endl;
std::cout << "\n\t ----------------THANKS-------------------\n\n\n ";

this code also count AODV. DSDV, OLSR packets also, which i dont want.
how can i discard routing packets.


Thanks 
Regards
V

Reply all
Reply to author
Forward
Message has been deleted
0 new messages