1.1 --- a/examples/flowmon.py Tue May 05 19:05:46 2009 +0100
1.2 +++ b/examples/flowmon.py Tue May 05 19:06:25 2009 +0100
1.3 @@ -99,6 +99,9 @@
1.4 flowmon_helper = ns3.FlowMonitorHelper()
1.5 #flowmon_helper.SetMonitorAttribute("StartTime", ns3.TimeValue(ns3.Seconds(31)))
1.6 monitor = flowmon_helper.InstallAll()
1.7 + monitor.SetAttribute("DelayBinWidth", ns3.DoubleValue(0.001))
1.8 + monitor.SetAttribute("JitterBinWidth", ns3.DoubleValue(0.001))
1.9 + monitor.SetAttribute("PacketSizeBinWidth", ns3.DoubleValue(20))
1.10
1.11 ns3.Simulator.Stop(ns3.Seconds(44.0))
1.12 if cmd.Viz is not None:
1.13 @@ -116,8 +119,12 @@
1.14 if st.rxPackets > 0:
1.15 print >> os, " Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets)
1.16 print >> os, " Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1
1.17 - for i in st.delayHistogram.GetSize ():
1.18 - print >> os, " Bin[", st.delayHistogram.GetBinStart (i), "-", st.delayHistogram.GetBinEnd (i), "]: ", st.delayHistogram.GetBinCount (i)
1.19 + print >> os, "Delay Histogram"
1.20 + for i in range(st.delayHistogram.GetSize () ):
1.21 + print >> os, " ",i,"(", st.delayHistogram.GetBinStart (i), "-", st.delayHistogram.GetBinEnd (i), "): ", st.delayHistogram.GetBinCount (i)
1.22 + print >> os, "PacketSize Histogram"
1.23 + for i in range(st.packetSizeHistogram.GetSize () ):
1.24 + print >> os, " ",i,"(", st.packetSizeHistogram.GetBinStart (i), "-", st.packetSizeHistogram.GetBinEnd (i), "): ", st.packetSizeHistogram.GetBinCount (i)
1.25
1.26 monitor.CheckForLostPackets()
1.27 classifier = flowmon_helper.GetClassifier()
2.1 --- a/src/contrib/flow-monitor/flow-monitor.cc Tue May 05 19:05:46 2009 +0100
2.2 +++ b/src/contrib/flow-monitor/flow-monitor.cc Tue May 05 19:06:25 2009 +0100
2.3 @@ -47,10 +47,18 @@
2.4 TimeValue (Seconds (0.0)),
2.5 MakeTimeAccessor (&FlowMonitor::Start),
2.6 MakeTimeChecker ())
2.7 - /*.AddAttribute ("HistogramBinWidth", ("The width used in the histograms."),
2.8 - DoubleValue (1.0),
2.9 - MakeDoubleAccessor (&FlowMonitor::m_histogramBinWidth),
2.10 - MakeDoubleChecker ())*/
2.11 + .AddAttribute ("DelayBinWidth", ("The width used in the delay histogram."),
2.12 + DoubleValue (0.001),
2.13 + MakeDoubleAccessor (&FlowMonitor::m_delayBinWidth),
2.14 + MakeDoubleChecker <double> ())
2.15 + .AddAttribute ("JitterBinWidth", ("The width used in the jitter histogram."),
2.16 + DoubleValue (0.001),
2.17 + MakeDoubleAccessor (&FlowMonitor::m_jitterBinWidth),
2.18 + MakeDoubleChecker <double> ())
2.19 + .AddAttribute ("PacketSizeBinWidth", ("The width used in the packetSize histogram."),
2.20 + DoubleValue (20),
2.21 + MakeDoubleAccessor (&FlowMonitor::m_packetSizeBinWidth),
2.22 + MakeDoubleChecker <double> ())
2.23 ;
2.24 return tid;
2.25 }
2.26 @@ -64,7 +72,7 @@
2.27 FlowMonitor::FlowMonitor ()
2.28 : m_enabled (false)
2.29 {
2.30 - m_histogramBinWidth=DEFAULT_BIN_WIDTH;
2.31 + // m_histogramBinWidth=DEFAULT_BIN_WIDTH;
2.32 }
2.33
2.34
2.35 @@ -83,6 +91,9 @@
2.36 ref.rxPackets = 0;
2.37 ref.lostPackets = 0;
2.38 ref.timesForwarded = 0;
2.39 + ref.delayHistogram.SetBinWidth(m_delayBinWidth);
2.40 + ref.jitterHistogram.SetBinWidth(m_jitterBinWidth);
2.41 + ref.packetSizeHistogram.SetBinWidth(m_packetSizeBinWidth);
2.42 return ref;
2.43 }
2.44 else
3.1 --- a/src/contrib/flow-monitor/flow-monitor.h Tue May 05 19:05:46 2009 +0100
3.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Tue May 05 19:06:25 2009 +0100
3.3 @@ -110,7 +110,9 @@
3.4 EventId m_startEvent;
3.5 EventId m_stopEvent;
3.6 bool m_enabled;
3.7 - double m_histogramBinWidth;
3.8 + double m_delayBinWidth;
3.9 + double m_jitterBinWidth;
3.10 + double m_packetSizeBinWidth;
3.11
3.12 FlowStats& GetStatsForFlow (FlowId flowId);
3.13 void PeriodicCheckForLostPackets ();
4.1 --- a/src/contrib/flow-monitor/histogram.cc Tue May 05 19:05:46 2009 +0100
4.2 +++ b/src/contrib/flow-monitor/histogram.cc Tue May 05 19:06:25 2009 +0100
4.3 @@ -84,6 +84,8 @@
4.4 }
4.5
4.6 if (m_histogram[index] == 0) m_numberBins++;
4.7 + /*std::cout << "vou adicionar o valor " << value << " no index " << index << std::endl;
4.8 + std::cout << "o GetBinWidth= " << GetBinWidth(0) << std::endl;*/
4.9 m_histogram[index]++;
4.10 }
4.11