The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::statistics::expression::StatVariable Struct Reference
Inheritance diagram for sparta::statistics::expression::StatVariable:
Collaboration diagram for sparta::statistics::expression::StatVariable:

Public Member Functions

 StatVariable ()=delete
 Not default constructable.
 
 StatVariable (const TreeNode *n, std::vector< const TreeNode * > &used)
 Construct from a given Counter or Statistic.
 
 StatVariable (std::shared_ptr< StatInstCalculator > &calculator, std::vector< const TreeNode * > &used)
 Construct from a given StatInstCalculator (wrapper class around a SpartaHandler).
 
 StatVariable (const StatVariable &rhp)
 
virtual StatVariableclone_ () const override
 Deep copy of the content of this item.
 
virtual double evaluate_ () const override
 Compute value of this item in simulation.
 
virtual bool supportsCompression () const override
 
StatisticInstancegetStatisticInstance ()
 Returns the sparta StatisticInstance contained in this ExpressionNode Node.
 
virtual void start () override
 
virtual void end () override
 
virtual void dump (std::ostream &o, bool show_range=true, bool resolve_subexprs=true) const override
 Dump the content of this expression item.
 
virtual void getClocks (std::vector< const Clock * > &clocks) const override
 Populates a vector with the clocks found in this subexpression node.
 
- Public Member Functions inherited from sparta::statistics::expression::ExpressionNode
 ExpressionNode (const ExpressionNode &)=delete
 No copy-constructable.
 
ExpressionNodeclone () const
 
uint32_t getStats (std::vector< const StatisticInstance * > &results) const
 Gets the statistics present in this expression.
 
double evaluate ()
 Compute value of this item in simulation. Must be implemented by subclass.
 

Public Attributes

sparta::StatisticInstance stat_
 Contained statistic.
 

Detailed Description

Definition at line 23 of file ExpressionNodeVariables.hpp.

Constructor & Destructor Documentation

◆ StatVariable() [1/3]

sparta::statistics::expression::StatVariable::StatVariable ( const TreeNode n,
std::vector< const TreeNode * > &  used 
)
inline

Construct from a given Counter or Statistic.

Parameters
nTreeNode to use as base for this variable
usedVector of TreeNodes already used within the expression containing this variable. New nodes are tested against this list in order to ensure there are no cycles in expressions

Definition at line 42 of file ExpressionNodeVariables.hpp.

◆ StatVariable() [2/3]

sparta::statistics::expression::StatVariable::StatVariable ( std::shared_ptr< StatInstCalculator > &  calculator,
std::vector< const TreeNode * > &  used 
)
inline

Construct from a given StatInstCalculator (wrapper class around a SpartaHandler).

Parameters
calculatorUser-defined callback which generates the stat value.
Note
calculator->getNode() must return a non-null TreeNode.
Parameters
usedVector of TreeNodes already used within the expression containing this variable. New nodes are tested against this list in order to ensure there are no cycles in expressions.

Definition at line 57 of file ExpressionNodeVariables.hpp.

◆ StatVariable() [3/3]

sparta::statistics::expression::StatVariable::StatVariable ( const StatVariable rhp)
inline

Definition at line 62 of file ExpressionNodeVariables.hpp.

◆ ~StatVariable()

virtual sparta::statistics::expression::StatVariable::~StatVariable ( )
inlinevirtual

Definition at line 67 of file ExpressionNodeVariables.hpp.

Member Function Documentation

◆ clone_()

virtual StatVariable * sparta::statistics::expression::StatVariable::clone_ ( ) const
inlineoverridevirtual

Deep copy of the content of this item.

To be overridden by subclasses

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 71 of file ExpressionNodeVariables.hpp.

Here is the call graph for this function:

◆ dump()

virtual void sparta::statistics::expression::StatVariable::dump ( std::ostream &  o,
bool  show_range = true,
bool  resolve_subexprs = true 
) const
inlineoverridevirtual

Dump the content of this expression item.

Note
Must not evaluate the expression
Parameters
oOstream to write to
show_rangeShould the range be shown in any subexpression nodes.
resolve_subexprsShould any referenced statistic defs be expanded to their full expressions so that this becomes an expression containing only counters.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 101 of file ExpressionNodeVariables.hpp.

Here is the call graph for this function:

◆ end()

virtual void sparta::statistics::expression::StatVariable::end ( )
inlineoverridevirtual

◆ evaluate_()

virtual double sparta::statistics::expression::StatVariable::evaluate_ ( ) const
inlineoverridevirtual

Compute value of this item in simulation.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 75 of file ExpressionNodeVariables.hpp.

Here is the call graph for this function:

◆ getClocks()

virtual void sparta::statistics::expression::StatVariable::getClocks ( std::vector< const Clock * > &  clocks) const
inlineoverridevirtual

Populates a vector with the clocks found in this subexpression node.

Parameters
clocksVector of clocks to which any found clocks will be appended. This vector is not cleared.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 107 of file ExpressionNodeVariables.hpp.

Here is the call graph for this function:

◆ getStatisticInstance()

StatisticInstance * sparta::statistics::expression::StatVariable::getStatisticInstance ( )
inline

Returns the sparta StatisticInstance contained in this ExpressionNode Node.

Returns
StatisticInstance owned by this Object. This pointer is valid for as long as this node exists.

Definition at line 90 of file ExpressionNodeVariables.hpp.

◆ start()

virtual void sparta::statistics::expression::StatVariable::start ( )
inlineoverridevirtual

◆ supportsCompression()

virtual bool sparta::statistics::expression::StatVariable::supportsCompression ( ) const
inlineoverridevirtual

Member Data Documentation

◆ stat_

sparta::StatisticInstance sparta::statistics::expression::StatVariable::stat_

Contained statistic.

Definition at line 28 of file ExpressionNodeVariables.hpp.


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