The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::HistogramBase Class Reference

Histogram base class for uint64_t values. More...

#include <Histogram.hpp>

Inheritance diagram for sparta::HistogramBase:

Public Member Functions

void addValue (uint64_t val)
 Add a value to histogram.
 
double getStandardDeviation () const
 Calculate Standard Deviation of counts in bins. This API also takes into account the count in underflow and overflow bins.
 
double getMeanBinCount () const
 Calculate the mean bin count of all the bins. This API also takes into account the count in underflow and overflow bins.
 
const sparta::CountergetAggValues () const
 Return aggregate of this histogram.
 
const std::vector< sparta::Counter > & getRegularBin () const
 Return vector of regular bin counts.
 
const sparta::CountergetUnderflowBin () const
 Return count of underflow bin.
 
const sparta::CountergetOverflowBin () const
 Return count of overflow bin.
 
double getUnderflowProbability () const
 Return underflow probability.
 
double getOverflowProbability () const
 Return overflow probability.
 
const std::vector< double > & recomputeRegularBinProbabilities () const
 Return vector of probabilities regular bins.
 
uint64_t getHistogramUpperValue () const
 
uint64_t getHistogramLowerValue () const
 
uint32_t getNumBins () const
 
uint32_t getNumValuesPerBin () const
 

Protected Member Functions

 HistogramBase (uint64_t lower_val, uint64_t upper_val, uint32_t num_vals_per_bin)
 HistogramBase constructor.
 
void updateMaxValues_ (uint64_t val)
 
std::string getDisplayStringCumulative_ (const std::string &name) const
 Render the cumulative values of this histogram for use in standalone model.
 
void initializeStats_ (StatisticSet *sset, const std::string &stat_prefix="", InstrumentationNode::Visibility bin_vis=InstrumentationNode::VIS_NORMAL, InstrumentationNode::Visibility prob_vis=InstrumentationNode::VIS_NORMAL, uint32_t num_max_values=0, InstrumentationNode::Visibility max_vis=InstrumentationNode::VIS_SUMMARY)
 

Detailed Description

Histogram base class for uint64_t values.

A histogram is usually thought of as having a lower limit, upper limit, and number of bins. This histogram class requires lower and upper limits, but instead of number of bins, it requires the user to specify number of values per bin. The number of bins is then calculated as below: number_of_bins = (upper_limit - lower_limit) / values_per_bin + 1

This is possible because this histogram only deals with positive integer values.

This class is the base class for two different Histograms: one which is a TreeNode, and one which is not.

Definition at line 41 of file Histogram.hpp.

Constructor & Destructor Documentation

◆ HistogramBase()

sparta::HistogramBase::HistogramBase ( uint64_t  lower_val,
uint64_t  upper_val,
uint32_t  num_vals_per_bin 
)
inlineprotected

HistogramBase constructor.

Parameters
lower_valthe lower value of the histogram. Values lower than lower_val go into the underflow bin.
upper_valthe upper value of the histogram. Values higher than upper_val go into the overflow bin.
num_vals_per_binNumber of values per bin. Must be power of two for fast devision.

Definition at line 53 of file Histogram.hpp.

Member Function Documentation

◆ addValue()

void sparta::HistogramBase::addValue ( uint64_t  val)
inline

Add a value to histogram.

Parameters
valNew value to add
Postcondition
Correct bin will be incremented
Total will be incremented

Definition at line 79 of file Histogram.hpp.

Here is the call graph for this function:

◆ getAggValues()

const sparta::Counter & sparta::HistogramBase::getAggValues ( ) const
inline

Return aggregate of this histogram.

Definition at line 151 of file Histogram.hpp.

◆ getDisplayStringCumulative_()

std::string sparta::HistogramBase::getDisplayStringCumulative_ ( const std::string &  name) const
inlineprotected

Render the cumulative values of this histogram for use in standalone model.

Definition at line 236 of file Histogram.hpp.

◆ getHistogramLowerValue()

uint64_t sparta::HistogramBase::getHistogramLowerValue ( ) const
inline

Definition at line 202 of file Histogram.hpp.

◆ getHistogramUpperValue()

uint64_t sparta::HistogramBase::getHistogramUpperValue ( ) const
inline

Definition at line 201 of file Histogram.hpp.

◆ getMeanBinCount()

double sparta::HistogramBase::getMeanBinCount ( ) const
inline

Calculate the mean bin count of all the bins. This API also takes into account the count in underflow and overflow bins.

Definition at line 133 of file Histogram.hpp.

◆ getNumBins()

uint32_t sparta::HistogramBase::getNumBins ( ) const
inline

Definition at line 203 of file Histogram.hpp.

◆ getNumValuesPerBin()

uint32_t sparta::HistogramBase::getNumValuesPerBin ( ) const
inline

Definition at line 204 of file Histogram.hpp.

◆ getOverflowBin()

const sparta::Counter & sparta::HistogramBase::getOverflowBin ( ) const
inline

Return count of overflow bin.

Definition at line 172 of file Histogram.hpp.

◆ getOverflowProbability()

double sparta::HistogramBase::getOverflowProbability ( ) const
inline

Return overflow probability.

Definition at line 186 of file Histogram.hpp.

◆ getRegularBin()

const std::vector< sparta::Counter > & sparta::HistogramBase::getRegularBin ( ) const
inline

Return vector of regular bin counts.

Definition at line 158 of file Histogram.hpp.

◆ getStandardDeviation()

double sparta::HistogramBase::getStandardDeviation ( ) const
inline

Calculate Standard Deviation of counts in bins. This API also takes into account the count in underflow and overflow bins.

Definition at line 105 of file Histogram.hpp.

◆ getUnderflowBin()

const sparta::Counter & sparta::HistogramBase::getUnderflowBin ( ) const
inline

Return count of underflow bin.

Definition at line 165 of file Histogram.hpp.

◆ getUnderflowProbability()

double sparta::HistogramBase::getUnderflowProbability ( ) const
inline

Return underflow probability.

Definition at line 179 of file Histogram.hpp.

◆ initializeStats_()

void sparta::HistogramBase::initializeStats_ ( StatisticSet sset,
const std::string &  stat_prefix = "",
InstrumentationNode::Visibility  bin_vis = InstrumentationNode::VIS_NORMAL,
InstrumentationNode::Visibility  prob_vis = InstrumentationNode::VIS_NORMAL,
uint32_t  num_max_values = 0,
InstrumentationNode::Visibility  max_vis = InstrumentationNode::VIS_SUMMARY 
)
inlineprotected

Initializes statistics within the histogram

Parameters
ssetThe statistic set to add all histogram stats into
stat_prefixString used as a prefix for all generated stat names
bin_visVisibility of the bin / total / OF / UF stats
prob_visVisibility of the probability stats
num_max_valuesTrack the max 'num_max_values' seen as separate counters

Definition at line 266 of file Histogram.hpp.

Here is the call graph for this function:

◆ recomputeRegularBinProbabilities()

const std::vector< double > & sparta::HistogramBase::recomputeRegularBinProbabilities ( ) const
inline

Return vector of probabilities regular bins.

Definition at line 193 of file Histogram.hpp.

◆ updateMaxValues_()

void sparta::HistogramBase::updateMaxValues_ ( uint64_t  val)
inlineprotected

Keep track of the maximum 'N' values seen

Parameters
valThe value currently being added to the histogram

Definition at line 212 of file Histogram.hpp.


The documentation for this class was generated from the following file: