1.1 --- a/examples/flowmon.py Wed Apr 29 15:27:15 2009 +0100
1.2 +++ b/examples/flowmon.py Wed Apr 29 15:39:19 2009 +0100
1.3 @@ -49,6 +49,7 @@
1.4 port = 9 # Discard port(RFC 863)
1.5 onOffHelper = ns3.OnOffHelper("ns3::UdpSocketFactory",
1.6 ns3.Address(ns3.InetSocketAddress(ns3.Ipv4Address("10.0.0.1"), port)))
1.7 + onOffHelper.SetAttribute("DataRate", ns3.DataRateValue(ns3.DataRate("100kbps")))
1.8 onOffHelper.SetAttribute("OnTime", ns3.RandomVariableValue(ns3.ConstantVariable(1)))
1.9 onOffHelper.SetAttribute("OffTime", ns3.RandomVariableValue(ns3.ConstantVariable(0)))
1.10
1.11 @@ -84,8 +85,10 @@
1.12 monitor = flowmon_helper.InstallAll()
1.13
1.14 ns3.Simulator.Stop(ns3.Seconds(44.0))
1.15 - #visualizer.start()
1.16 - ns3.Simulator.Run()
1.17 + if 0:
1.18 + visualizer.start()
1.19 + else:
1.20 + ns3.Simulator.Run()
1.21
1.22 def print_stats(os, st):
1.23 print >> os, " Tx Bytes: ", st.txBytes
1.24 @@ -94,8 +97,8 @@
1.25 print >> os, " Rx Packets: ", st.rxPackets
1.26 print >> os, " Lost Packets: ", st.lostPackets
1.27 if st.rxPackets > 0:
1.28 - print >> os, " Mean(Delay): ", (st.delaySum.GetSeconds() / st.rxPackets)
1.29 - print >> os, " Mean(Hop Count): ", float(st.timesForwarded) / st.rxPackets + 1
1.30 + print >> os, " Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets)
1.31 + print >> os, " Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1
1.32
1.33 monitor.CheckForLostPackets()
1.34 for flow_id, flow_stats in monitor.GetFlowStats():