13 #ifndef _H_SST_CORE_STATS_HISTO
14 #define _H_SST_CORE_STATS_HISTO
16 #include <sst/core/output.h>
17 #include <sst/core/stats/basestats.h>
25 namespace Statistics {
33 template<
class HistoBinType,
class HistoCountType>
40 Histogram(
const std::string name, HistoBinType binW) :
69 void add(HistoBinType value) {
71 HistoBinType bin_start = binWidth * (value / binWidth);
74 if(bin_itr == bins.end()) {
75 bins.insert(std::pair<HistoBinType, HistoCountType>(bin_start, (HistoCountType) 1));
87 minVal = (minVal < bin_start) ? minVal : bin_start;
88 maxVal = (maxVal > bin_start) ? maxVal : bin_start;
114 if(bin_itr == bins.end()) {
115 return (HistoCountType) 0;
132 return maxVal + binWidth;
154 typedef typename std::map<HistoBinType, HistoCountType>::iterator
histo_itr;
168 HistoBinType binWidth;
173 HistoBinType totalSummed;
177 HistoCountType itemCount;
182 std::map<HistoBinType, HistoCountType> bins;
HistoCountType getItemCount()
Get the total number of items contained in all bins.
Definition: histo.h:139
HistoCountType getBinCountByBinStart(HistoBinType v)
Get the count of items in the bin by the start value (e.g.
Definition: histo.h:111
HistoBinType getBinEnd()
Get the largest possible value represented by this histogram (i.e.
Definition: histo.h:131
Definition: basestats.h:29
std::map< HistoBinType, HistoCountType >::iterator histo_itr
Iterator over the histogram bins.
Definition: histo.h:154
void add(HistoBinType value)
Adds a new value to the histogram.
Definition: histo.h:69
Histogram(const std::string name, HistoBinType binW)
Creates a new bin with a specific bin width.
Definition: histo.h:40
Holder of data grouped into pre-determined width bins.
Definition: histo.h:34
HistoBinType getValuesSummed()
Sum up every item presented for storage in the histogram.
Definition: histo.h:147
HistoBinType getBinWidth()
Get the width of a bin in this histogram.
Definition: histo.h:103
Histogram(const char *name, HistoBinType binW)
Creates a new bin with a specific bin width.
Definition: histo.h:55
HistoCountType getBinCount()
Count how many bins are active in this histogram.
Definition: histo.h:96
HistoBinType getBinStart()
Get the smallest start value of a bin in this histogram (i.e.
Definition: histo.h:124