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

(-)a/examples/routing/simple-global-routing.cc (-3 / +2 lines)
 Lines 149-159    Link Here 
149
  p2p.EnablePcapAll ("simple-global-routing");
149
  p2p.EnablePcapAll ("simple-global-routing");
150
150
151
  // Flow Monitor
151
  // Flow Monitor
152
  Ptr<FlowMonitor> flowmon;
153
  FlowMonitorHelper flowmonHelper;
152
  FlowMonitorHelper flowmonHelper;
154
  if (enableFlowMonitor)
153
  if (enableFlowMonitor)
155
    {
154
    {
156
      flowmon = flowmonHelper.InstallAll ();
155
      flowmonHelper.InstallAll ();
157
    }
156
    }
158
157
159
  NS_LOG_INFO ("Run Simulation.");
158
  NS_LOG_INFO ("Run Simulation.");
 Lines 163-169    Link Here 
163
162
164
  if (enableFlowMonitor)
163
  if (enableFlowMonitor)
165
    {
164
    {
166
      flowmon->SerializeToXmlFile ("simple-global-routing.flowmon", false, false);
165
      flowmonHelper.SerializeToXmlFile ("simple-global-routing.flowmon", false, false);
167
    }
166
    }
168
167
169
  Simulator::Destroy ();
168
  Simulator::Destroy ();
(-)a/examples/tcp/tcp-variants-comparison.cc (-3 / +2 lines)
 Lines 339-349    Link Here 
339
  LocalLink.EnablePcapAll("TcpVariantsComparison", true);
339
  LocalLink.EnablePcapAll("TcpVariantsComparison", true);
340
340
341
  // Flow monitor
341
  // Flow monitor
342
  Ptr<FlowMonitor> flowMonitor;
343
  FlowMonitorHelper flowHelper;
342
  FlowMonitorHelper flowHelper;
344
  if (flow_monitor)
343
  if (flow_monitor)
345
    {
344
    {
346
      flowMonitor = flowHelper.InstallAll();
345
      flowHelper.InstallAll();
347
    }
346
    }
348
347
349
  Simulator::Stop (Seconds(stop_time));
348
  Simulator::Stop (Seconds(stop_time));
 Lines 351-357    Link Here 
351
350
352
  if (flow_monitor)
351
  if (flow_monitor)
353
    {
352
    {
354
      flowMonitor->SerializeToXmlFile("TcpVariantsComparison.flowmonitor", true, true);
353
      flowHelper.SerializeToXmlFile("TcpVariantsComparison.flowmonitor", true, true);
355
    }
354
    }
356
355
357
  Simulator::Destroy ();
356
  Simulator::Destroy ();
(-)a/examples/wireless/multirate.cc (-3 / +2 lines)
 Lines 508-519    Link Here 
508
      phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
508
      phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
509
    }
509
    }
510
510
511
  Ptr<FlowMonitor> flowmon;
512
  FlowMonitorHelper flowmonHelper;
511
  FlowMonitorHelper flowmonHelper;
513
512
514
  if (enableFlowMon)
513
  if (enableFlowMon)
515
    {
514
    {
516
      flowmon = flowmonHelper.InstallAll ();
515
      flowmonHelper.InstallAll ();
517
    }
516
    }
518
517
519
  Simulator::Stop (Seconds (totalTime));
518
  Simulator::Stop (Seconds (totalTime));
 Lines 521-527    Link Here 
521
520
522
  if (enableFlowMon)
521
  if (enableFlowMon)
523
    {
522
    {
524
      flowmon->SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
523
      flowmonHelper.SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
525
    }
524
    }
526
525
527
  Simulator::Destroy ();
526
  Simulator::Destroy ();
(-)a/src/flow-monitor/helper/flow-monitor-helper.cc (+29 lines)
 Lines 145-149    Link Here 
145
  return m_flowMonitor;
145
  return m_flowMonitor;
146
}
146
}
147
147
148
void
149
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
150
{
151
  if (m_flowMonitor)
152
    {
153
      m_flowMonitor->SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
154
    }
155
}
156
157
std::string
158
FlowMonitorHelper::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
159
{
160
  std::ostringstream os;
161
  if (m_flowMonitor)
162
    {
163
      m_flowMonitor->SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
164
    }
165
  return os.str ();
166
}
167
168
void
169
FlowMonitorHelper::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
170
{
171
  if (m_flowMonitor)
172
    {
173
      m_flowMonitor->SerializeToXmlFile (fileName, enableHistograms, enableProbes);
174
    }
175
}
176
148
177
149
} // namespace ns3
178
} // namespace ns3
(-)a/src/flow-monitor/helper/flow-monitor-helper.h (+26 lines)
 Lines 86-91    Link Here 
86
   */
86
   */
87
  Ptr<FlowClassifier> GetClassifier6 ();
87
  Ptr<FlowClassifier> GetClassifier6 ();
88
88
89
  /**
90
   * Serializes the results to an std::ostream in XML format
91
   * \param os the output stream
92
   * \param indent number of spaces to use as base indentation level
93
   * \param enableHistograms if true, include also the histograms in the output
94
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
95
   */
96
  void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
97
98
  /**
99
   * Same as SerializeToXmlStream, but returns the output as a std::string
100
   * \param indent number of spaces to use as base indentation level
101
   * \param enableHistograms if true, include also the histograms in the output
102
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
103
   * \return the XML output as string
104
   */
105
  std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
106
107
  /**
108
   * Same as SerializeToXmlStream, but writes to a file instead
109
   * \param fileName name or path of the output file that will be created
110
   * \param enableHistograms if true, include also the histograms in the output
111
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
112
   */
113
  void SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes);
114
89
private:
115
private:
90
  /**
116
  /**
91
   * \brief Copy constructor
117
   * \brief Copy constructor

Return to bug 1842