Skip to content

Commit

Permalink
flow-monitor: (fixes #2545) Optimized build fails for flow-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyPec committed Nov 12, 2016
1 parent 52fb85b commit f44b620
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 38 deletions.
5 changes: 3 additions & 2 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ Bugs fixed
- Bug 2529 - Missing trace when Block ACK timeout is triggered or when missing MPDUs are announced by a Block ACK response
- Bug 2530 - Rename aodv::SetBalckListTimeout to aodv::SetBlackListTimeout
- Bug 2532 - Inconsistencies between 802.11n MCS and NSS value reported in TXVECTOR
- Bug 2541 - preamble not assigned correctly
- Bug 2542 - dead assignment on wifi mac-low
- Bug 2535 - memory leak in bench-simulator.cc
- Bug 2536 - fixed dead assignment and potential memory leak in wimax
- Bug 2538 - fixed dead assignment on tap-bridge
- Bug 2541 - preamble not assigned correctly
- Bug 2542 - dead assignment on wifi mac-low
- Bug 2545 - Optimized build fails for flow-monitor

Known issues
------------
Expand Down
4 changes: 2 additions & 2 deletions src/flow-monitor/helper/flow-monitor-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ FlowMonitorHelper::InstallAll ()
}

void
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
{
if (m_flowMonitor)
{
Expand All @@ -155,7 +155,7 @@ FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, int indent, bool enab
}

std::string
FlowMonitorHelper::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
FlowMonitorHelper::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
{
std::ostringstream os;
if (m_flowMonitor)
Expand Down
4 changes: 2 additions & 2 deletions src/flow-monitor/helper/flow-monitor-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class FlowMonitorHelper
* \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);
void SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes);

