gem5  v21.1.0.2
Public Member Functions | Protected Attributes | Friends | List of all members
gem5::statistics::Formula Class Reference

A formula for statistics that is calculated when printed. More...

#include <statistics.hh>

Inheritance diagram for gem5::statistics::Formula:
gem5::statistics::DataWrapVec< Formula, FormulaInfoProxy > gem5::statistics::DataWrap< Formula, FormulaInfoProxy > gem5::statistics::InfoAccess

Public Member Functions

 Formula (Group *parent=nullptr, const char *name=nullptr, const char *desc=nullptr)
 Create and initialize thie formula, and register it with the database. More...
 
 Formula (Group *parent, const char *name, const units::Base *unit, const char *desc=nullptr)
 
 Formula (Group *parent, const char *name, const char *desc, const Temp &r)
 
 Formula (Group *parent, const char *name, const units::Base *unit, const char *desc, const Temp &r)
 
const Formulaoperator= (const Temp &r)
 Set an unitialized Formula to the given root. More...
 
template<typename T >
const Formulaoperator= (const T &v)
 
const Formulaoperator+= (Temp r)
 Add the given tree to the existing one. More...
 
const Formulaoperator/= (Temp r)
 Divide the existing tree by the given one. More...
 
void result (VResult &vec) const
 Return the result of the Fomula in a vector. More...
 
Result total () const
 Return the total Formula result. More...
 
size_type size () const
 Return the number of elements in the tree. More...
 
void prepare ()
 
void reset ()
 Formulas don't need to be reset. More...
 
bool zero () const
 
std::string str () const
 
- Public Member Functions inherited from gem5::statistics::DataWrapVec< Formula, FormulaInfoProxy >
 DataWrapVec (Group *parent=nullptr, const char *name=nullptr, const units::Base *unit=units::Unspecified::get(), const char *desc=nullptr)
 
