gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Friends | List of all members
Stats::Formula Class Reference

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

#include <statistics.hh>

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

Public Member Functions

 Formula ()
 Create and initialize thie formula, and register it with the database. More...
 
 Formula (Temp r)
 Create a formula with the given root node, register it with the database. More...
 
const Formulaoperator= (Temp r)
 Set an unitialized Formula to the given root. More...
 
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 Stats::DataWrapVec< Formula, FormulaInfoProxy >
 DataWrapVec ()
 
 DataWrapVec (const DataWrapVec &ref)
 
void operator= (const DataWrapVec &)
 
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 Stats::DataWrap< Formula, FormulaInfoProxy >
const Infoinfo () const
 
 DataWrap ()
 
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
 
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 Stats::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 Stats::DataWrapVec< Formula, FormulaInfoProxy >
typedef FormulaInfoProxy< FormulaInfo
 
- Public Types inherited from Stats::DataWrap< Formula, FormulaInfoProxy >
typedef FormulaInfoProxy< FormulaInfo
 
- Protected Member Functions inherited from Stats::DataWrap< Formula, FormulaInfoProxy >
Formulaself ()
 
Infoinfo ()
 
 DataWrap (const DataWrap &stat)
 Copy constructor, copies are not allowed. More...
 
void operator= (const DataWrap &)
 Can't copy stats. More...
 
- Protected Member Functions inherited from Stats::InfoAccess
void setInfo (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 2895 of file statistics.hh.

Constructor & Destructor Documentation

Stats::Formula::Formula ( )

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

Definition at line 379 of file statistics.cc.

Stats::Formula::Formula ( Temp  r)

Create a formula with the given root node, register it with the database.

Parameters
rThe root of the expression tree.

Definition at line 383 of file statistics.cc.

References Stats::Temp::getNodePtr(), root, Stats::InfoAccess::setInit(), and size().

Member Function Documentation

const Formula & Stats::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 401 of file statistics.cc.

References Stats::Temp::getNodePtr(), root, Stats::InfoAccess::setInit(), and size().

const Formula & Stats::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 415 of file statistics.cc.

References root, and size().

const Formula & Stats::Formula::operator= ( 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 391 of file statistics.cc.

References Stats::Temp::getNodePtr(), root, Stats::InfoAccess::setInit(), and size().

void Stats::Formula::prepare ( )
inline

Definition at line 2962 of file statistics.hh.

void Stats::Formula::reset ( )

Formulas don't need to be reset.

Definition at line 447 of file statistics.cc.

void Stats::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 425 of file statistics.cc.

References root.

Referenced by Stats::FormulaNode::result(), and zero().

size_type Stats::Formula::size ( ) const

Return the number of elements in the tree.

Definition at line 438 of file statistics.cc.

References root.

Referenced by Formula(), operator+=(), operator/=(), operator=(), and Stats::FormulaNode::size().

string Stats::Formula::str ( ) const

Definition at line 463 of file statistics.cc.

References root.

Referenced by Stats::FormulaNode::str().

Result Stats::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 432 of file statistics.cc.

References root.

Referenced by Stats::FormulaNode::total().

bool Stats::Formula::zero ( ) const

Definition at line 452 of file statistics.cc.

References ArmISA::i, and result().

Friends And Related Function Documentation

friend class Temp
friend

Definition at line 2900 of file statistics.hh.

Member Data Documentation

NodePtr Stats::Formula::root
protected

The root of the tree which represents the Formula.

Definition at line 2899 of file statistics.hh.

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


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

Generated on Fri Jun 9 2017 13:04:40 for gem5 by doxygen 1.8.6