flow-monitor: (fixes #2545) Optimized build fails for flow-monitor (2)
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
|
||||
#define PERIODIC_CHECK_INTERVAL (Seconds (1))
|
||||
|
||||
namespace ns3 {
|
||||
@@ -35,14 +33,6 @@ NS_LOG_COMPONENT_DEFINE ("FlowMonitor");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (FlowMonitor);
|
||||
|
||||
|
||||
inline static void
|
||||
Indent (std::ostream &os, uint16_t level)
|
||||
{
|
||||
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
FlowMonitor::GetTypeId (void)
|
||||
{
|
||||
@@ -407,6 +397,12 @@ FlowMonitor::AddFlowClassifier (Ptr<FlowClassifier> classifier)
|
||||
m_classifiers.push_back (classifier);
|
||||
}
|
||||
|
||||
inline static void
|
||||
Indent (std::ostream &os, uint16_t level)
|
||||
{
|
||||
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
}
|
||||
|
||||
void
|
||||
FlowMonitor::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
|
||||
{
|
||||
|
||||
@@ -82,18 +82,22 @@ FlowProbe::GetStats () const
|
||||
return m_stats;
|
||||
}
|
||||
|
||||
void
|
||||
FlowProbe::SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const
|
||||
inline static void
|
||||
Indent (std::ostream &os, uint16_t level)
|
||||
{
|
||||
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
}
|
||||
|
||||
INDENT (indent); os << "<FlowProbe index=\"" << index << "\">\n";
|
||||
void
|
||||
FlowProbe::SerializeToXmlStream (std::ostream &os, uint16_t indent, uint32_t index) const
|
||||
{
|
||||
Indent (os, indent); os << "<FlowProbe index=\"" << index << "\">\n";
|
||||
|
||||
indent += 2;
|
||||
|
||||
for (Stats::const_iterator iter = m_stats.begin (); iter != m_stats.end (); iter++)
|
||||
{
|
||||
INDENT (indent);
|
||||
Indent (os, indent);
|
||||
os << "<FlowStats "
|
||||
<< " flowId=\"" << iter->first << "\""
|
||||
<< " packets=\"" << iter->second.packets << "\""
|
||||
@@ -103,23 +107,23 @@ FlowProbe::SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) c
|
||||
indent += 2;
|
||||
for (uint32_t reasonCode = 0; reasonCode < iter->second.packetsDropped.size (); reasonCode++)
|
||||
{
|
||||
INDENT (indent);
|
||||
Indent (os, indent);
|
||||
os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
|
||||
<< " number=\"" << iter->second.packetsDropped[reasonCode]
|
||||
<< "\" />\n";
|
||||
}
|
||||
for (uint32_t reasonCode = 0; reasonCode < iter->second.bytesDropped.size (); reasonCode++)
|
||||
{
|
||||
INDENT (indent);
|
||||
Indent (os, indent);
|
||||
os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
|
||||
<< " bytes=\"" << iter->second.bytesDropped[reasonCode]
|
||||
<< "\" />\n";
|
||||
}
|
||||
indent -= 2;
|
||||
INDENT (indent); os << "</FlowStats>\n";
|
||||
Indent (os, indent); os << "</FlowStats>\n";
|
||||
}
|
||||
indent -= 2;
|
||||
INDENT (indent); os << "</FlowProbe>\n";
|
||||
Indent (os, indent); os << "</FlowProbe>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
/// \param os the output stream
|
||||
/// \param indent number of spaces to use as base indentation level
|
||||
/// \param index FlowProbe index
|
||||
void SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const;
|
||||
void SerializeToXmlStream (std::ostream &os, uint16_t indent, uint32_t index) const;
|
||||
|
||||
protected:
|
||||
Ptr<FlowMonitor> m_flowMonitor; //!< the FlowMonitor instance
|
||||
|
||||
@@ -102,12 +102,16 @@ Histogram::Histogram ()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string elementName) const
|
||||
inline static void
|
||||
Indent (std::ostream &os, uint16_t level)
|
||||
{
|
||||
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
|
||||
}
|
||||
|
||||
INDENT (indent); os << "<" << elementName // << " binWidth=\"" << m_binWidth << "\""
|
||||
void
|
||||
Histogram::SerializeToXmlStream (std::ostream &os, uint16_t indent, std::string elementName) const
|
||||
{
|
||||
Indent (os, indent); os << "<" << elementName // << " binWidth=\"" << m_binWidth << "\""
|
||||
<< " nBins=\"" << m_histogram.size () << "\""
|
||||
<< " >\n";
|
||||
indent += 2;
|
||||
@@ -117,7 +121,7 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme
|
||||
{
|
||||
if (m_histogram[index])
|
||||
{
|
||||
INDENT (indent);
|
||||
Indent (os, indent);
|
||||
os << "<bin"
|
||||
<< " index=\"" << (index) << "\""
|
||||
<< " start=\"" << (index*m_binWidth) << "\""
|
||||
@@ -127,7 +131,7 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme
|
||||
}
|
||||
}
|
||||
#else
|
||||
INDENT (indent + 2);
|
||||
Indent (os, indent + 2);
|
||||
for (uint32_t index = 0; index < m_histogram.size (); index++)
|
||||
{
|
||||
if (index > 0)
|
||||
@@ -139,8 +143,7 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme
|
||||
os << "\n";
|
||||
#endif
|
||||
indent -= 2;
|
||||
INDENT (indent); os << "</" << elementName << ">\n";
|
||||
#undef INDENT
|
||||
Indent (os, indent); os << "</" << elementName << ">\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
* \param indent number of spaces to use as base indentation level
|
||||
* \param elementName name of the element to serialize.
|
||||
*/
|
||||
void SerializeToXmlStream (std::ostream &os, int indent, std::string elementName) const;
|
||||
void SerializeToXmlStream (std::ostream &os, uint16_t indent, std::string elementName) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user