Bug 1842 - FlowMonitor SerializeToXml<Something> should be called by the helper

This commit is contained in:
Tommaso Pecorella
2014-03-17 19:34:43 +01:00
parent 19e595c09f
commit 1ff598b75c
6 changed files with 64 additions and 9 deletions

View File

@@ -29,6 +29,8 @@ New user-visible features
``ns3::CqaFfMacScheduler`` object.
- SixLowPan model can now use uncompressed IPv6 headers. An option to
define the minimum compressed packet size has been added.
- FlowMonitor "SerializeToXml" functions are now directly available
from the Helper.
Bugs fixed
----------
@@ -43,6 +45,7 @@ Bugs fixed
- Bug 1837 - AODV crashes when using multiple interfaces
- Bug 1838 - FlowMonitorHelper must not be copied.
- Bug 1841 - FlowMonitor fails to install if IPv4 is not installed in the node
- Bug 1842 - FlowMonitor SerializeToXml<Something> should be called by the helper
- Bug 1846 - IPv6 should send Destination Unreachable if no route is available
- Bug 1852 - cairo-wideint-private.h error cannot find definitions for fixed-width integral types
- Bug 1853 - NS_LOG_FUNCTION broken on OSX 10.9

View File

@@ -149,11 +149,10 @@ main (int argc, char *argv[])
p2p.EnablePcapAll ("simple-global-routing");
// Flow Monitor
Ptr<FlowMonitor> flowmon;
FlowMonitorHelper flowmonHelper;
if (enableFlowMonitor)
{
flowmon = flowmonHelper.InstallAll ();
flowmonHelper.InstallAll ();
}
NS_LOG_INFO ("Run Simulation.");
@@ -163,7 +162,7 @@ main (int argc, char *argv[])
if (enableFlowMonitor)
{
flowmon->SerializeToXmlFile ("simple-global-routing.flowmon", false, false);
flowmonHelper.SerializeToXmlFile ("simple-global-routing.flowmon", false, false);
}
Simulator::Destroy ();

View File

@@ -339,11 +339,10 @@ int main (int argc, char *argv[])
LocalLink.EnablePcapAll("TcpVariantsComparison", true);
// Flow monitor
Ptr<FlowMonitor> flowMonitor;
FlowMonitorHelper flowHelper;
if (flow_monitor)
{
flowMonitor = flowHelper.InstallAll();
flowHelper.InstallAll();
}
Simulator::Stop (Seconds(stop_time));
@@ -351,7 +350,7 @@ int main (int argc, char *argv[])
if (flow_monitor)
{
flowMonitor->SerializeToXmlFile("TcpVariantsComparison.flowmonitor", true, true);
flowHelper.SerializeToXmlFile("TcpVariantsComparison.flowmonitor", true, true);
}
Simulator::Destroy ();

View File

@@ -508,12 +508,11 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
}
Ptr<FlowMonitor> flowmon;
FlowMonitorHelper flowmonHelper;
if (enableFlowMon)
{
flowmon = flowmonHelper.InstallAll ();
flowmonHelper.InstallAll ();
}
Simulator::Stop (Seconds (totalTime));
@@ -521,7 +520,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
if (enableFlowMon)
{
flowmon->SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
flowmonHelper.SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
}
Simulator::Destroy ();

View File

@@ -120,5 +120,34 @@ FlowMonitorHelper::InstallAll ()
return m_flowMonitor;
}
void
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
{
if (m_flowMonitor)
{
m_flowMonitor->SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
}
}
std::string
FlowMonitorHelper::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
{
std::ostringstream os;
if (m_flowMonitor)
{
m_flowMonitor->SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
}
return os.str ();
}
void
FlowMonitorHelper::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
{
if (m_flowMonitor)
{
m_flowMonitor->SerializeToXmlFile (fileName, enableHistograms, enableProbes);
}
}
} // namespace ns3

View File

@@ -79,6 +79,32 @@ public:
*/
Ptr<FlowClassifier> GetClassifier ();
/**
* Serializes the results to an std::ostream in XML format
* \param os the output stream
* \param indent number of spaces to use as base indentation level
* \param enableHistograms if true, include also the histograms in the output
* \param enableProbes if true, include also the per-probe/flow pair statistics in the output
*/
void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
/**
* Same as SerializeToXmlStream, but returns the output as a std::string
* \param indent number of spaces to use as base indentation level
* \param enableHistograms if true, include also the histograms in the output
* \param enableProbes if true, include also the per-probe/flow pair statistics in the output
* \return the XML output as string
*/
std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
/**
* Same as SerializeToXmlStream, but writes to a file instead
* \param fileName name or path of the output file that will be created
* \param enableHistograms if true, include also the histograms in the output
* \param enableProbes if true, include also the per-probe/flow pair statistics in the output
*/
void SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes);
private:
/**
* \brief Copy constructor