View | Details | Raw Unified | Return to bug 1983
Collapse All | Expand All

(-)a/examples/wireless/wifi-hidden-terminal.cc (-1 / +1 lines)
 Lines 149-155    Link Here 
149
  // 10. Print per flow statistics
149
  // 10. Print per flow statistics
150
  monitor->CheckForLostPackets ();
150
  monitor->CheckForLostPackets ();
151
  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
151
  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
152
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
152
  FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats ();
153
  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
153
  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
154
    {
154
    {
155
      // first 2 FlowIds are for ECHO apps, we don't want to display them
155
      // first 2 FlowIds are for ECHO apps, we don't want to display them
(-)a/src/flow-monitor/model/flow-monitor.cc (-6 / +6 lines)
 Lines 107-113    Link Here 
107
inline FlowMonitor::FlowStats&
107
inline FlowMonitor::FlowStats&
108
FlowMonitor::GetStatsForFlow (FlowId flowId)
108
FlowMonitor::GetStatsForFlow (FlowId flowId)
109
{
109
{
110
  std::map<FlowId, FlowStats>::iterator iter;
110
  FlowStatsContainerI iter;
111
  iter = m_flowStats.find (flowId);
111
  iter = m_flowStats.find (flowId);
112
  if (iter == m_flowStats.end ())
112
  if (iter == m_flowStats.end ())
113
    {
113
    {
 Lines 282-288    Link Here 
282
    }
282
    }
283
}
283
}
284
284
285
std::map<FlowId, FlowMonitor::FlowStats>
285
const FlowMonitor::FlowStatsContainer&
286
FlowMonitor::GetFlowStats () const
286
FlowMonitor::GetFlowStats () const
287
{
287
{
288
  return m_flowStats;
288
  return m_flowStats;
 Lines 300-307    Link Here 
300
      if (now - iter->second.lastSeenTime >= maxDelay)
300
      if (now - iter->second.lastSeenTime >= maxDelay)
301
        {
301
        {
302
          // packet is considered lost, add it to the loss statistics
302
          // packet is considered lost, add it to the loss statistics
303
          std::map<FlowId, FlowStats>::iterator
303
          FlowStatsContainerI flow = m_flowStats.find (iter->first.first);
304
            flow = m_flowStats.find (iter->first.first);
305
          NS_ASSERT (flow != m_flowStats.end ());
304
          NS_ASSERT (flow != m_flowStats.end ());
306
          flow->second.lostPackets++;
305
          flow->second.lostPackets++;
307
306
 Lines 341-347    Link Here 
341
  m_flowProbes.push_back (probe);
340
  m_flowProbes.push_back (probe);
342
}
341
}
343
342
344
std::vector< Ptr<FlowProbe> >
343
344
const FlowMonitor::FlowProbeContainer&
345
FlowMonitor::GetAllProbes () const
345
FlowMonitor::GetAllProbes () const
346
{
346
{
347
  return m_flowProbes;
347
  return m_flowProbes;
 Lines 408-414    Link Here 
408
  indent += 2;
408
  indent += 2;
409
  INDENT (indent); os << "<FlowStats>\n";
409
  INDENT (indent); os << "<FlowStats>\n";
410
  indent += 2;
410
  indent += 2;
411
  for (std::map<FlowId, FlowStats>::const_iterator flowI = m_flowStats.begin ();
411
  for (FlowStatsContainerCI flowI = m_flowStats.begin ();
412
       flowI != m_flowStats.end (); flowI++)
412
       flowI != m_flowStats.end (); flowI++)
413
    {
413
    {
414
414
(-)a/src/flow-monitor/model/flow-monitor.h (-4 / +20 lines)
 Lines 211-226    Link Here 
211
  void CheckForLostPackets (Time maxDelay);
211
  void CheckForLostPackets (Time maxDelay);
212
212
213
  // --- methods to get the results ---
213
  // --- methods to get the results ---
214
215
  /// Container: FlowId, FlowStats
216
  typedef std::map<FlowId, FlowStats> FlowStatsContainer;
217
  /// Container Iterator: FlowId, FlowStats
218
  typedef std::map<FlowId, FlowStats>::iterator FlowStatsContainerI;
219
  /// Container Const Iterator: FlowId, FlowStats
220
  typedef std::map<FlowId, FlowStats>::const_iterator FlowStatsContainerCI;
221
  /// Container: FlowProbe
222
  typedef std::vector< Ptr<FlowProbe> > FlowProbeContainer;
223
  /// Container Iterator: FlowProbe
224
  typedef std::vector< Ptr<FlowProbe> >::iterator FlowProbeContainerI;
225
  /// Container Const Iterator: FlowProbe
226
  typedef std::vector< Ptr<FlowProbe> >::const_iterator FlowProbeContainerCI;
227
214
  /// Retrieve all collected the flow statistics.  Note, if the
228
  /// Retrieve all collected the flow statistics.  Note, if the
215
  /// FlowMonitor has not stopped monitoring yet, you should call
229
  /// FlowMonitor has not stopped monitoring yet, you should call
216
  /// CheckForLostPackets() to make sure all possibly lost packets are
230
  /// CheckForLostPackets() to make sure all possibly lost packets are
217
  /// accounted for.
231
  /// accounted for.
218
  /// \returns the flows statistics
232
  /// \returns the flows statistics
219
  std::map<FlowId, FlowStats> GetFlowStats () const;
233
  const FlowStatsContainer& GetFlowStats () const;
220
234
221
  /// Get a list of all FlowProbe's associated with this FlowMonitor
235
  /// Get a list of all FlowProbe's associated with this FlowMonitor
222
  /// \returns a list of all the probes
236
  /// \returns a list of all the probes
223
  std::vector< Ptr<FlowProbe> > GetAllProbes () const;
237
  const FlowProbeContainer& GetAllProbes () const;
224
238
225
  /// Serializes the results to an std::ostream in XML format
239
  /// Serializes the results to an std::ostream in XML format
226
  /// \param os the output stream
240
  /// \param os the output stream
 Lines 228-239    Link Here 
228
  /// \param enableHistograms if true, include also the histograms in the output
242
  /// \param enableHistograms if true, include also the histograms in the output
229
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
243
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
230
  void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
244
  void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
245
231
  /// Same as SerializeToXmlStream, but returns the output as a std::string
246
  /// Same as SerializeToXmlStream, but returns the output as a std::string
232
  /// \param indent number of spaces to use as base indentation level
247
  /// \param indent number of spaces to use as base indentation level
233
  /// \param enableHistograms if true, include also the histograms in the output
248
  /// \param enableHistograms if true, include also the histograms in the output
234
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
249
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
235
  /// \return the XML output as string
250
  /// \return the XML output as string
236
  std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
251
  std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
252
237
  /// Same as SerializeToXmlStream, but writes to a file instead
253
  /// Same as SerializeToXmlStream, but writes to a file instead
238
  /// \param fileName name or path of the output file that will be created
254
  /// \param fileName name or path of the output file that will be created
239
  /// \param enableHistograms if true, include also the histograms in the output
255
  /// \param enableHistograms if true, include also the histograms in the output
 Lines 257-269    Link Here 
257
  };
273
  };
258
274
259
  /// FlowId --> FlowStats
275
  /// FlowId --> FlowStats
260
  std::map<FlowId, FlowStats> m_flowStats;
276
  FlowStatsContainer m_flowStats;
261
277
262
  /// (FlowId,PacketId) --> TrackedPacket
278
  /// (FlowId,PacketId) --> TrackedPacket
263
  typedef std::map< std::pair<FlowId, FlowPacketId>, TrackedPacket> TrackedPacketMap;
279
  typedef std::map< std::pair<FlowId, FlowPacketId>, TrackedPacket> TrackedPacketMap;
264
  TrackedPacketMap m_trackedPackets; //!< Tracked packets
280
  TrackedPacketMap m_trackedPackets; //!< Tracked packets
265
  Time m_maxPerHopDelay; //!< Minimum per-hop delay
281
  Time m_maxPerHopDelay; //!< Minimum per-hop delay
266
  std::vector< Ptr<FlowProbe> > m_flowProbes; //!< all the FlowProbes
282
  FlowProbeContainer m_flowProbes; //!< all the FlowProbes
267
283
268
  // note: this is needed only for serialization
284
  // note: this is needed only for serialization
269
  std::list<Ptr<FlowClassifier> > m_classifiers; //!< the FlowClassifiers
285
  std::list<Ptr<FlowClassifier> > m_classifiers; //!< the FlowClassifiers

Return to bug 1983