1.1 --- a/bindings/python/ns3_module_flow_monitor.py Thu Apr 30 18:43:24 2009 +0100
1.2 +++ b/bindings/python/ns3_module_flow_monitor.py Thu Apr 30 19:02:46 2009 +0100
1.3 @@ -232,6 +232,14 @@
1.4 return
1.5
1.6 def register_Ns3FlowMonitorFlowStats_methods(root_module, cls):
1.7 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeFirstTxPacket [variable]
1.8 + cls.add_instance_attribute('timeFirstTxPacket', 'ns3::Time', is_const=False)
1.9 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeFirstRxPacket [variable]
1.10 + cls.add_instance_attribute('timeFirstRxPacket', 'ns3::Time', is_const=False)
1.11 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeLastTxPacket [variable]
1.12 + cls.add_instance_attribute('timeLastTxPacket', 'ns3::Time', is_const=False)
1.13 + ## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeLastRxPacket [variable]
1.14 + cls.add_instance_attribute('timeLastRxPacket', 'ns3::Time', is_const=False)
1.15 ## flow-monitor.h: ns3::FlowMonitor::FlowStats::delaySum [variable]
1.16 cls.add_instance_attribute('delaySum', 'ns3::Time', is_const=False)
1.17 ## flow-monitor.h: ns3::FlowMonitor::FlowStats::txBytes [variable]
2.1 --- a/src/contrib/flow-monitor/flow-monitor.cc Thu Apr 30 18:43:24 2009 +0100
2.2 +++ b/src/contrib/flow-monitor/flow-monitor.cc Thu Apr 30 19:02:46 2009 +0100
2.3 @@ -93,8 +93,9 @@
2.4 {
2.5 return;
2.6 }
2.7 + Time now = Simulator::Now ();
2.8 TrackedPacket &tracked = m_trackedPackets[std::make_pair (flowId, packetId)];
2.9 - tracked.firstSeenTime = Simulator::Now ();
2.10 + tracked.firstSeenTime = now;
2.11 tracked.lastSeenTime = tracked.firstSeenTime;
2.12 tracked.timesForwarded = 0;
2.13
2.14 @@ -103,6 +104,11 @@
2.15 FlowStats &stats = GetStatsForFlow (flowId);
2.16 stats.txBytes += packetSize;
2.17 stats.txPackets++;
2.18 + if (stats.txPackets == 1)
2.19 + {
2.20 + stats.timeFirstTxPacket = now;
2.21 + }
2.22 + stats.timeLastTxPacket = now;
2.23 }
2.24
2.25
2.26 @@ -145,13 +151,19 @@
2.27 return;
2.28 }
2.29
2.30 - Time delay = (Simulator::Now () - tracked->second.firstSeenTime);
2.31 + Time now = Simulator::Now ();
2.32 + Time delay = (now - tracked->second.firstSeenTime);
2.33 probe->AddPacketStats (flowId, packetSize, delay);
2.34
2.35 FlowStats &stats = GetStatsForFlow (flowId);
2.36 stats.delaySum += delay;
2.37 stats.rxBytes += packetSize;
2.38 stats.rxPackets++;
2.39 + if (stats.rxPackets == 1)
2.40 + {
2.41 + stats.timeFirstRxPacket = now;
2.42 + }
2.43 + stats.timeLastRxPacket = now;
2.44 stats.timesForwarded += tracked->second.timesForwarded;
2.45
2.46 m_trackedPackets.erase (tracked); // we don't need to track this packet anymore
3.1 --- a/src/contrib/flow-monitor/flow-monitor.h Thu Apr 30 18:43:24 2009 +0100
3.2 +++ b/src/contrib/flow-monitor/flow-monitor.h Thu Apr 30 19:02:46 2009 +0100
3.3 @@ -40,6 +40,10 @@
3.4
3.5 struct FlowStats
3.6 {
3.7 + Time timeFirstTxPacket;
3.8 + Time timeFirstRxPacket;
3.9 + Time timeLastTxPacket;
3.10 + Time timeLastRxPacket;
3.11 Time delaySum; // delayCount == rxPackets
3.12 uint64_t txBytes;
3.13 uint64_t rxBytes;