61 #ifndef __BASE_STATISTICS_HH__ 62 #define __BASE_STATISTICS_HH__ 96 template <
class Stat,
class Base>
105 bool check()
const {
return s.check(); }
111 visitor.
visit(*static_cast<Base *>(
this));
113 bool zero()
const {
return s.zero(); }
116 template <
class Stat>
127 template <
class Stat>
149 this->
s.result(rvec);
156 template <
class Stat>
163 template <
class Stat>
172 template <
class Stat>
202 const Info *info()
const;
217 bool zero()
const {
return true; }
227 template <
class Derived,
template <
class>
class InfoProxyType>
231 typedef InfoProxyType<Derived>
Info;
234 Derived &
self() {
return *
static_cast<Derived *
>(
this); }
258 auto info =
new Info(
self());
259 this->setInfo(parent, info);
265 info->setName(parent, name);
281 Info *info = this->info();
286 const std::string &
name()
const {
return this->info()->name; }
302 return this->info()->separatorString;
314 this->info()->
desc = _desc;
338 this->info()->
flags.set(_flags);
348 template <
class Stat>
357 template <
class Derived,
template <
class>
class InfoProxyType>
361 typedef InfoProxyType<Derived>
Info;
364 const char *desc =
nullptr)
381 Derived &
self = this->
self();
382 Info *info =
self.
info();
385 if (subn.size() <=
index)
386 subn.resize(index + 1);
405 Info *info = this->info();
408 if (subd.size() <=
index)
409 subd.resize(index + 1);
418 Derived &
self = this->
self();
419 Info *info = this->info();
421 size_t size =
self.size();
423 self.
data(
i)->prepare(info);
429 Derived &
self = this->
self();
430 Info *info = this->info();
432 size_t size =
self.size();
434 self.
data(
i)->reset(info);
438 template <
class Derived,
template <
class>
class InfoProxyType>
442 typedef InfoProxyType<Derived>
Info;
445 :
DataWrapVec<Derived, InfoProxyType>(parent, name, desc)
456 Derived &
self = this->
self();
457 Info *info = this->info();
468 Derived &
self = this->
self();
469 Info *info = this->info();
471 assert(index <
self.y);
480 return this->info()->y_subnames[
i];
579 : current(0), lastReset(0), total(0), last(0)
590 total += current * (
curTick() - last);
627 bool zero()
const {
return total == 0.0; }
635 total += current * (
curTick() - last);
656 template <
class Derived,
class Stor>
676 return reinterpret_cast<Storage *
>(storage);
688 return reinterpret_cast<const Storage *
>(storage);
694 new (storage) Storage(this->info());
707 const char *desc =
nullptr)
736 template <
typename U>
744 template <
typename U>
752 template <
typename U>
767 bool zero() {
return result() == 0.0; }
781 bool zero()
const {
return value() == 0; }
816 template <
class T,
class V>
821 typedef V (T::*MethodPointer) ()
const;
825 MethodProxy(T *obj, MethodPointer meth) : object(obj), method(meth) {}
831 template <
class Derived>
871 template <
class T,
class V>
885 std::string
str()
const {
return proxy->
str(); }
887 bool check()
const {
return proxy != NULL; }
902 template <
class Stat>
940 : stat(sp.stat), index(sp.index)
979 template <
typename U>
983 stat.data(index)->set(v);
991 template <
typename U>
995 stat.data(index)->inc(v);
1003 template <
typename U>
1007 stat.data(index)->dec(v);
1028 template <
class Derived,
class Stor>
1063 assert(s > 0 &&
"size must be positive!");
1064 assert(!storage &&
"already initialized");
1067 char *ptr =
new char[_size *
sizeof(Storage)];
1068 storage =
reinterpret_cast<Storage *
>(ptr);
1071 new (&storage[
i]) Storage(this->info());
1082 vec[
i] =
data(
i)->value();
1094 vec[
i] =
data(
i)->result();
1106 total +=
data(
i)->result();
1119 if (
data(
i)->zero())
1127 return storage != NULL;
1133 storage(nullptr), _size(0)
1142 data(
i)->~Storage();
1143 delete []
reinterpret_cast<char *
>(storage);
1154 Derived &
self = this->
self();
1167 assert (index >= 0 && index < size());
1168 return Proxy(this->
self(), index);
1172 template <
class Stat>
1183 typename Stat::Storage *
1186 assert(index < len);
1187 return stat.data(offset + index);
1190 const typename Stat::Storage *
1193 assert(index < len);
1194 return stat.data(offset + index);
1204 vec[
i] =
data(
i)->result();
1214 total +=
data(
i)->result();
1220 : stat(s), offset(o), len(l)
1225 : stat(sp.stat), offset(sp.offset), len(sp.len)
1241 assert (index >= 0 && index < size());
1248 template <
class Derived,
class Stor>
1274 x(0), y(0), _size(0), storage(nullptr)
1283 data(
i)->~Storage();
1284 delete []
reinterpret_cast<char *
>(storage);
1290 assert(_x > 0 && _y > 0 &&
"sizes must be positive!");
1291 assert(!storage &&
"already initialized");
1293 Derived &
self = this->
self();
1294 Info *info = this->info();
1302 char *ptr =
new char[_size *
sizeof(Storage)];
1303 storage =
reinterpret_cast<Storage *
>(ptr);
1306 new (&storage[
i]) Storage(info);
1317 assert (index >= 0 && offset + y <= size());
1318 return Proxy(this->
self(), offset, y);
1331 return data(0)->zero();
1343 total +=
data(
i)->result();
1350 Info *info = this->info();
1354 data(
i)->prepare(info);
1356 info->
cvec.resize(size);
1367 Info *info = this->info();
1370 data(
i)->reset(info);
1376 return storage != NULL;
1441 : cvec(
safe_cast<const Params *>(info->storageParams)->buckets)
1454 if (val < min_track)
1455 underflow += number;
1456 else if (val > max_track)
1460 (
size_type)std::floor((val - min_track) / bucket_size);
1461 assert(index < size());
1462 cvec[
index] += number;
1471 sum += val * number;
1472 squares += val * val * number;
1503 data.
min_val = (min_val == CounterLimits::max()) ? 0 : min_val;
1504 data.
max_val = (max_val == CounterLimits::min()) ? 0 : max_val;
1524 min_track = params->
min;
1525 max_track = params->
max;
1528 min_val = CounterLimits::max();
1529 max_val = CounterLimits::min();
1579 : cvec(
safe_cast<const Params *>(info->storageParams)->buckets)
1586 void grow_convert();
1597 assert(min_bucket < max_bucket);
1598 if (val < min_bucket) {
1599 if (min_bucket == 0)
1602 while (val < min_bucket)
1604 }
else if (val >= max_bucket + bucket_size) {
1605 if (min_bucket == 0) {
1606 while (val >= max_bucket + bucket_size)
1609 while (val >= max_bucket + bucket_size)
1615 (int64_t)std::floor((val - min_bucket) / bucket_size);
1617 assert(index < size());
1618 cvec[
index] += number;
1620 sum += val * number;
1621 squares += val * val * number;
1622 logs += log(val) * number;
1649 data.
min = min_bucket;
1650 data.
max = max_bucket + bucket_size - 1;
1656 int buckets = params->
buckets;
1657 data.
cvec.resize(buckets);
1675 max_bucket = params->
buckets - 1;
1727 sum += val * number;
1728 squares += val * val * number;
1803 sum += val * number;
1804 squares += val * val * number;
1846 template <
class Derived,
class Stor>
1856 char storage[
sizeof(Storage)]
__attribute__ ((aligned (8)));
1866 return reinterpret_cast<Storage *
>(storage);
1876 return reinterpret_cast<const Storage *
>(storage);
1882 new (storage) Storage(this->info());
1898 template <
typename U>
1915 Info *info = this->info();
1925 data()->reset(this->info());
1935 template <
class Stat>
1938 template <
class Derived,
class Stor>
1957 return &storage[
index];
1963 return &storage[
index];
1969 assert(s > 0 &&
"size must be positive!");
1970 assert(!storage &&
"already initialized");
1973 char *ptr =
new char[_size *
sizeof(Storage)];
1974 storage =
reinterpret_cast<Storage *
>(ptr);
1976 Info *info = this->info();
1978 new (&storage[
i]) Storage(info);
1995 data(
i)->~Storage();
1996 delete []
reinterpret_cast<char *
>(storage);
2001 assert(index >= 0 && index < size());
2002 return Proxy(this->
self(), index);
2015 if (!
data(
i)->zero())
2023 Info *info = this->info();
2025 info->
data.resize(size);
2033 return storage != NULL;
2037 template <
class Stat>
2045 typename Stat::Storage *
data() {
return stat.data(index); }
2046 const typename Stat::Storage *
data()
const {
return stat.data(index); }
2054 : stat(sp.stat), index(sp.index)
2066 template <
typename U>
2070 data()->sample(v,
n);
2082 return data()->zero();
2113 virtual const VResult &result()
const = 0;
2123 virtual std::string str()
const = 0;
2143 vresult[0] = data->
result();
2157 template <
class Stat>
2166 : proxy(p), vresult(1)
2172 vresult[0] = proxy.
result();
2252 std::string tmp =
"(";
2266 static std::string
str() {
return "+"; }
2272 static std::string
str() {
return "-"; }
2278 static std::string
str() {
return "*"; }
2284 static std::string
str() {
return "/"; }
2290 static std::string
str() {
return "%"; }
2296 static std::string
str() {
return "-"; }
2312 const VResult &lvec = l->result();
2317 vresult.resize(size);
2320 vresult[
i] =
op(lvec[
i]);
2328 const VResult &vec = this->result();
2359 const VResult &lvec = l->result();
2360 const VResult &rvec = r->result();
2362 assert(lvec.size() > 0 && rvec.size() > 0);
2364 if (lvec.size() == 1 && rvec.size() == 1) {
2366 vresult[0] =
op(lvec[0], rvec[0]);
2367 }
else if (lvec.size() == 1) {
2369 vresult.resize(size);
2371 vresult[
i] =
op(lvec[0], rvec[
i]);
2372 }
else if (rvec.size() == 1) {
2374 vresult.resize(size);
2376 vresult[
i] =
op(lvec[
i], rvec[0]);
2377 }
else if (rvec.size() == lvec.size()) {
2379 vresult.resize(size);
2381 vresult[
i] =
op(lvec[
i], rvec[i]);
2390 const VResult &vec = this->result();
2391 const VResult &lvec = l->result();
2392 const VResult &rvec = r->result();
2398 assert(lvec.size() > 0 && rvec.size() > 0);
2399 assert(lvec.size() == rvec.size() ||
2400 lvec.size() == 1 || rvec.size() == 1);
2403 if (lvec.size() == rvec.size() && lvec.size() > 1) {
2408 return op(lsum, rsum);
2426 }
else if (rs == 1) {
2429 assert(ls == rs &&
"Node vector sizes are not equal");
2454 const VResult &lvec = l->result();
2462 vresult[0] =
op(vresult[0], lvec[
i]);
2470 const VResult &lvec = l->result();
2478 result =
op(result, lvec[
i]);
2488 return csprintf(
"total(%s)", l->str());
2514 const char *desc =
nullptr)
2530 const char *desc =
nullptr)
2540 const char *desc =
nullptr)
2554 const char *desc =
nullptr)
2568 const char *desc =
nullptr)
2582 const char *desc =
nullptr)
2596 const char *desc =
nullptr)
2619 this->setParams(params);
2621 return this->
self();
2633 const char *desc =
nullptr)
2648 this->setParams(params);
2650 return this->
self();
2665 const char *desc =
nullptr)
2670 this->setParams(params);
2685 const char *desc =
nullptr)
2690 this->setParams(params);
2702 const char *desc =
nullptr)
2723 this->setParams(params);
2725 return this->
self();
2738 const char *desc =
nullptr)
2754 this->setParams(params);
2755 return this->
self();
2768 const char *desc =
nullptr)
2784 this->setParams(params);
2785 return this->
self();
2789 template <
class Stat>
2804 this->
s.result(vec);
2810 std::string
str()
const {
return this->
s.str(); }
2813 template <
class Stat>
2824 template <
class Derived,
class Stor>
2834 char storage[
sizeof(Storage)];
2844 return reinterpret_cast<Storage *
>(storage);
2854 return reinterpret_cast<const Storage *
>(storage);
2860 new (storage) Storage(this->info());
2876 template <
typename U>
2893 Info *info = this->info();
2903 data()->reset(this->info());
2939 cmap[
val] += number;
2962 MCounter::iterator it;
2964 for (it = cmap.begin(); it != cmap.end(); it++) {
2965 data.
cmap[(*it).first] = (*it).second;
2986 const char *desc =
nullptr)
3000 this->setParams(params);
3002 return this->
self();
3024 const char *desc =
nullptr);
3036 template<
typename T>
3064 void result(
VResult &vec)
const;
3095 std::string str()
const;
3111 std::string
str()
const {
return formula.
str(); }
3138 operator NodePtr&() {
return node; }
3193 template <
class Stat>
3203 : node(new
ConstNode<signed char>(value))
3211 : node(new
ConstNode<unsigned char>(value))
3219 : node(new
ConstNode<signed short>(value))
3227 : node(new
ConstNode<unsigned short>(value))
3235 : node(new
ConstNode<signed int>(value))
3243 : node(new
ConstNode<unsigned int>(value))
3251 : node(new
ConstNode<signed long>(value))
3259 : node(new
ConstNode<unsigned long>(value))
3267 : node(new
ConstNode<signed long long>(value))
3275 : node(new
ConstNode<unsigned long long>(value))
3303 return Temp(std::make_shared<
BinaryNode<std::plus<Result> > >(l, r));
3309 return Temp(std::make_shared<
BinaryNode<std::minus<Result> > >(l, r));
3315 return Temp(std::make_shared<
BinaryNode<std::multiplies<Result> > >(l, r));
3321 return Temp(std::make_shared<
BinaryNode<std::divides<Result> > >(l, r));
3327 return Temp(std::make_shared<
UnaryNode<std::negate<Result> > >(l));
3330 template <
typename T>
3337 template <
typename T>
3347 return Temp(std::make_shared<
SumNode<std::plus<Result> > >(val));
3401 #endif // __BASE_STATISTICS_HH__
double Result
All results are doubles.
Storage * data(off_type index)
Retrieve the storage.
std::map< Counter, int > MCounter
map of counters
DistProxy(const DistProxy &sp)
DistProxy< Derived > Proxy
Storage * storage
The storage of this stat.
Templatized storage and interface for a sparse histogram stat.
DataWrap(Group *parent, const char *name, const char *desc)
Counter samples
The number of samples.
std::string name
The name of the stat.
Temp(unsigned long long value)
Create a ConstNode.
ScalarBase(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
VectorStandardDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
void sample(const U &v, int n=1)
Scalar(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Derived & method(T *obj, V(T::*method)() const)
Extended functor that calls the specified method of the provided object.
size_type size() const
Return the number of nodes in the subtree starting at this node.
Derived & init(size_type _x, size_type _y)
void processDumpQueue()
Process all the callbacks in the dump callbacks queue.
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
const VectorProxy & operator=(const VectorProxy &sp)
Counter sum
The current sum.
Result total() const
Return the total of the result vector.
size_type size() const
Return the number of entries in this stat.
std::vector< std::string > subdescs
Result total() const
Return the total of the result vector.
The parameters for a distribution stat.
const VResult & result() const
Return the result vector of this subtree.
const std::string & name()
void operator++()
Increment the stat by 1.
Base class for formula statistic node.
Counter bucket_size
The number of entries in each bucket.
Result total() const
Return the total of the result vector.
void reset(Info *info)
Reset stat value to default.
Vector2dBase(Group *parent, const char *name, const char *desc)
A stat that calculates the per tick average of a value.
MethodProxy(T *obj, MethodPointer meth)
SampleStor(Info *info)
Create and initialize this storage.
Counter min
The minimum value to track.
Counter min_val
The smallest value sampled.
NodePtr getNodePtr() const
Makde gcc < 4.6.3 happy and explicitly get the underlying node.
VectorProxy(const VectorProxy &sp)
Temp(signed int value)
Create a ConstNode.
Counter current
The current count.
void operator--(int)
Decrement the stat by 1.
Temp(const AverageVector &s)
std::string str() const override
Storage * data(off_type index)
ValueBase(Group *parent, const char *name, const char *desc)
const char * __attribute__((weak)) m5MainCommands[]
Counter max_bucket
The maximum value to track.
Temp(unsigned char value)
Create a ConstNode.
virtual size_type size() const =0
DataWrapVec(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Result total() const
Return the total of the result vector.
Counter overflow
The number of values sampled more than max.
void operator+=(const U &v)
Increment the stat by the given value.
VCounter cvec
Counter for each bucket.
InfoProxyType< Derived > Info
size_type buckets
The number of buckets.
Result total() const
Return the total of the result vector.
Proxy operator[](off_type index)
void inc(Counter val)
Increment the current count by the provided value, calls set.
static void overflow(double &c, const scfx_params ¶ms, bool &o_flag)
Implementation of a distribution stat.
void(* Handler)()
Register reset and dump handlers.
VectorInfoProxy(Stat &stat)
void operator--()
Decrement the stat by 1.
VectorAverageDeviation & init(size_type size)
Initialize storage for this distribution.
virtual Result total() const =0
Result total() const
Return a total of all entries in this vector.
DistBase(Group *parent, const char *name, const char *desc)
void prepare(Info *info, DistData &data)
Temp operator/(Temp l, Temp r)
ScalarProxy< Derived > Proxy
Proxy type.
std::string ysubname(off_type i) const
size_type size() const
Return the number of buckets in this distribution.
Counter samples
Counter for number of samples.
const VResult & result() const
Return the result vector of this subtree.
const Storage * data() const
Retrieve a const pointer to the storage.
Result total
The total count for all tick.
Counter min_track
The minimum value to track.
Templatized storage and interface for a simple scalar stat.
Derived & subdesc(off_type index, const std::string &desc)
Set the subfield description for the given index and marks this stat to print at the end of simulatio...
void value(VCounter &vec) const
A vector of scalar stats.
Value(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Histogram & init(size_type size)
Set the parameters of this histogram.
Overload hash function for BasicBlockRange type.
size_type buckets
The number of buckets.
VectorDistribution & init(size_type size, Counter min, Counter max, Counter bkt)
Initialize storage and parameters for this distribution.
size_type size() const
Return the number of nodes in the subtree starting at this node.
list< Info * > & statsList()
A vector of distributions.
size_type size() const
Return the number of entries, in this case 1.
Counter squares
Current sum of squares.
MCounter cmap
Counter for each bucket.
std::vector< std::string > y_subnames
virtual Result result() const =0
AverageDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Construct and initialize this distribution.
Counter logs
The sum of logarithm of each sample, used to compute geometric mean.
Storage * data()
Retrieve the storage.
Temp(signed char value)
Create a ConstNode.
DataWrapVec2d(Group *parent, const char *name, const char *desc)
void operator--(int)
Decrement the stat by 1.
ScalarProxy(Stat &s, off_type i)
Create and initialize this proxy, do not register it with the database.
The parameters for a distribution stat.
Counter squares
The sum of squares.
Derived & scalar(T &value)
void operator++()
Increment the stat by 1.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Vector(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Counter min_bucket
The minimum value to track.
Proxy operator[](off_type index)
Return a reference (ScalarProxy) to the stat at the given index.
bool zero() const
Return true if no samples have been added.
VectorDistInfoProxy< Derived > Info
virtual void visit(const ScalarInfo &info)=0
This is a simple scalar statistic, like a counter.
This is a vector of AverageDeviation stats.
Result total() const
Return the total of the result vector.
Derived & init(size_type size)
Set this vector to have the given size.
VectorStatNode(const VectorInfo *d)
size_type size() const override
Return the number of nodes in the subtree starting at this node.
Calculates the mean and variance of all the samples.
Distribution(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
void addStat(Stats::Info *info)
Register a stat with this group.
void result(VResult &vec) const
Copy the values to a local vector and return a reference to it.
double Counter
All counters are of 64-bit values.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
ScalarProxy(const ScalarProxy &sp)
Create a copy of the provided ScalarProxy.
SparseHistInfoProxy(Stat &stat)
Temp(signed long long value)
Create a ConstNode.
bool zero() const
Return true if no samples have been added.
Data structure of sparse histogram.
void visit(Output &visitor)
Visitor entry for outputing statistics data.
const VResult & result() const
Return the result vector of this subtree.
size_type size() const
Return the number of entries in this stat.
void operator++(int)
Increment the stat by 1.
void prepare(Info *info, DistData &data)
Counter samples
The number of samples.
AverageVector(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Tick curTick()
The current simulated tick.
Counter max
The maximum value to track.
Temp(const ScalarProxy< Stat > &p)
Create a new ScalarProxyNode.
void prepare(Info *info, DistData &data)
Result total() const
Return the total of the result vector.
const VResult & result() const override
Return the result vector of this subtree.
Counter squares
The sum of squares.
VCounter cvec
Counter for each bucket.
virtual const VResult & result() const =0
std::string csprintf(const char *format, const Args &...args)
bool zero() const
Returns true if any calls to sample have been made.
const std::string & setSeparator() const
void operator=(const U &v)
Set the data value to the given value.
VCounter cvec
Local storage for the entry values, used for printing.
const DistProxy & operator=(const DistProxy &sp)
Result result() const
Return the current value of this statas a result type.
Derived & setSeparator(const std::string &_sep)
Set the character(s) used between the name and vector number on vectors, dist, etc.
Temp operator-(Temp l, Temp r)
void reset()
Proxy has no state.
Temp(const Average &s)
Create a new ScalarStatNode.
Tick last
The tick that current last changed.
BinaryNode(NodePtr &a, NodePtr &b)
Templatized storage and interface for a histogram stat.
Counter sum
The current sum.
Proxy operator[](off_type index)
uint64_t Tick
Tick count type.
Counter squares
The sum of squares.
const VResult & result() const
Return the result vector of this subtree.
A simple distribution stat.
std::shared_ptr< Node > NodePtr
Shared pointer to a function Node.
Implementation of a scalar stat.
virtual Result total() const =0
void reset()
Reset the stat to the default state.
The parameters for a distribution stat.
Flags flags
The formatting flags.
void dec(Counter val)
Decrement the stat by the given value.
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
const VResult & result() const
void reset(Info *info)
Reset stat value to default.
ScalarStatNode(const ScalarInfo *d)
ScalarProxy< Stat > operator[](off_type index)
void registerResetCallback(Callback *cb)
Register a callback that should be called whenever statistics are reset.
VectorDistInfoProxy(Stat &stat)
ScalarInfoProxy(Stat &stat)
void reset()
Reset the stat to the default state.
InfoProxyType< Derived > Info
void reset(Info *info)
Reset stat value to default.
Vector2d(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Counter bucket_size
The number of entries in each bucket.
StatStor(Info *info)
Builds this storage element and calls the base constructor of the datatype.
void setName(const std::string &name)
Set the name of this statistic.
Temp(const NodePtr &n)
Copy the given pointer to this class.
Result total() const
Return a total of all entries in this vector.
virtual Counter value() const =0
Temp(signed short value)
Create a ConstNode.
ScalarProxyNode(const ScalarProxy< Stat > &p)
Storage * data()
Retrieve the storage.
void prepare(Info *info)
Prepare stat data for dumping or serialization.
AvgStor(Info *info)
Build and initializes this stat storage.
Counter sum
Current total.
void operator-=(const U &v)
Decrement the stat by the given value.
Distribution & init(Counter min, Counter max, Counter bkt)
Set the parameters of this distribution.
Implementation of a sparse histogram stat.
std::vector< DistData > data
VectorDistribution(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
const FlagsType display
Print this stat.
Calculates the per tick mean and variance of the samples.
bool zero() const
Return true if no samples have been added.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Temp(const Value &s)
Create a new ScalarStatNode.
VectorAverageDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Histogram(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Temp(float value)
Create a ConstNode.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
Temp(unsigned int value)
Create a ConstNode.
std::map< const void *, Info * > MapType
const Stat::Storage * data() const
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
SparseHistBase(Group *parent, const char *name, const char *desc)
void dec(Counter val)
Deccrement the current count by the provided value, calls set.
Counter bucket_size
The number of entries in each bucket.
const Storage * data(off_type index) const
Retrieve a const pointer to the storage.
Temp operator+(Temp l, Temp r)
Templatized storage and interface to a per-tick average stat.
Helper class to construct formula node trees.
void reset()
Reset stat value to default.
Temp(signed long value)
Create a ConstNode.
SparseHistInfoProxy< Derived > Info
StandardDeviation(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Construct and initialize this distribution.
const VResult & result() const
Counter max_track
The maximum value to track.
const FlagsType total
Print the total.
void registerDumpCallback(Callback *cb)
Register a callback that should be called whenever statistics are about to be dumped.
Average(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
Templatized storage and interface for a distribution stat.
size_type size() const
Return the number of elements, always 1 for a scalar.
SparseHistogram(Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
const Storage * data(off_type index) const
Result result() const
Return the value of this stat as a result type.
Counter max_val
The largest value sampled.
Tick lastReset
The tick of the last reset.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Templatized storage for distribution that calculates per tick mean and variance.
void reset(Info *info)
Reset stat value to default.
const VResult & result() const
Return the result vector of this subtree.
void sample(Counter val, int number)
Add a value the given number of times to this running average.
Result result() const
Return the current average.
void prepare()
Prepare the stat for dumping.
const Stat::Storage * data(off_type index) const
const Storage * data() const
Retrieve a const pointer to the storage.
const Storage * data() const
Retrieve a const pointer to the storage.
Temp constantVector(T val)
const Info * info() const
The parameters for a sparse histogram stat.
Counter underflow
The number of values sampled less than min.
void processResetQueue()
Process all the callbacks in the reset callbacks queue.
Storage * data()
Retrieve the storage.
const StorageParams * storageParams
const ScalarProxy & operator=(const ScalarProxy &sp)
Set this proxy equal to the provided one.
size_type size() const
Return the number of buckets in this distribution.
void operator-=(const U &v)
Decrement the stat by the given value.
Counter value() const
Return the current value of this stat as its base type.
void add(DistBase &d)
Add the argument distribution to the this distribution.
SparseHistData data
Local storage for the entry values, used for printing.
void prepare(Info *info, SparseHistData &data)
Derived & ysubname(off_type index, const std::string &subname)
Temp(const Scalar &s)
Create a new ScalarStatNode.
Vector2dInfoProxy< Derived > Info
bool validateStatName(const string &name)
Counter data
The statistic value.
void sample(Counter val, int number)
Add a value to the distribution for the given number of times.
Result total() const override
Return the total of the result vector.
size_type size() const
Return the number of nodes in the subtree starting at this node.
const Storage * data(off_type index) const
DistInfoProxy(Stat &stat)
size_type size() const
Return the number of elements, always 1 for a scalar.
SparseHistogram & init(size_type size)
Set the parameters of this histogram.
SparseHistStor(Info *info)
Temp operator*(Temp l, Temp r)
off_type index
The index to access in the parent VectorBase.
size_type size() const
Return the number of buckets in this distribution.
VectorProxy< Derived > Proxy
A vector of Average stats.
Counter value() const
Return the current count.
VectorProxy(Stat &s, off_type o, size_type l)
void reset()
Reset stat value to default.
ConstVectorNode(const T &s)
Stat::Storage * data(off_type index)
const VResult & result() const
Return the result vector of this subtree.
size_type size() const
Return the number of nodes in the subtree starting at this node.
void inc(Counter val)
Increment the stat by the given value.
void reset(Info *info)
Reset stat value to default.
size_type size() const
Return the number of nodes in the subtree starting at this node.
Temp(unsigned short value)
Create a ConstNode.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
size_type size() const
Return the number of nodes in the subtree starting at this node.
void prepare(Info *info, DistData &data)
bool zero() const
Returns true if any calls to sample have been made.
const VResult & result() const
Return the result vector of this subtree.
void operator--()
Decrement the stat by 1.
const ScalarProxy< Stat > proxy
size_type size() const
Return the number of entries in this stat, 1.
void operator=(const U &v)
Set the data value to the given value.
void dump()
Dump all statistics data to the registered outputs.
Vector2dInfoProxy(Stat &stat)
A 2-Dimensional vecto of scalar stats.
bool check() const
Check that this stat has been set up properly and is ready for use.
std::map< std::string, Info * > NameMapType
Storage * data(off_type index)
DistInfoProxy< Derived > Info
VectorStandardDeviation & init(size_type size)
Initialize storage for this distribution.
void reset(Info *info)
Reset stat value to default.
VectorBase(Group *parent, const char *name, const char *desc)
InfoProxyType< Derived > Info
bool zero() const
Returns true if any calls to sample have been made.
This is a vector of StandardDeviation stats.
Derived & ysubnames(const char **names)
Temp(double value)
Create a ConstNode.
void registerHandlers(Handler reset_handler, Handler dump_handler)
Temp(unsigned long value)
Create a ConstNode.
NodePtr node
Pointer to a Node object.
void prepare(Info *info)
Prepare stat data for dumping or serialization.
Derived & functor(T &func)
void visit(Output &visitor)
Info * info()
Grab the information class for this statistic.
size_type size() const
Return the number of nodes in the subtree starting at this node.
void operator++(int)
Increment the stat by 1.
A proxy similar to the FunctorProxy, but allows calling a method of a bound object, instead of a global free-standing function.
Counter value() const
Return the value of this stat as its base type.
Counter value() const
Return the current value of this stat as its base type.
Counter samples
The number of samples.
Temp(const Vector &s)
Create a new VectorStatNode.
Counter sum
The current sum.
Implementation of a vector of stats.
void operator+=(const U &v)
Increment the stat by the given value.
DistData data
Local storage for the entry values, used for printing.
bool check() const
Check that this stat has been set up properly and is ready for use.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
const std::string & name() const
std::vector< std::string > subnames
Names and descriptions of subfields.
VectorDistBase(Group *parent, const char *name, const char *desc)
const std::string to_string(sc_enc enc)
void reset()
Reset stat value to default.
Templatized storage and interface for a distribution that calculates mean and variance.
DistProxy(Stat &s, off_type i)
bool zero() const
Return true if no samples have been added.
Stat & stat
Pointer to the parent Vector.
A proxy class to access the stat at a given index in a VectorBase stat.
AvgSampleStor(Info *info)
Create and initialize this storage.
void reset(Info *info)
Reset stat value to default.