/**
* Same as SerializeToXmlStream, but returns the output as a std::string
Expand All @@ -102,7 +102,7 @@ class FlowMonitorHelper
* \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);
std::string SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes);

/**
* Same as SerializeToXmlStream, but writes to a file instead
Expand Down
14 changes: 13 additions & 1 deletion src/flow-monitor/model/flow-classifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,27 @@ class FlowClassifier : public SimpleRefCount<FlowClassifier>
/// 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
virtual void SerializeToXmlStream (std::ostream &os, int indent) const = 0;
virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const = 0;

protected:
/// Returns a new, unique Flow Identifier
/// \returns a new FlowId
FlowId GetNewFlowId ();

///
/// \brief Add a number of spaces for indentation purposes.
/// \param os The stream to write to.
/// \param level The number of spaces to add.
void Indent (std::ostream &os, uint16_t level) const;

};

inline void
FlowClassifier::Indent (std::ostream &os, uint16_t level) const
{
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
}


} // namespace ns3

Expand Down
31 changes: 19 additions & 12 deletions src/flow-monitor/model/flow-monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ 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)
{
Expand Down Expand Up @@ -401,19 +408,19 @@ FlowMonitor::AddFlowClassifier (Ptr<FlowClassifier> classifier)
}

void
FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
FlowMonitor::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
{
CheckForLostPackets ();

INDENT (indent); os << "<FlowMonitor>\n";
Indent (os, indent); os << "<FlowMonitor>\n";
indent += 2;
INDENT (indent); os << "<FlowStats>\n";
Indent (os, indent); os << "<FlowStats>\n";
indent += 2;
for (FlowStatsContainerCI flowI = m_flowStats.begin ();
flowI != m_flowStats.end (); flowI++)
{

INDENT (indent);
Indent (os, indent);
#define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\""
os << "<Flow flowId=\"" << flowI->first << "\""
ATTRIB (timeFirstTxPacket)
Expand All @@ -436,14 +443,14 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist
indent += 2;
for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++)
{
INDENT (indent);
Indent (os, indent);
os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
<< " number=\"" << flowI->second.packetsDropped[reasonCode]
<< "\" />\n";
}
for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++)
{
INDENT (indent);
Indent (os, indent);
os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
<< " bytes=\"" << flowI->second.bytesDropped[reasonCode]
<< "\" />\n";
Expand All @@ -457,10 +464,10 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist
}
indent -= 2;

INDENT (indent); os << "</Flow>\n";
Indent (os, indent); os << "</Flow>\n";
}
indent -= 2;
INDENT (indent); os << "</FlowStats>\n";
Indent (os, indent); os << "</FlowStats>\n";

for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
iter != m_classifiers.end ();
Expand All @@ -471,23 +478,23 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist

if (enableProbes)
{
INDENT (indent); os << "<FlowProbes>\n";
Indent (os, indent); os << "<FlowProbes>\n";
indent += 2;
for (uint32_t i = 0; i < m_flowProbes.size (); i++)
{
m_flowProbes[i]->SerializeToXmlStream (os, indent, i);
}
indent -= 2;
INDENT (indent); os << "</FlowProbes>\n";
Indent (os, indent); os << "</FlowProbes>\n";
}

indent -= 2;
INDENT (indent); os << "</FlowMonitor>\n";
Indent (os, indent); os << "</FlowMonitor>\n";
}


std::string
FlowMonitor::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
FlowMonitor::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
{
std::ostringstream os;
SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
Expand Down
4 changes: 2 additions & 2 deletions src/flow-monitor/model/flow-monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ class FlowMonitor : public Object
/// \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);
void SerializeToXmlStream (std::ostream &os, uint16_t 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);
std::string SerializeToXmlString (uint16_t 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
Expand Down
12 changes: 4 additions & 8 deletions src/flow-monitor/model/ipv4-flow-classifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,15 @@ Ipv4FlowClassifier::FindFlow (FlowId flowId) const
}

void
Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, uint16_t indent) const
{
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';

INDENT (indent); os << "<Ipv4FlowClassifier>\n";
Indent (os, indent); os << "<Ipv4FlowClassifier>\n";

indent += 2;
for (std::map<FiveTuple, FlowId>::const_iterator
iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
{
INDENT (indent);
Indent (os, indent);
os << "<Flow flowId=\"" << iter->second << "\""
<< " sourceAddress=\"" << iter->first.sourceAddress << "\""
<< " destinationAddress=\"" << iter->first.destinationAddress << "\""
Expand All @@ -207,9 +205,7 @@ Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
}

indent -= 2;
INDENT (indent); os << "</Ipv4FlowClassifier>\n";

#undef INDENT
Indent (os, indent); os << "</Ipv4FlowClassifier>\n";
}


Expand Down
2 changes: 1 addition & 1 deletion src/flow-monitor/model/ipv4-flow-classifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Ipv4FlowClassifier : public FlowClassifier
/// \returns the FiveTuple corresponding to flowId
FiveTuple FindFlow (FlowId flowId) const;

virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const;

private:

Expand Down
11 changes: 4 additions & 7 deletions src/flow-monitor/model/ipv6-flow-classifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,15 @@ Ipv6FlowClassifier::FindFlow (FlowId flowId) const
}

void
Ipv6FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
Ipv6FlowClassifier::SerializeToXmlStream (std::ostream &os, uint16_t indent) const
{
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';

INDENT (indent); os << "<Ipv6FlowClassifier>\n";
Indent (os, indent); os << "<Ipv6FlowClassifier>\n";

indent += 2;
for (std::map<FiveTuple, FlowId>::const_iterator
iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
{
INDENT (indent);
Indent (os, indent);
os << "<Flow flowId=\"" << iter->second << "\""
<< " sourceAddress=\"" << iter->first.sourceAddress << "\""
<< " destinationAddress=\"" << iter->first.destinationAddress << "\""
Expand All @@ -208,9 +206,8 @@ Ipv6FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
}

indent -= 2;
INDENT (indent); os << "</Ipv6FlowClassifier>\n";
Indent (os, indent); os << "</Ipv6FlowClassifier>\n";

#undef INDENT
}


Expand Down
2 changes: 1 addition & 1 deletion src/flow-monitor/model/ipv6-flow-classifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Ipv6FlowClassifier : public FlowClassifier
/// \returns the FiveTuple corresponding to flowId
FiveTuple FindFlow (FlowId flowId) const;

virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const;

private:

Expand Down

0 comments on commit f44b620

Please sign in to comment.