30#ifndef __BASE_STATS_STORAGE_HH__
31#define __BASE_STATS_STORAGE_HH__
277 "Bucket size (%f) must be greater than zero",
bucket_size);
280 "Bucket size (%f) does not divide range [%f:%f] into equal-" \
290 reset(storage_params);
352 min_val = CounterLimits::max();
353 max_val = CounterLimits::min();
468 "There must be at least two buckets in a histogram");
476 reset(storage_params);
523 data.cvec.resize(buckets);
730 reset(storage_params);
764 MCounter::iterator it;
766 for (it =
cmap.begin(); it !=
cmap.end(); it++) {
767 data.cmap[(*it).first] = (*it).second;
Templatized storage for distribution that calculates per tick mean and variance.
bool zero() const
Return true if no samples have been added.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
size_type size() const
Return the number of entries, in this case 1.
AvgSampleStor(const StorageParams *const storage_params)
Create and initialize this storage.
void prepare(const StorageParams *const storage_params, DistData &data)
Counter squares
Current sum of squares.
Counter sum
Current total.
Templatized storage and interface to a per-tick average stat.
Counter current
The current count.
Counter value() const
Return the current count.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
Result total
The total count for all tick.
void inc(Counter val)
Increment the current count by the provided value, calls set.
Result result() const
Return the current average.
Tick last
The tick that current last changed.
void dec(Counter val)
Deccrement the current count by the provided value, calls set.
Tick lastReset
The tick of the last reset.
void prepare(const StorageParams *const storage_params)
Prepare stat data for dumping or serialization.
AvgStor(const StorageParams *const storage_params)
Build and initializes this stat storage.
void set(Counter val)
Set the current count to the one provided, update the total and last set values.
Templatized storage and interface for a distribution stat.
size_type size() const
Return the number of buckets in this distribution.
Counter min_val
The smallest value sampled.
Counter sum
The current sum.
DistStor(const StorageParams *const storage_params)
Counter samples
The number of samples.
VCounter cvec
Counter for each bucket.
Counter underflow
The number of values sampled less than min.
Counter squares
The sum of squares.
void prepare(const StorageParams *const storage_params, DistData &data)
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Counter min_track
The minimum value to track.
Counter bucket_size
The number of entries in each bucket.
Counter overflow
The number of values sampled more than max.
Counter max_val
The largest value sampled.
bool zero() const
Returns true if any calls to sample have been made.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
Counter max_track
The maximum value to track.
Templatized storage and interface for a histogram stat.
Counter sum
The current sum.
Counter samples
The number of samples.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
void add(HistStor *other)
Adds the contents of the given storage to this storage.
void growUp()
Given a bucket size B, and a range of values [0, N], this function doubles the bucket size to double ...
HistStor(const StorageParams *const storage_params)
Counter min_bucket
Lower bound of the first bucket's range.
void growOut()
Given a bucket size B, and a range of values [M, N], where M < 0, this function doubles the bucket si...
Counter bucket_size
The number of entries in each bucket.
size_type size() const
Return the number of buckets in this distribution.
VCounter cvec
Counter for each bucket.
bool zero() const
Returns true if any calls to sample have been made.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
void growDown()
Given a bucket size B, and a range of values [0, N], this function doubles the bucket size to double ...
void prepare(const StorageParams *const storage_params, DistData &data)
Counter logs
The sum of logarithm of each sample, used to compute geometric mean.
Counter max_bucket
Lower bound of the last bucket's range.
Counter squares
The sum of squares.
Templatized storage and interface for a distribution that calculates mean and variance.
Counter sum
The current sum.
size_type size() const
Return the number of entries in this stat, 1.
bool zero() const
Return true if no samples have been added.
Counter squares
The sum of squares.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
void prepare(const StorageParams *const storage_params, DistData &data)
Counter samples
The number of samples.
SampleStor(const StorageParams *const storage_params)
Create and initialize this storage.
void sample(Counter val, int number)
Add a value the given number of times to this running average.
Templatized storage and interface for a sparse histogram stat.
size_type size() const
Return the number of buckets in this distribution.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
SparseHistStor(const StorageParams *const storage_params)
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Counter samples
Counter for number of samples.
void prepare(const StorageParams *const storage_params, SparseHistData &data)
bool zero() const
Returns true if any calls to sample have been made.
MCounter cmap
Counter for each bucket.
Templatized storage and interface for a simple scalar stat.
void prepare(const StorageParams *const storage_params)
Prepare stat data for dumping or serialization.
Result result() const
Return the value of this stat as a result type.
StatStor(const StorageParams *const storage_params)
Builds this storage element and calls the base constructor of the datatype.
void dec(Counter val)
Decrement the stat by the given value.
Counter value() const
Return the value of this stat as its base type.
void set(Counter val)
The the stat to the given value.
void inc(Counter val)
Increment the stat by the given value.
Counter data
The statistic value.
void reset(const StorageParams *const storage_params)
Reset stat value to default.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
std::map< Counter, int > MCounter
map of counters
double Counter
All counters are of 64-bit values.
double Result
All results are doubles.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T safe_cast(U &&ref_or_ptr)
Tick curTick()
The universal simulation clock.
uint64_t Tick
Tick count type.
General container for distribution data.
The parameters for a distribution stat.
The parameters for a distribution stat.
size_type buckets
The number of buckets.
Counter max
The maximum value to track.
Counter bucket_size
The number of entries in each bucket.
Counter min
The minimum value to track.
Params(Counter _min, Counter _max, Counter _bucket_size)
The parameters for a distribution stat.
size_type buckets
The number of buckets.
Params(size_type _buckets)
Data structure of sparse histogram.
The parameters for a sparse histogram stat.
virtual ~StorageParams()=default