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

CycleHistogramBase class for uint64_t values. More...

#include <CycleHistogram.hpp>

Inheritance diagram for sparta::CycleHistogramBase:
Collaboration diagram for sparta::CycleHistogramBase:

Public Member Functions

 CycleHistogramBase ()=delete
 Not default constructable.
 
 CycleHistogramBase (const CycleHistogramBase &)=delete
 Not copy-constructable.
 
 CycleHistogramBase (CycleHistogramBase &&)=delete
 Not move-constructable.
 
void operator= (const CycleHistogramBase &)=delete
 Not assignable.
 
uint64_t getHistogramUpperValue () const
 
uint64_t getHistogramLowerValue () const
 
uint64_t getNumBins () const
 
uint64_t getNumValuesPerBin () const
 
CycleHistogramBase use methods
void addValue (uint64_t val)
 Add a value to histogram for one cycle, defaulting back to idle value.
 
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::CycleCountergetAggCycles () const
 Return aggregate clock cycles of this histogram.
 
const std::vector< sparta::CycleCounter > & getRegularBin () const
 Return vector of regular bin counts.
 
const sparta::CycleCountergetUnderflowBin () const
 Return count of underflow bin.
 
const sparta::CycleCountergetOverflowBin () 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.
 
void setValue (uint64_t val)
 Set a value to histogram until a new value is set.
 

Protected Member Functions

 CycleHistogramBase (const uint64_t lower_val, const uint64_t upper_val, const uint64_t num_vals_per_bin, const uint64_t idle_value=0)
 CycleHistogramBase constructor.
 
std::string getDisplayStringCumulative_ (const std::string &name) const
 Render the cumulative values of this histogram for use in standalone model.
 
void startCounting_ (uint64_t val, uint64_t delay=0)
 Start counting, taking into account the specified delay.
 
void stopCounting_ (uint64_t val, uint64_t delay=0)
 Stop counting and increment internal count, taking into account the specified delay.
 
void updateMaxValues_ (uint64_t val)
 
void initializeStats_ (StatisticSet *sset, const Clock *clk, const std::string &name, const std::string &description, const InstrumentationNode::visibility_t stat_vis_general=InstrumentationNode::AUTO_VISIBILITY, const InstrumentationNode::visibility_t stat_vis_detailed=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_max=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_avg=InstrumentationNode::AUTO_VISIBILITY, const std::vector< std::string > &histogram_state_names={})
 

Protected Attributes

const uint64_t lower_val_
 Lowest value captured in normal bins.
 
const uint64_t upper_val_
 Highest value vaptured in normal bins.
 
const uint64_t num_vals_per_bin_
 Number of values captured by each bin.
 
const uint64_t idle_value_
 Value to capture when nothing is captured.
 
std::unique_ptr< sparta::CycleCountertotal_
 Total values.
 
sparta::CycleCounterunderflow_bin_
 Bin for all underflow.
 
sparta::CycleCounteroverflow_bin_
 Bin for all overflow.
 
std::vector< sparta::CycleCounterbin_
 Regular bins.
 
std::unique_ptr< sparta::StatisticDefunderflow_probability_
 Probability of underflow.
 
std::unique_ptr< sparta::StatisticDefoverflow_probability_
 Probability of overflow.
 
std::vector< std::unique_ptr< sparta::StatisticDef > > probabilities_
 Probabilities of each normal bin.
 
std::unique_ptr< sparta::StatisticDefweighted_non_zero_average_
 
std::unique_ptr< sparta::Countermax_value_
 The maximum value in the histogram.
 
std::unique_ptr< sparta::StatisticDefweighted_average_
 The weighted average.
 
std::unique_ptr< sparta::StatisticDeffullness_
 Sum of the max bin and the overflow bin.
 
std::unique_ptr< sparta::StatisticDeffullness_probability_
 Probability of the histogram being in a full state.
 
uint64_t num_bins_
 Number of bins.
 
uint64_t idx_shift_amount_
 Number of bits which cannot distinguish between bins for a given input value.
 
uint64_t last_value_ = 0
 Last value updated.
 
std::vector< double > bin_prob_vector_
 

Detailed Description

CycleHistogramBase class for uint64_t values.

A histogram is usually thought of has 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.

Definition at line 40 of file CycleHistogram.hpp.

Constructor & Destructor Documentation

◆ CycleHistogramBase()

