gem5  v20.1.0.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
Stats::ScalarBase< Derived, Stor > Class Template Reference

Implementation of a scalar stat. More...

#include <statistics.hh>

Inheritance diagram for Stats::ScalarBase< Derived, Stor >:
Stats::DataWrap< Derived, ScalarInfoProxy > Stats::InfoAccess

Public Types

typedef Stor Storage
 
typedef Stor::Params Params
 
- Public Types inherited from Stats::DataWrap< Derived, ScalarInfoProxy >
typedef ScalarInfoProxy< Derived > Info
 

Public Member Functions

Counter value () const
 Return the current value of this stat as its base type. More...
 
 ScalarBase (Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
 
void operator++ ()
 Increment the stat by 1. More...
 
void operator-- ()
 Decrement the stat by 1. More...
 
void operator++ (int)
 Increment the stat by 1. More...
 
void operator-- (int)
 Decrement the stat by 1. More...
 
template<typename U >
void operator= (const U &v)
 Set the data value to the given value. More...
 
template<typename U >
void operator+= (const U &v)
 Increment the stat by the given value. More...
 
template<typename U >
void operator-= (const U &v)
 Decrement the stat by the given value. More...
 
size_type size () const
 Return the number of elements, always 1 for a scalar. More...
 
Counter value ()
 
Result result ()
 
Result total ()
 
bool zero ()
 
void reset ()
 
void prepare ()
 
- Public Member Functions inherited from Stats::DataWrap< Derived, ScalarInfoProxy >
const Infoinfo () const
 
 DataWrap ()=delete
 
 DataWrap (const DataWrap &)=delete
 
 DataWrap (Group *parent, const char *name, const char *desc)
 
DataWrapoperator= (const DataWrap &)=delete
 
Derived & name (const std::string &name)
 Set the name and marks this stat to print at the end of simulation. More...
 
const std::string & name () const
 
Derived & setSeparator (const std::string &_sep)
 Set the character(s) used between the name and vector number on vectors, dist, etc. More...
 
const std::string & setSeparator () const
 
Derived & desc (const std::string &_desc)
 Set the description and marks this stat to print at the end of simulation. More...
 
Derived & precision (int _precision)
 Set the precision and marks this stat to print at the end of simulation. More...
 
Derived & flags (Flags _flags)
 Set the flags and marks this stat to print at the end of simulation. More...
 
Derived & prereq (const Stat &prereq)
 Set the prerequisite stat and marks this stat to print at the end of simulation. More...
 
- Public Member Functions inherited from Stats::InfoAccess
 InfoAccess ()
 
void reset ()
 Reset the stat to the default state. More...
 
bool zero () const
 
bool check () const
 Check that this stat has been set up properly and is ready for use. More...
 

Protected Member Functions

char storage[sizeof(Storage)] __attribute__ ((aligned(8)))
 The storage of this stat. More...
 
Storagedata ()
 Retrieve the storage. More...
 
const Storagedata () const
 Retrieve a const pointer to the storage. More...
 
void doInit ()
 
- Protected Member Functions inherited from Stats::DataWrap< Derived, ScalarInfoProxy >
Derived & self ()
 
Infoinfo ()
 
- Protected Member Functions inherited from Stats::InfoAccess
void setInfo (Group *parent, Info *info)
 Set up an info class for this statistic. More...
 
void setParams (const StorageParams *params)
 Save Storage class parameters if any. More...
 
void setInit ()
 Save Storage class parameters if any. More...
 
Infoinfo ()
 Grab the information class for this statistic. More...
 
const Infoinfo () const
 Grab the information class for this statistic. More...
 

Detailed Description

template<class Derived, class Stor>
class Stats::ScalarBase< Derived, Stor >

Implementation of a scalar stat.

The type of stat is determined by the Storage template.

Definition at line 652 of file statistics.hh.

Member Typedef Documentation

◆ Params

template<class Derived , class Stor >
typedef Stor::Params Stats::ScalarBase< Derived, Stor >::Params

Definition at line 656 of file statistics.hh.

◆ Storage

template<class Derived , class Stor >
typedef Stor Stats::ScalarBase< Derived, Stor >::Storage

Definition at line 655 of file statistics.hh.

Constructor & Destructor Documentation

◆ ScalarBase()

template<class Derived , class Stor >
Stats::ScalarBase< Derived, Stor >::ScalarBase ( Group parent = nullptr,
const char *  name = nullptr,
const char *  desc = nullptr 
)
inline

Definition at line 701 of file statistics.hh.

Member Function Documentation

◆ __attribute__()

template<class Derived , class Stor >
char storage [sizeof(Storage)] Stats::ScalarBase< Derived, Stor >::__attribute__ ( (aligned(8))  )
protected

The storage of this stat.

◆ data() [1/2]

template<class Derived , class Stor >
Storage* Stats::ScalarBase< Derived, Stor >::data ( )
inlineprotected

◆ data() [2/2]

template<class Derived , class Stor >
const Storage* Stats::ScalarBase< Derived, Stor >::data ( ) const
inlineprotected

Retrieve a const pointer to the storage.

for the given index.

Parameters
indexThe vector index to access.
Returns
A const pointer to the storage object at the given index.

Definition at line 681 of file statistics.hh.

◆ doInit()

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::doInit ( )
inlineprotected

Definition at line 687 of file statistics.hh.

Referenced by Stats::ScalarBase< Scalar, StatStor >::ScalarBase().

◆ operator++() [1/2]

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::operator++ ( )
inline

Increment the stat by 1.

This calls the associated storage object inc function.

Definition at line 714 of file statistics.hh.

◆ operator++() [2/2]

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::operator++ ( int  )
inline

Increment the stat by 1.

Definition at line 722 of file statistics.hh.

◆ operator+=()

template<class Derived , class Stor >
template<typename U >
void Stats::ScalarBase< Derived, Stor >::operator+= ( const U &  v)
inline

Increment the stat by the given value.

This calls the associated storage object inc function.

Parameters
vThe value to add.

Definition at line 740 of file statistics.hh.

◆ operator--() [1/2]

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::operator-- ( )
inline

Decrement the stat by 1.

This calls the associated storage object dec function.

Definition at line 719 of file statistics.hh.

◆ operator--() [2/2]

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::operator-- ( int  )
inline

Decrement the stat by 1.

Definition at line 724 of file statistics.hh.

◆ operator-=()

template<class Derived , class Stor >
template<typename U >
void Stats::ScalarBase< Derived, Stor >::operator-= ( const U &  v)
inline

Decrement the stat by the given value.

This calls the associated storage object dec function.

Parameters
vThe value to substract.

Definition at line 748 of file statistics.hh.

◆ operator=()

template<class Derived , class Stor >
template<typename U >
void Stats::ScalarBase< Derived, Stor >::operator= ( const U &  v)
inline

Set the data value to the given value.

This calls the associated storage object set function.

Parameters
vThe new value.

Definition at line 732 of file statistics.hh.

◆ prepare()

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::prepare ( )
inline

Definition at line 765 of file statistics.hh.

◆ reset()

template<class Derived , class Stor >
void Stats::ScalarBase< Derived, Stor >::reset ( )
inline

Definition at line 764 of file statistics.hh.

◆ result()

template<class Derived , class Stor >
Result Stats::ScalarBase< Derived, Stor >::result ( )
inline

◆ size()

template<class Derived , class Stor >
size_type Stats::ScalarBase< Derived, Stor >::size ( ) const
inline

Return the number of elements, always 1 for a scalar.

Returns
1.

Definition at line 754 of file statistics.hh.

◆ total()

template<class Derived , class Stor >
Result Stats::ScalarBase< Derived, Stor >::total ( )
inline

Definition at line 760 of file statistics.hh.

◆ value() [1/2]

template<class Derived , class Stor >
Counter Stats::ScalarBase< Derived, Stor >::value ( )
inline

Definition at line 756 of file statistics.hh.

◆ value() [2/2]

template<class Derived , class Stor >
Counter Stats::ScalarBase< Derived, Stor >::value ( ) const
inline

◆ zero()

template<class Derived , class Stor >
bool Stats::ScalarBase< Derived, Stor >::zero ( )
inline

Definition at line 762 of file statistics.hh.


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

Generated on Wed Sep 30 2020 14:03:12 for gem5 by doxygen 1.8.17