Merge.
1.1 --- a/bindings/python/ns3_module_flow_monitor.py Tue May 05 18:16:31 2009 +0100
1.2 +++ b/bindings/python/ns3_module_flow_monitor.py Tue May 05 18:17:27 2009 +0100
1.3 @@ -19,6 +19,8 @@
1.4 module.add_class('FlowMonitor', parent=root_module['ns3::Object'])
1.5 ## flow-monitor.h: ns3::FlowMonitor::FlowStats [struct]
1.6 module.add_class('FlowStats', outer_class=root_module['ns3::FlowMonitor'])
1.7 + ## histogram.h: ns3::Histogram [class]
1.8 + module.add_class('Histogram', parent=root_module['ns3::Object'])
1.9 module.add_container('std::map< unsigned int, ns3::FlowProbe::FlowStats >', ('unsigned int', 'ns3::FlowProbe::FlowStats'), container_type='map')
1.10 module.add_container('std::map< unsigned int, ns3::FlowMonitor::FlowStats >', ('unsigned int', 'ns3::FlowMonitor::FlowStats'), container_type='map')
1.11 typehandlers.add_type_alias('uint32_t', 'ns3::FlowPacketId')
1.12 @@ -73,6 +75,7 @@
1.13 register_Ns3Ipv4FlowProbe_methods(root_module, root_module['ns3::Ipv4FlowProbe'])
1.14 register_Ns3FlowMonitor_methods(root_module, root_module['ns3::FlowMonitor'])
1.15 register_Ns3FlowMonitorFlowStats_methods(root_module, root_module['ns3::FlowMonitor::FlowStats'])
1.16 + register_Ns3Histogram_methods(root_module, root_module['ns3::Histogram'])
1.17 return
1.18
1.19 def register_Ns3FlowClassifier_methods(root_module, cls):
1.20 @@ -260,6 +263,49 @@
1.21 cls.add_constructor([])
1.22 return
1.23
1.24 +def register_Ns3Histogram_methods(root_module, cls):
1.25 + ## histogram.h: ns3::Histogram::Histogram(ns3::Histogram const & arg0) [copy constructor]
1.26 + cls.add_constructor([param('ns3::Histogram const &', 'arg0')])
1.27 + ## histogram.h: static ns3::TypeId ns3::Histogram::GetTypeId() [member function]
1.28 + cls.add_method('GetTypeId',
1.29 + 'ns3::TypeId',
1.30 + [],
1.31 + is_static=True)
1.32 + ## histogram.h: ns3::TypeId ns3::Histogram::GetInstanceTypeId() const [member function]
1.33 + cls.add_method('GetInstanceTypeId',
1.34 + 'ns3::TypeId',
1.35 + [],
1.36 + is_const=True, is_virtual=True)
1.37 + ## histogram.h: ns3::Histogram::Histogram() [constructor]
1.38 + cls.add_constructor([])
1.39 + ## histogram.h: void ns3::Histogram::SetBinWidth(double binWidth) [member function]
1.40 + cls.add_method('SetBinWidth',
1.41 + 'void',
1.42 + [param('double', 'binWidth')])
1.43 + ## histogram.h: uint32_t ns3::Histogram::GetNBins() const [member function]
1.44 + cls.add_method('GetNBins',
1.45 + 'uint32_t',
1.46 + [],
1.47 + is_const=True)
1.48 + ## histogram.h: double ns3::Histogram::GetBinStart(uint32_t index) [member function]
1.49 + cls.add_method('GetBinStart',
1.50 + 'double',
1.51 + [param('uint32_t', 'index')])
1.52 + ## histogram.h: double ns3::Histogram::GetBinWidth(uint32_t index) const [member function]
1.53 + cls.add_method('GetBinWidth',
1.54 + 'double',
1.55 + [param('uint32_t', 'index')],
1.56 + is_const=True)
1.57 + ## histogram.h: uint32_t ns3::Histogram::GetBinCount(uint32_t index) [member function]
1.58 + cls.add_method('GetBinCount',
1.59 + 'uint32_t',
1.60 + [param('uint32_t', 'index')])
1.61 + ## histogram.h: void ns3::Histogram::AddHistogramValue(double value) [member function]
1.62 + cls.add_method('AddHistogramValue',
1.63 + 'void',
1.64 + [param('double', 'value')])
1.65 + return
1.66 +
1.67 def register_functions(root_module):
1.68 module = root_module
1.69 register_functions_ns3_Config(module.get_submodule('Config'), root_module)
2.1 --- a/src/contrib/flow-monitor/design.txt Tue May 05 18:16:31 2009 +0100
2.2 +++ b/src/contrib/flow-monitor/design.txt Tue May 05 18:17:27 2009 +0100
2.3 @@ -37,7 +37,7 @@
2.4 1. Configurable time when to start/stop monitor. ***DONE***
2.5 2. Possibly, detect packet losses also via "drop" trace sources
2.6 3. FlowMonitor::FlowStats: add time duration metrics: first flow timestamp, last flow timestamp
2.7 - > to calculate bitrates...
2.8 + > to calculate bitrates... ***DONE***
2.9 4. Measure delay jitter
2.10 5. Histogram for delays/jitters/packet sizes
2.11
3.1 --- a/src/contrib/flow-monitor/flow-monitor.h Tue May 05 18:16:31 2009 +0100
3.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Tue May 05 18:17:27 2009 +0100
3.3 @@ -73,6 +73,7 @@
3.4 void ReportForwarding (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
3.5 void ReportLastRx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
3.6
3.7 +
3.8 /// Check right now for packets that appear to be lost
3.9 void CheckForLostPackets ();
3.10 void CheckForLostPackets (Time maxDelay);
4.1 --- a/src/devices/wifi/wifi-remote-station-manager.cc Tue May 05 18:16:31 2009 +0100
4.2 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Tue May 05 18:17:27 2009 +0100
4.3 @@ -659,8 +659,10 @@
4.4 uint32_t
4.5 WifiRemoteStation::GetFragmentOffset (Ptr<const Packet> packet, uint32_t fragmentNumber)
4.6 {
4.7 +#ifdef NS3_ASSERT_ENABLE
4.8 uint32_t nFragment = GetNFragments (packet);
4.9 NS_ASSERT (fragmentNumber < nFragment);
4.10 +#endif
4.11 uint32_t fragmentOffset = fragmentNumber * GetManager ()->GetFragmentationThreshold ();
4.12 return fragmentOffset;
4.13 }
5.1 --- a/src/internet-stack/ipv4-l3-protocol.cc Tue May 05 18:16:31 2009 +0100
5.2 +++ b/src/internet-stack/ipv4-l3-protocol.cc Tue May 05 18:17:27 2009 +0100
5.3 @@ -18,6 +18,8 @@
5.4 // Author: George F. Riley<riley@ece.gatech.edu>
5.5 //
5.6
5.7 +//#define NS_LOG_APPEND_CONTEXT if (GetObject<Node> ()) { std::clog << "[node " << GetObject<Node> ()->GetId () << "] "; }
5.8 +
5.9 #include "ns3/packet.h"
5.10 #include "ns3/log.h"
5.11 #include "ns3/callback.h"
5.12 @@ -242,7 +244,7 @@
5.13 rprotoIter != m_routingProtocols.end ();
5.14 rprotoIter++)
5.15 {
5.16 - NS_LOG_LOGIC ("Requesting route");
5.17 + NS_LOG_LOGIC ("Requesting route for IP header: " << ipHeader);
5.18 if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet,
5.19 routeReply))
5.20 return;
5.21 @@ -276,6 +278,7 @@
5.22 //
5.23 // No route found
5.24 //
5.25 + NS_LOG_LOGIC ("No route found for IP header: " << ipHeader);
5.26 routeReply (false, Ipv4Route (), packet, ipHeader);
5.27 }
5.28
5.29 @@ -623,8 +626,13 @@
5.30 {
5.31 if (found)
5.32 {
5.33 + NS_LOG_LOGIC ("Route found for IP header: " << ipHeader << ": " << route);
5.34 m_sendOutgoingTrace (ipHeader, packet, route.GetInterface ());
5.35 }
5.36 + else
5.37 + {
5.38 + NS_LOG_LOGIC ("No route found for IP header: " << ipHeader);
5.39 + }
5.40 SendRealOut (found, route, packet, ipHeader);
5.41 }
5.42
5.43 @@ -636,8 +644,13 @@
5.44 {
5.45 if (found)
5.46 {
5.47 + NS_LOG_LOGIC ("Route found for IP header: " << ipHeader << ": " << route);
5.48 m_forwardTrace (ipHeader, packet, route.GetInterface ());
5.49 }
5.50 + else
5.51 + {
5.52 + NS_LOG_LOGIC ("No route found for IP header: " << ipHeader);
5.53 + }
5.54 SendRealOut (found, route, packet, ipHeader);
5.55 }
5.56
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/utils/flowmon/bench-all.py Tue May 05 18:17:27 2009 +0100
6.3 @@ -0,0 +1,116 @@
6.4 +import subprocess
6.5 +import sys
6.6 +import resource
6.7 +from optparse import OptionParser
6.8 +import time
6.9 +import re
6.10 +import tempfile
6.11 +import os
6.12 +from xml.dom import minidom
6.13 +
6.14 +DATA_LIMIT = None
6.15 +CPU_LIMIT = None
6.16 +
6.17 +
6.18 +
6.19 +def run_sim(args):
6.20 + argv = ['python', 'flowmon-bench.py'] + args
6.21 +
6.22 + results_fname = tempfile.mktemp(prefix='results', suffix='.xml')
6.23 + argv.append("--Results=%s" % results_fname)
6.24 +
6.25 + print >> sys.stderr, "popen ", repr(argv)
6.26 + start_time = time.time()
6.27 +
6.28 + def preexec_fn(*dummy_args):
6.29 + resource.setrlimit(resource.RLIMIT_DATA, (DATA_LIMIT, -1))
6.30 + resource.setrlimit(resource.RLIMIT_AS, (DATA_LIMIT, -1))
6.31 + resource.setrlimit(resource.RLIMIT_CPU, (CPU_LIMIT, -1))
6.32 + proc = subprocess.Popen(argv, preexec_fn=preexec_fn)
6.33 + max_mem = 0
6.34 + while 1:
6.35 + if proc.poll() is not None:
6.36 + break
6.37 + time.sleep(1.0)
6.38 + mem = int(open("/proc/%i/statm" % proc.pid, "rt").read().split()[0])*4
6.39 + if mem > max_mem:
6.40 + max_mem = mem
6.41 + retval = proc.wait()
6.42 + end_time = time.time()
6.43 +
6.44 + if retval:
6.45 + raise RuntimeError("Simulation exited with code %i.\t" % (retval,))
6.46 +
6.47 + if os.path.exists(results_fname):
6.48 + results = minidom.parse(results_fname)
6.49 + os.unlink(results_fname)
6.50 + else:
6.51 + results = None
6.52 +
6.53 + return max_mem, (end_time - start_time), results
6.54 +
6.55 +
6.56 +def main():
6.57 +
6.58 + parser = OptionParser()
6.59 + parser.add_option("-j", None, dest="concurrency", default="2",
6.60 + help="Number of tasks to run in parallel")
6.61 + parser.add_option("-c", "--cpu-limit", dest="cpu_limit", default="5",
6.62 + help="CPU limit, in hours")
6.63 + parser.add_option("-m", "--memory-limit", dest="mem_limit", default="detect",
6.64 + help="Memory limit, total, in GigaBytes. "
6.65 + "Actual per-process memory limit will be this value divided"
6.66 + " by the concurrency level setting.")
6.67 + parser.add_option("-s", "--stop-time", dest="stop_time", default="300",
6.68 + help="Simulation stop time (s)")
6.69 + (options, args) = parser.parse_args()
6.70 +
6.71 + global CPU_LIMIT, DATA_LIMIT
6.72 + CPU_LIMIT = long(float(options.cpu_limit)*60*60)
6.73 +
6.74 + if options.mem_limit == 'detect':
6.75 + for line in file("/proc/meminfo"):
6.76 + m = re.match("MemTotal:\s+(\d+) kB", line)
6.77 + if m:
6.78 + DATA_LIMIT = 1024*long(m.group(1))
6.79 + print >> sys.stderr, "Detected DATA_LIMIT = ", DATA_LIMIT, "(%s GiB)" % (DATA_LIMIT/1024.0/1024.0/1024.0)
6.80 + break
6.81 + else:
6.82 + print >> sys.stderr, "Could not detect DATA_LIMIT => fallback to 512 MB."
6.83 + DATA_LIMIT = long(float(0.5)*1024*1024*1024)
6.84 + else:
6.85 + DATA_LIMIT = long(float(options.mem_limit)*1024*1024*1024)
6.86 + DATA_LIMIT /= int(int(options.concurrency)*1.25)
6.87 + print >> sys.stderr, "Per-process data limit: %.3f GiB (%r)" % (DATA_LIMIT/1024.0/1024.0/1024.0, DATA_LIMIT)
6.88 +
6.89 + newdoc = minidom.getDOMImplementation().createDocument(None, "flowmon-bench-results", None)
6.90 + results_root_el = newdoc.documentElement
6.91 +
6.92 + for num_nodes_side in range(2,11):
6.93 + for run_number in range(10):
6.94 + for enable_monitor in [False, True]:
6.95 + args = ["--NumNodesSide=%i" % num_nodes_side,
6.96 + "--RunNumber=%i" % run_number,
6.97 + "--EnableMonitor=%i" % enable_monitor,
6.98 + "--StopTime=%s" % options.stop_time,
6.99 + ]
6.100 + max_mem, duration, results = run_sim(args)
6.101 + simulation_el = results_root_el.appendChild(newdoc.createElement('simulation'))
6.102 +
6.103 + simulation_el.setAttribute("num-nodes-side", str(num_nodes_side))
6.104 + simulation_el.setAttribute("run-number", str(run_number))
6.105 + simulation_el.setAttribute("enable-monitor", str(enable_monitor))
6.106 + simulation_el.setAttribute("max-memory", str(max_mem))
6.107 + simulation_el.setAttribute("cpu-time", str(duration))
6.108 +
6.109 + if enable_monitor:
6.110 + simulation_el.appendChild(results.documentElement.cloneNode(True))
6.111 +
6.112 + out = open("results.xml", "wt")
6.113 + newdoc.writexml(out, addindent=' ', newl='\n', encoding='utf-8')
6.114 + out.close()
6.115 +
6.116 +
6.117 +
6.118 +if __name__ == '__main__':
6.119 + main()
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/utils/flowmon/flowmon-bench.py Tue May 05 18:17:27 2009 +0100
7.3 @@ -0,0 +1,212 @@
7.4 +# -*- Mode: Python; -*-
7.5 +# Copyright (c) 2009 INESC Porto
7.6 +#
7.7 +# This program is free software; you can redistribute it and/or modify
7.8 +# it under the terms of the GNU General Public License version 2 as
7.9 +# published by the Free Software Foundation;
7.10 +#
7.11 +# This program is distributed in the hope that it will be useful,
7.12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
7.13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.14 +# GNU General Public License for more details.
7.15 +#
7.16 +# You should have received a copy of the GNU General Public License
7.17 +# along with this program; if not, write to the Free Software
7.18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7.19 +#
7.20 +# Authors: Gustavo Carneiro <gjc@inescporto.pt>
7.21 +
7.22 +import sys
7.23 +import ns3
7.24 +from xml.dom import minidom
7.25 +
7.26 +DISTANCE = 150 # (m)
7.27 +NUM_NODES_SIDE = 3
7.28 +
7.29 +
7.30 +def write_flowmon_results_to_file(file_name, flow_monitor, flow_classifier):
7.31 + results_file = open(file_name, "wb")
7.32 + domimpl = minidom.getDOMImplementation()
7.33 + doc = domimpl.createDocument(None, "flow-monitor", None)
7.34 + results = doc.documentElement
7.35 +
7.36 + flows_el = results.appendChild(doc.createElement('flows'))
7.37 +
7.38 + for flow_id, stats in flow_monitor.GetFlowStats():
7.39 + flow_el = flows_el.appendChild(doc.createElement('flow'))
7.40 + flow_el.setAttribute('flow-id', str(flow_id))
7.41 +
7.42 + #Time timeFirstTxPacket;
7.43 + flow_el.setAttribute("time-first-tx-packet", str(stats.timeFirstTxPacket))
7.44 +
7.45 + #Time timeFirstRxPacket;
7.46 + flow_el.setAttribute("time-first-rx-packet", str(stats.timeFirstRxPacket))
7.47 +
7.48 + #Time timeLastTxPacket;
7.49 + flow_el.setAttribute("time-last-tx-packet", str(stats.timeLastTxPacket))
7.50 +
7.51 + #Time timeLastRxPacket;
7.52 + flow_el.setAttribute("time-last-rx-packet", str(stats.timeLastRxPacket))
7.53 +
7.54 + #Time delaySum;
7.55 + flow_el.setAttribute("delay-sum", str(stats.delaySum))
7.56 +
7.57 + #uint64_t txBytes;
7.58 + flow_el.setAttribute("tx-bytes", str(stats.txBytes))
7.59 +
7.60 + #uint64_t rxBytes;
7.61 + flow_el.setAttribute("rx-bytes", str(stats.rxBytes))
7.62 +
7.63 + #uint32_t txPackets;
7.64 + flow_el.setAttribute("tx-packets", str(stats.txPackets))
7.65 +
7.66 + #uint32_t rxPackets;
7.67 + flow_el.setAttribute("rx-packets", str(stats.rxPackets))
7.68 +
7.69 + #uint32_t lostPackets;
7.70 + flow_el.setAttribute("lost-packets", str(stats.lostPackets))
7.71 +
7.72 + #uint32_t timesForwarded;
7.73 + flow_el.setAttribute("times-forwarded", str(stats.timesForwarded))
7.74 +
7.75 + # -- add ipv4 flow filtering information
7.76 + five_tuple = flow_classifier.FindFlow(flow_id)
7.77 + five_tuple_el = flow_el.appendChild(doc.createElement('five-tuple'))
7.78 + five_tuple_el.setAttribute("protocol", str(five_tuple.protocol))
7.79 + five_tuple_el.setAttribute("source-address", str(five_tuple.sourceAddress))
7.80 + five_tuple_el.setAttribute("destination-address", str(five_tuple.destinationAddress))
7.81 + five_tuple_el.setAttribute("source-port", str(five_tuple.sourcePort))
7.82 + five_tuple_el.setAttribute("destination-port", str(five_tuple.destinationPort))
7.83 +
7.84 + doc.writexml(results_file, addindent=' ', newl='\n', encoding='utf-8')
7.85 + results_file.close()
7.86 +
7.87 +
7.88 +def main(argv):
7.89 +
7.90 + cmd = ns3.CommandLine()
7.91 +
7.92 + cmd.Viz = None
7.93 + cmd.AddValue("Viz", "Enable visualizer")
7.94 +
7.95 + cmd.NumNodesSide = None
7.96 + cmd.AddValue("NumNodesSide", "Grid side number of nodes (total number of nodes will be this number squared)")
7.97 + cmd.AddValue("EnableMonitor", "Set to 0 or 1 to disable/enable flow monitoring")
7.98 + cmd.AddValue("RunNumber", "Run number (statistics)")
7.99 + cmd.AddValue("Results", "Write results to the given file")
7.100 + cmd.AddValue("StopTime", "Simulation stop time")
7.101 +
7.102 + cmd.Parse(argv)
7.103 +
7.104 + enable_monitor = int(cmd.EnableMonitor)
7.105 + run_number = int(cmd.RunNumber)
7.106 + if cmd.NumNodesSide is None:
7.107 + num_nodes_side = NUM_NODES_SIDE
7.108 + else:
7.109 + num_nodes_side = int(cmd.NumNodesSide)
7.110 +
7.111 +
7.112 + ns3.RandomVariable.UseGlobalSeed(1, 1, 2, 3, 5, 8)
7.113 + ns3.RandomVariable.SetRunNumber(run_number)
7.114 +
7.115 + p2p = ns3.PointToPointHelper()
7.116 + p2p.SetDeviceAttribute("DataRate", ns3.StringValue("5Mbps"))
7.117 + p2p.SetChannelAttribute("Delay", ns3.StringValue("2ms"))
7.118 +
7.119 + internet = ns3.InternetStackHelper()
7.120 + ipv4Addresses = ns3.Ipv4AddressHelper()
7.121 + ipv4Addresses.SetBase(ns3.Ipv4Address("10.0.0.0"), ns3.Ipv4Mask("255.255.255.255"))
7.122 +
7.123 + olsrHelper = ns3.OlsrHelper()
7.124 +
7.125 + port = 9 # Discard port(RFC 863)
7.126 + onOffHelper = ns3.OnOffHelper("ns3::UdpSocketFactory",
7.127 + ns3.Address(ns3.InetSocketAddress(ns3.Ipv4Address("10.0.0.1"), port)))
7.128 + onOffHelper.SetAttribute("DataRate", ns3.DataRateValue(ns3.DataRate("100kbps")))
7.129 + onOffHelper.SetAttribute("OnTime", ns3.RandomVariableValue(ns3.ConstantVariable(1)))
7.130 + onOffHelper.SetAttribute("OffTime", ns3.RandomVariableValue(ns3.ConstantVariable(0)))
7.131 +
7.132 + nodes = []
7.133 + for yi in range(num_nodes_side):
7.134 + nodes_row = []
7.135 + nodes.append(nodes_row)
7.136 + for xi in range(num_nodes_side):
7.137 +
7.138 + node = ns3.Node()
7.139 + nodes_row.append(node)
7.140 +
7.141 + internet.Install(ns3.NodeContainer(node))
7.142 +
7.143 + mobility = ns3.StaticMobilityModel()
7.144 + mobility.SetPosition(ns3.Vector(xi*DISTANCE, yi*DISTANCE, 0))
7.145 + node.AggregateObject(mobility)
7.146 +
7.147 + node_main_address = None
7.148 +
7.149 + if xi > 0:
7.150 + node_left = nodes[yi][xi-1]
7.151 + devices = p2p.Install(ns3.NodeContainer(ns3.NodeContainer(node), ns3.NodeContainer(node_left)))
7.152 + ipv4Addresses.Assign(devices)
7.153 +
7.154 + if yi > 0:
7.155 + node_above = nodes[yi-1][xi]
7.156 + devices = p2p.Install(ns3.NodeContainer(ns3.NodeContainer(node), ns3.NodeContainer(node_above)))
7.157 + ipv4Addresses.Assign(devices)
7.158 +
7.159 + def get_node_address(node):
7.160 + return node.GetObject(ns3.Ipv4.GetTypeId()).GetAddress(1)
7.161 +
7.162 +
7.163 + for yi, nodes_row in enumerate(nodes):
7.164 + for xi, node in enumerate(nodes_row):
7.165 + olsrHelper.Install(ns3.NodeContainer(node))
7.166 + destaddr = get_node_address(nodes[(yi-1)%num_nodes_side][(xi-1)%num_nodes_side])
7.167 + onOffHelper.SetAttribute("Remote", ns3.AddressValue(ns3.InetSocketAddress(destaddr, port)))
7.168 + app = onOffHelper.Install(ns3.NodeContainer(node))
7.169 + app.Start(ns3.Seconds(ns3.UniformVariable(20, 30).GetValue()))
7.170 +
7.171 +
7.172 + if enable_monitor:
7.173 + flowmon_helper = ns3.FlowMonitorHelper()
7.174 + flowmon_helper.SetMonitorAttribute("StartTime", ns3.TimeValue(ns3.Seconds(31)))
7.175 + monitor = flowmon_helper.InstallAll()
7.176 + classifier = flowmon_helper.GetClassifier()
7.177 +
7.178 + ns3.Simulator.Stop(ns3.Seconds(float(getattr(cmd, "StopTime", "100"))))
7.179 + if cmd.Viz is not None:
7.180 + import visualizer
7.181 + visualizer.start()
7.182 + else:
7.183 + ns3.Simulator.Run()
7.184 +
7.185 + def print_stats(os, monitor, classifier):
7.186 + def print_flow_stats(os, st):
7.187 + print >> os, " Tx Bytes: ", st.txBytes
7.188 + print >> os, " Rx Bytes: ", st.rxBytes
7.189 + print >> os, " Tx Packets: ", st.txPackets
7.190 + print >> os, " Rx Packets: ", st.rxPackets
7.191 + print >> os, " Lost Packets: ", st.lostPackets
7.192 + if st.rxPackets > 0:
7.193 + print >> os, " Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets)
7.194 + print >> os, " Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1
7.195 +
7.196 + monitor.CheckForLostPackets()
7.197 + for flow_id, flow_stats in monitor.GetFlowStats():
7.198 + t = classifier.FindFlow(flow_id)
7.199 + proto = {6: 'TCP', 17: 'UDP'} [t.protocol]
7.200 + print "FlowID: %i (%s %s/%s --> %s/%i)" % \
7.201 + (flow_id, proto, t.sourceAddress, t.sourcePort, t.destinationAddress, t.destinationPort)
7.202 + print_flow_stats(sys.stdout, flow_stats)
7.203 +
7.204 + if enable_monitor:
7.205 + if hasattr(cmd, "Results"):
7.206 + write_flowmon_results_to_file(cmd.Results, monitor, classifier)
7.207 + else:
7.208 + print_stats(sys.stdout, monitor, classifier)
7.209 +
7.210 + return 0
7.211 +
7.212 +
7.213 +if __name__ == '__main__':
7.214 + sys.exit(main(sys.argv))
7.215 +
8.1 Binary file utils/flowmon/results-2009-05-05.xml.bz2 has changed