sparta::CycleHistogramBase::CycleHistogramBase ( const uint64_t  lower_val,
const uint64_t  upper_val,
const uint64_t  num_vals_per_bin,
const uint64_t  idle_value = 0 
)
inlineprotected

CycleHistogramBase 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.
idle_valuethe value to capture when none nothing was updated (default = 0)

Definition at line 224 of file CycleHistogram.hpp.

Member Function Documentation

◆ addValue()

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

Add a value to histogram for one cycle, defaulting back to idle value.

Parameters
valNew value to add
Postcondition
Correct bin will be incremented

Definition at line 77 of file CycleHistogram.hpp.

Here is the call graph for this function:

◆ getAggCycles()

const sparta::CycleCounter & sparta::CycleHistogramBase::getAggCycles ( ) const
inline

Return aggregate clock cycles of this histogram.

Definition at line 138 of file CycleHistogram.hpp.

◆ getDisplayStringCumulative_()

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

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

Definition at line 249 of file CycleHistogram.hpp.

◆ getHistogramLowerValue()

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

Definition at line 207 of file CycleHistogram.hpp.

◆ getHistogramUpperValue()

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

Definition at line 206 of file CycleHistogram.hpp.

◆ getMeanBinCount()

double sparta::CycleHistogramBase::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 120 of file CycleHistogram.hpp.

◆ getNumBins()

uint64_t sparta::CycleHistogramBase::getNumBins ( ) const
inline

Definition at line 208 of file CycleHistogram.hpp.

◆ getNumValuesPerBin()

uint64_t sparta::CycleHistogramBase::getNumValuesPerBin ( ) const
inline

Definition at line 209 of file CycleHistogram.hpp.

◆ getOverflowBin()

const sparta::CycleCounter & sparta::CycleHistogramBase::getOverflowBin ( ) const
inline

Return count of overflow bin.

Definition at line 159 of file CycleHistogram.hpp.

◆ getOverflowProbability()

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

Return overflow probability.

Definition at line 173 of file CycleHistogram.hpp.

◆ getRegularBin()

const std::vector< sparta::CycleCounter > & sparta::CycleHistogramBase::getRegularBin ( ) const
inline

Return vector of regular bin counts.

Definition at line 145 of file CycleHistogram.hpp.

◆ getStandardDeviation()

double sparta::CycleHistogramBase::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 92 of file CycleHistogram.hpp.

◆ getUnderflowBin()

const sparta::CycleCounter & sparta::CycleHistogramBase::getUnderflowBin ( ) const
inline

Return count of underflow bin.

Definition at line 152 of file CycleHistogram.hpp.

◆ getUnderflowProbability()

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

Return underflow probability.

Definition at line 166 of file CycleHistogram.hpp.

◆ initializeStats_()

void sparta::CycleHistogramBase::initializeStats_ ( StatisticSet sset,
const Clock clk,
const std::string &  name,
const std::string &  description,
const InstrumentationNode::visibility_t  stat_vis_general = InstrumentationNode::AUTO_VISIBILITY,
const InstrumentationNode::visibility_t  stat_vis_detailed = InstrumentationNode::AUTO_VISIBILITY,
InstrumentationNode::visibility_t  stat_vis_max = InstrumentationNode::AUTO_VISIBILITY,
InstrumentationNode::visibility_t  stat_vis_avg = InstrumentationNode::AUTO_VISIBILITY,
const std::vector< std::string > &  histogram_state_names = {} 
)
inlineprotected

Definition at line 328 of file CycleHistogram.hpp.

◆ recomputeRegularBinProbabilities()

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

Return vector of probabilities regular bins.

Definition at line 180 of file CycleHistogram.hpp.

◆ setValue()

void sparta::CycleHistogramBase::setValue ( uint64_t  val)
inline

Set a value to histogram until a new value is set.

Parameters
valNew value to set
Postcondition
Correct bin will be incremented

Definition at line 193 of file CycleHistogram.hpp.

Here is the call graph for this function:

◆ startCounting_()

void sparta::CycleHistogramBase::startCounting_ ( uint64_t  val,
uint64_t  delay = 0 
)
inlineprotected

Start counting, taking into account the specified delay.

Parameters
delayBegin incrementing counter after this number of cycles has elapsed on the clock associated with this Counter (see sparta::CounterBase::getClock)
Precondition
Must not be counting already (see stopCounting)

Definition at line 279 of file CycleHistogram.hpp.