Formulasubname (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. More...
 
Formulasubdesc (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 simulation. More...
 
void prepare ()
 
void reset ()
 
- Public Member Functions inherited from gem5::statistics::DataWrap< Formula, FormulaInfoProxy >
const Infoinfo () const
 
 DataWrap ()=delete
 
 DataWrap (const DataWrap &)=delete
 
 DataWrap (Group *parent, const char *name, const units::Base *unit, const char *desc)
 
DataWrapoperator= (const DataWrap &)=delete
 
Formulaname (const std::string &name)
 Set the name and marks this stat to print at the end of simulation. More...
 
const std::string & name () const
 
FormulasetSeparator (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
 
Formulaunit (const units::Base *_unit)
 Set the unit of the stat. More...
 
Formuladesc (const std::string &_desc)
 Set the description and marks this stat to print at the end of simulation. More...
 
Formulaprecision (int _precision)
 Set the precision and marks this stat to print at the end of simulation. More...
 
Formulaflags (Flags _flags)
 Set the flags and marks this stat to print at the end of simulation. More...
 
Formulaprereq (const Stat &prereq)
 Set the prerequisite stat and marks this stat to print at the end of simulation. More...
 
- Public Member Functions inherited from gem5::statistics::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 Attributes

NodePtr root
 The root of the tree which represents the Formula. More...
 

Friends

class Temp
 

Additional Inherited Members

- Public Types inherited from gem5::statistics::DataWrapVec< Formula, FormulaInfoProxy >
typedef FormulaInfoProxy< FormulaInfo
 
- Public Types inherited from gem5::statistics::DataWrap< Formula, FormulaInfoProxy >
typedef FormulaInfoProxy< FormulaInfo
 
- Protected Member Functions inherited from gem5::statistics::DataWrap< Formula, FormulaInfoProxy >
Formulaself ()
 
Infoinfo ()
 
- Protected Member Functions inherited from gem5::statistics::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

A formula for statistics that is calculated when printed.

A formula is stored as a tree of Nodes that represent the equation to calculate.

See also
Stat, ScalarStat, VectorStat, Node, Temp

Definition at line 2536 of file statistics.hh.

Constructor & Destructor Documentation

◆ Formula() [1/4]

gem5::statistics::Formula::Formula ( Group parent = nullptr,
const char *  name = nullptr,
const char *  desc = nullptr 
)

Create and initialize thie formula, and register it with the database.

Definition at line 139 of file statistics.cc.

◆ Formula() [2/4]

gem5::statistics::Formula::Formula ( Group parent,
const char *  name,
const units::Base unit,
const char *  desc = nullptr 
)

Definition at line 146 of file statistics.cc.

◆ Formula() [3/4]

gem5::statistics::Formula::Formula ( Group parent,
const char *  name,
const char *  desc,
const Temp r 
)

Definition at line 152 of file statistics.cc.

References gem5::MipsISA::r.

◆ Formula() [4/4]

gem5::statistics::Formula::Formula ( Group parent,
const char *  name,
const units::Base unit,
const char *  desc,
const Temp r 
)

Definition at line 160 of file statistics.cc.

References gem5::MipsISA::r.

Member Function Documentation

◆ operator+=()

const Formula & gem5::statistics::Formula::operator+= ( Temp  r)

Add the given tree to the existing one.

Parameters
rThe root of the expression tree.
Returns
a reference to this formula.

Definition at line 178 of file statistics.cc.

References gem5::MipsISA::r, root, gem5::statistics::InfoAccess::setInit(), and size().

◆ operator/=()

const Formula & gem5::statistics::Formula::operator/= ( Temp  r)

Divide the existing tree by the given one.

Parameters
rThe root of the expression tree.
Returns
a reference to this formula.

Definition at line 192 of file statistics.cc.

References gem5::MipsISA::r, root, and size().

◆ operator=() [1/2]

template<typename T >
const Formula& gem5::statistics::Formula::operator= ( const T &  v)
inline

Definition at line 2567 of file statistics.hh.

References Temp, and gem5::ArmISA::v.

◆ operator=() [2/2]

const Formula & gem5::statistics::Formula::operator= ( const Temp r)

Set an unitialized Formula to the given root.

Parameters
rThe root of the expression tree.
Returns
a reference to this formula.

Definition at line 168 of file statistics.cc.

References gem5::MipsISA::r, root, gem5::statistics::InfoAccess::setInit(), and size().

◆ prepare()

void gem5::statistics::Formula::prepare ( )
inline

Definition at line 2613 of file statistics.hh.

◆ reset()

void gem5::statistics::Formula::reset ( )

Formulas don't need to be reset.

Definition at line 225 of file statistics.cc.

◆ result()

void gem5::statistics::Formula::result ( VResult vec) const

Return the result of the Fomula in a vector.

If there were no Vector components to the Formula, then the vector is size 1. If there were, like x/y with x being a vector of size 3, then the result returned will be x[0]/y, x[1]/y, x[2]/y, respectively.

Returns
The result vector.

Definition at line 203 of file statistics.cc.

References root, and gem5::PowerISA::vec.

Referenced by gem5::statistics::FormulaNode::result(), and zero().

◆ size()

size_type gem5::statistics::Formula::size ( ) const

Return the number of elements in the tree.

Definition at line 216 of file statistics.cc.

References root.

Referenced by operator+=(), operator/=(), operator=(), and gem5::statistics::FormulaNode::size().

◆ str()

std::string gem5::statistics::Formula::str ( ) const

Definition at line 241 of file statistics.cc.

References root.

Referenced by gem5::statistics::FormulaNode::str().

◆ total()

Result gem5::statistics::Formula::total ( ) const

Return the total Formula result.

If there is a Vector component to this Formula, then this is the result of the Formula if the formula is applied after summing all the components of the Vector. For example, if Formula is x/y where x is size 3, then total() will return (x[1]+x[2]+x[3])/y. If there is no Vector component, total() returns the same value as the first entry in the VResult val() returns.

Returns
The total of the result vector.

Definition at line 210 of file statistics.cc.

References root.

Referenced by gem5::statistics::FormulaNode::total().

◆ zero()

bool gem5::statistics::Formula::zero ( ) const

Definition at line 230 of file statistics.cc.

References gem5::ArmISA::i, result(), and gem5::PowerISA::vec.

Friends And Related Function Documentation

◆ Temp

friend class Temp
friend

Definition at line 2541 of file statistics.hh.

Referenced by operator=().

Member Data Documentation

◆ root

NodePtr gem5::statistics::Formula::root
protected

The root of the tree which represents the Formula.

Definition at line 2540 of file statistics.hh.

Referenced by operator+=(), operator/=(), operator=(), result(), size(), str(), and total().


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

Generated on Tue Sep 21 2021 12:32:29 for gem5 by doxygen 1.8.17