23 #include "ns3/simulator.h"
27 #define DEFAULT_BIN_WIDTH 1
83 auto index = (uint32_t)std::floor(value /
m_binWidth);
114 os << std::string(indent,
' ') <<
"<" << elementName
120 for (uint32_t index = 0; index <
m_histogram.size(); index++)
124 os << std::string(indent,
' ');
126 <<
" index=\"" << (index) <<
"\""
127 <<
" start=\"" << (index *
m_binWidth) <<
"\""
134 os << std::string(indent + 2,
' ');
135 for (uint32_t index = 0; index <
m_histogram.size(); index++)
146 os << std::string(indent,
' ') <<
"</" << elementName <<
">\n";
void Clear()
Clear the histogram content.
double GetBinWidth(uint32_t index) const
Returns the bin width.
uint32_t GetBinCount(uint32_t index) const
Get the number of data added to the bin.
std::vector< uint32_t > m_histogram
Histogram data.
void SetDefaultBinWidth(double binWidth)
Set the bin width.
double m_binWidth
Bin width.
uint32_t GetNBins() const
Returns the number of bins in the histogram.
void SerializeToXmlStream(std::ostream &os, uint16_t indent, std::string elementName) const
Serializes the results to an std::ostream in XML format.
double GetBinEnd(uint32_t index) const
Returns the bin end, i.e., (index+1)*binWidth.
void AddValue(double value)
Add a value to the histogram.
double GetBinStart(uint32_t index) const
Returns the bin start, i.e., index*binWidth.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define DEFAULT_BIN_WIDTH
Every class exported by the ns3 library is enclosed in the ns3 namespace.