◆ stopCounting_()

void sparta::CycleHistogramBase::stopCounting_ ( uint64_t  val,
uint64_t  delay = 0 
)
inlineprotected

Stop counting and increment internal count, taking into account the specified delay.

Parameters
valValue to capture. Class will determine which bin to increment
delayBegin incrementing counter after this number of cycles has elapsed on the clock associated with this Counter (see sparta::CounterBase::getClock)
Precondition
Must be counting already (see startCounting)

Definition at line 303 of file CycleHistogram.hpp.

◆ updateMaxValues_()

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

Keep track of the maximum value seen

Parameters
valThe value currently being added to the histogram

Definition at line 321 of file CycleHistogram.hpp.

Member Data Documentation

◆ bin_

std::vector<sparta::CycleCounter> sparta::CycleHistogramBase::bin_
protected

Regular bins.

Definition at line 561 of file CycleHistogram.hpp.

◆ bin_prob_vector_

std::vector<double> sparta::CycleHistogramBase::bin_prob_vector_
mutableprotected

Definition at line 574 of file CycleHistogram.hpp.

◆ fullness_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::fullness_
protected

Sum of the max bin and the overflow bin.

Definition at line 568 of file CycleHistogram.hpp.

◆ fullness_probability_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::fullness_probability_
protected

Probability of the histogram being in a full state.

Definition at line 569 of file CycleHistogram.hpp.

◆ idle_value_

const uint64_t sparta::CycleHistogramBase::idle_value_
protected

Value to capture when nothing is captured.

Definition at line 556 of file CycleHistogram.hpp.

◆ idx_shift_amount_

uint64_t sparta::CycleHistogramBase::idx_shift_amount_
protected

Number of bits which cannot distinguish between bins for a given input value.

Definition at line 572 of file CycleHistogram.hpp.

◆ last_value_

uint64_t sparta::CycleHistogramBase::last_value_ = 0
protected

Last value updated.

Definition at line 573 of file CycleHistogram.hpp.

◆ lower_val_

const uint64_t sparta::CycleHistogramBase::lower_val_
protected

Lowest value captured in normal bins.

Definition at line 553 of file CycleHistogram.hpp.

◆ max_value_

std::unique_ptr<sparta::Counter> sparta::CycleHistogramBase::max_value_
protected

The maximum value in the histogram.

Definition at line 566 of file CycleHistogram.hpp.

◆ num_bins_

uint64_t sparta::CycleHistogramBase::num_bins_
protected

Number of bins.

Definition at line 571 of file CycleHistogram.hpp.

◆ num_vals_per_bin_

const uint64_t sparta::CycleHistogramBase::num_vals_per_bin_
protected

Number of values captured by each bin.

Definition at line 555 of file CycleHistogram.hpp.

◆ overflow_bin_

sparta::CycleCounter* sparta::CycleHistogramBase::overflow_bin_
protected

Bin for all overflow.

Definition at line 560 of file CycleHistogram.hpp.

◆ overflow_probability_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::overflow_probability_
protected

Probability of overflow.

Definition at line 563 of file CycleHistogram.hpp.

◆ probabilities_

std::vector<std::unique_ptr<sparta::StatisticDef> > sparta::CycleHistogramBase::probabilities_
protected

Probabilities of each normal bin.

Definition at line 564 of file CycleHistogram.hpp.

◆ total_

std::unique_ptr<sparta::CycleCounter> sparta::CycleHistogramBase::total_
protected

Total values.

Definition at line 558 of file CycleHistogram.hpp.

◆ underflow_bin_

sparta::CycleCounter* sparta::CycleHistogramBase::underflow_bin_
protected

Bin for all underflow.

Definition at line 559 of file CycleHistogram.hpp.

◆ underflow_probability_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::underflow_probability_
protected

Probability of underflow.

Definition at line 562 of file CycleHistogram.hpp.

◆ upper_val_

const uint64_t sparta::CycleHistogramBase::upper_val_
protected

Highest value vaptured in normal bins.

Definition at line 554 of file CycleHistogram.hpp.

◆ weighted_average_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::weighted_average_
protected

The weighted average.

Definition at line 567 of file CycleHistogram.hpp.

◆ weighted_non_zero_average_

std::unique_ptr<sparta::StatisticDef> sparta::CycleHistogramBase::weighted_non_zero_average_
protected

Definition at line 565 of file CycleHistogram.hpp.


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