stats: allow cleaning the content of an histogram

This commit is contained in:
Tommaso Pecorella
2023-05-18 12:23:59 +02:00
parent a207fb6766
commit ff12f975b2
3 changed files with 12 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ Changes from ns-3.38 to ns-3-dev
* (network) Added `Mac16Address::Mac16Address(uint16t addr)` and `Mac16Address::Mac64Address(uint64t addr)` constructors.
* (lr-wpan) Added `LrwpanMac::MlmeGetRequest` function and the corresponding confirm callbacks as well as `LrwpanMac::SetMlmeGetConfirm` function.
* (applications) Added `Tx` and `TxWithAddresses` trace sources in `UdpClient`.
* (stats) Added `Histogram::Clear` function to clear the histogram contents.
### Changes to existing API

View File

@@ -92,6 +92,12 @@ Histogram::AddValue(double value)
m_histogram[index]++;
}
void
Histogram::Clear()
{
m_histogram.clear();
}
Histogram::Histogram(double binWidth)
{
m_binWidth = binWidth;

View File

@@ -102,6 +102,11 @@ class Histogram
*/
void AddValue(double value);
/**
* Clear the histogram content.
*/
void Clear();
/**
* \brief Serializes the results to an std::ostream in XML format.
* \param os the output stream