help how can i extract data from xml file generated by flow monitor
and plot the values on gnuplot say flow no Vs throughput
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.
// Print per flow statistics
//This is after Simulator::Run() and assuming monitor is Ptr<FlowMonitor> monitor = flowmon.InstallAll();
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); NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress); NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets); NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets); NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024 << " Kbps"); }
Thank you so much Konstantinos for your example. It is really helpful.
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/5IMn1v3dvKkJ.
Okay thanks for this
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/6iP8GUZ7tVcJ.
Hi!I tried to probe the code of Konstantino in my LTE scenario and I have the following exception:assert failed. cond="cur->tid != tag.GetInstanceTypeId ()", file=../src/network/model/packet-tag-list.cc, line=139 terminate called without an active exception
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/Au0qHsLczx8J.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.
NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress);
..
}
will print only the flows that the IP address of the source is 10.10.10.10
Similarly, you can control it for destination IPs, ports etc.
Konstantinos I get this output when I run the code i dont know what is wrong can you help me please | set terminal png | set output 'FlowVSThroughput.png' | set title 'Flow vs Throughput' | set xlabel 'Flow' | set ylabel 'Throughput' | plot '-' title 'Throughput' with linespoints | e |
// Print per flow statistics
monitor->CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>
(flowmon_helper.GetClassifier ());
std::map< FlowId, FlowMonitor::FlowStats > stats = monitor->GetFlowStats ();
double Throughput=0.0;
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter =
stats.begin (); iter != stats.end (); ++iter)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);
NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " <<
t.sourceAddress << " Dst Addr " << t.destinationAddress);
NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets);
Throughput=iter->second.rxBytes * 8.0 /
(iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds())
/ 1024;
//NS_LOG_UNCOND("Throughput: " << Throughput << " Kbps");
dataset.Add((double)iter->first,(double) Throughput);
}
NS_LOG_UNCOND("Done");
//Gnuplot ...continued
gnuplot.AddDataset (dataset);
// Open the plot file.
ofstream plotFile (plotFileName.c_str());
// Write the plot file.
gnuplot.GenerateOutput (plotFile);
// Close the plot file.
plotFile.close ();
Simulator::Destroy ();
}
Hi Anthony,
Therey is no need to parse the XML file, even no need to create one if you don't.
You can aceess the flowmonitor data within your simulation script.
Here is an example:
// Print per flow statistics
//This is after Simulator::Run() and assuming monitor is Ptr<FlowMonitor> monitor = flowmon.InstallAll();
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); NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress); NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets); NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets); NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024 << " Kbps"); }
So you will have in the output the FlowID with any information you want.
Then you can pipe the output to a file. You can also select cetrain Flows to print and not everything (eg. only data traffic and not the broadcast signalling messages)
On Tuesday, 24 December 2013 at 11:33, asmae ahoudi wrote:
hi, i'm new in using ns3.i want to calculate end to end delay using flow monitor, so i've got an xml file which i read with excel,this file contains different flow id , so how can i calculate the e2e delay. i search in this mailling list and i've got this formuledelay=delaysum/rxpackets (i didn't undertsand it)2.did we must calculate the average for all flow id ??please i need your answer.
Hi Anthony,
Therey is no need to parse the XML file, even no need to create one if you don't.
You can aceess the flowmonitor data within your simulation script.
Here is an example:
// Print per flow statistics
//This is after Simulator::Run() and assuming monitor is Ptr<FlowMonitor> monitor = flowmon.InstallAll();
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); NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress); NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets); NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets); NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024 << " Kbps"); }
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
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/teE-cTfkV_Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/5a56d23e-262b-432f-bfc9-d8c956df8973n%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/CAOKoa9GxR0VQWpgDYD9aah_0V-YSNFT2pLDQX6o1aU6W%2BZQCyA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/CAA-66m2pvdO7mUKPuGxsinWCbORtbNBuWcLBDxou%2BWBy24ro%3DA%40mail.gmail.com.