SST  15.1.0
StructuralSimulationToolkit
SST::Statistics::StatisticProcessingEngine Class Reference

An SST core component that handles timing and event processing informing all registered Statistics to generate their outputs at desired rates. More...

#include <statengine.h>

Inheritance diagram for SST::Statistics::StatisticProcessingEngine:
SST::Core::Serialization::serializable SST::Core::Serialization::serializable_base

Public Types

using StatArray_t = std::vector< StatisticBase * >
 
using StatMap_t = std::map< SimTime_t, StatArray_t * >
 

Public Member Functions

template<class T >
Statistic< T > * createStatistic (BaseComponent *comp, const std::string &stat_name, const std::string &stat_sub_id, Params &params)
 Called to create an enabled (non-null) statistic of the requested type This function also registers the statistic with the engine. More...
 
template<class T >
Statistic< T > * createDisabledStatistic ()
 Called to create a disabled (null) statistic of the requested type. More...
 
bool reregisterStatisticWithEngine (StatisticBase *stat, SimTime_t start_at_time, SimTime_t stop_at_time, SimTime_t output_factor)
 Re-registers a statistic with the engine during a restart run. More...
 
void performStatisticOutput (StatisticBase *stat, bool end_of_sim_flag=false)
 Called by the Components and Subcomponent to perform a statistic Output. More...
 
void performGlobalStatisticOutput (bool end_of_sim_flag=false)
 Called by the Components and Subcomponent to perform a global statistic Output. More...
 
uint8_t getStatLoadLevel () const
 Return global statistic load level.
 
SimTime_t getStatisticStartTimeFactor (StatisticBase *stat)
 Get the start time factor belonging to 'stat'. More...
 
SimTime_t getStatisticStopTimeFactor (StatisticBase *stat)
 Get the stop time factor belonging to 'stat'. More...
 
void serialize_order (SST::Core::Serialization::serializer &ser) override
 Serialization support for the engine. More...
 
ImplementSerializable(SST::Statistics::StatisticProcessingEngine) private friend int ::main (int argc, char **argv)
 
friend void ::finalize_statEngineConfig ()
 
 StatisticProcessingEngine ()
 Constructor.
 
 ~StatisticProcessingEngine ()
 Destructor.
 
void setup (StatsConfig *stats_config)
 
void restart ()
 
bool registerStatisticWithEngine (StatisticBase *stat, Params &params)
 Registers a newly-created statistic with the engine Statistics created during a restart run should use reregisterStatisticWithEngine instead.
 
StatisticOutputgetOutputForStatistic (const StatisticBase *stat) const
 
StatisticGroupgetGroupForStatistic (const StatisticBase *stat) const
 
bool addPeriodicBasedStatistic (SimTime_t factor, StatisticBase *stat)
 
void addEventBasedStatistic (const UnitAlgebra &count, StatisticBase *stat)
 
void setStatisticStartTime (StatisticBase *stat, SimTime_t factor)
 
void setStatisticStopTime (StatisticBase *stat, SimTime_t factor)
 
void finalizeInitialization ()
 
void startOfSimulation ()
 
void endOfSimulation ()
 
void performStatisticOutputImpl (StatisticBase *stat, bool end_of_sim_flag)
 
void performStatisticGroupOutputImpl (StatisticGroup &group, bool end_of_sim_flag)
 
bool handleStatisticEngineClockEvent (Cycle_t cycle_num, SimTime_t time_factor)
 
bool handleGroupClockEvent (Cycle_t cycle_num, StatisticGroup *group)
 
void handleStatisticEngineStartTimeEvent (SimTime_t time_factor)
 
void handleStatisticEngineStopTimeEvent (SimTime_t time_factor)
 
void castError (const std::string &type, const std::string &stat_name, const std::string &field_name)
 
- Public Member Functions inherited from SST::Core::Serialization::serializable_base
virtual const char * cls_name () const =0
 
virtual uint32_t cls_id () const =0
 
virtual std::string serialization_name () const =0
 

Static Public Member Functions

static const std::vector< StatisticOutput * > & getStatOutputs ()
 Return the statistic output objects - static as they are per-MPI rank.
 
static void static_setup (StatsConfig *stats_config)
 Called to setup the StatOutputs, which are shared across all the StatEngines on the same MPI rank.
 
static void stat_outputs_simulation_start ()
 Called to notify StatOutputs that simulation has started.
 
static void stat_outputs_simulation_end ()
 Called to notify StatOutputs that simulation has ended.
 
static StatisticOutputcreateStatisticOutput (const ConfigStatOutput &cfg)
 

Data Fields

StatMap_t start_time_map_
 
StatMap_t stop_time_map_
 
bool simulation_started_
 
Outputoutput_
 
uint8_t stat_load_level_
 
std::map< SimTime_t, StatisticGroupstat_default_groups_
 
std::vector< StatisticGroupstat_groups_
 

Static Public Attributes

static std::vector< StatisticOutput * > stat_outputs_
 
- Static Public Attributes inherited from SST::Core::Serialization::serializable
static constexpr uint32_t NullClsId = std::numeric_limits<uint32_t>::max()
 
- Static Public Attributes inherited from SST::Core::Serialization::serializable_base
static constexpr uint32_t NullClsId = std::numeric_limits<uint32_t>::max()
 

Additional Inherited Members

- Protected Types inherited from SST::Core::Serialization::serializable_base
enum  cxn_flag_t { ConstructorFlag }
 
- Static Protected Member Functions inherited from SST::Core::Serialization::serializable_base
static void serializable_abort (uint32_t line, const char *file, const char *func, const char *obj)
 

Detailed Description

An SST core component that handles timing and event processing informing all registered Statistics to generate their outputs at desired rates.

Member Typedef Documentation

◆ StatArray_t

◆ StatMap_t

Map of simtimes to Statistic Arrays

Member Function Documentation

◆ createDisabledStatistic()

template<class T >
Statistic<T>* SST::Statistics::StatisticProcessingEngine::createDisabledStatistic ( )
inline

Called to create a disabled (null) statistic of the requested type.

Parameters
compThe statistic owner

◆ createStatistic()

template<class T >
Statistic<T>* SST::Statistics::StatisticProcessingEngine::createStatistic ( BaseComponent comp,
const std::string &  stat_name,
const std::string &  stat_sub_id,
Params params 
)
inline

Called to create an enabled (non-null) statistic of the requested type This function also registers the statistic with the engine.

Parameters
compThe statistic owner
stat_nameThe name of the statistic
stat_sub_idAn optional id to differentiate multiple instances of the same statistic, "" if none
paramsThe parameters that should be used to configure the statistic

References SST::Params::find(), and registerStatisticWithEngine().

◆ getStatisticStartTimeFactor()

SimTime_t SST::Statistics::StatisticProcessingEngine::getStatisticStartTimeFactor ( StatisticBase stat)

Get the start time factor belonging to 'stat'.

Used during checkpoint. Linear search - could be slow.

Parameters
statThe statistic to lookup

References start_time_map_.

◆ getStatisticStopTimeFactor()

SimTime_t SST::Statistics::StatisticProcessingEngine::getStatisticStopTimeFactor ( StatisticBase stat)

Get the stop time factor belonging to 'stat'.

Used during checkpoint. Linear search - could be slow.

Parameters
statThe statistic to lookup

References stop_time_map_.

◆ performGlobalStatisticOutput()

void SST::Statistics::StatisticProcessingEngine::performGlobalStatisticOutput ( bool  end_of_sim_flag = false)

Called by the Components and Subcomponent to perform a global statistic Output.

This routine will force ALL Components and Subcomponents to output their statistic information. This may lead to unexpected results if the statistic counts or data is reset on output.

Parameters
end_of_sim_flag- Indicates that the output is occurring at the end of simulation.

References stat_default_groups_, and stat_groups_.

Referenced by SST::BaseComponent::performGlobalStatisticOutput().

◆ performStatisticOutput()

void SST::Statistics::StatisticProcessingEngine::performStatisticOutput ( StatisticBase stat,
bool  end_of_sim_flag = false 
)

Called by the Components and Subcomponent to perform a statistic Output.

Parameters
stat- Pointer to the statistic.
end_of_sim_flag- Indicates that the output is occurring at the end of simulation.

Referenced by SST::BaseComponent::performStatisticOutput().

◆ reregisterStatisticWithEngine()

bool SST::Statistics::StatisticProcessingEngine::reregisterStatisticWithEngine ( StatisticBase stat,
SimTime_t  start_at_time,
SimTime_t  stop_at_time,
SimTime_t  output_factor 
)

Re-registers a statistic with the engine during a restart run.

Newly created statistics (not read from a checkpoint) use 'registerStatisticWithEngine' instead.

Parameters
statThe statistic to re-register
start_at_timeIf the statistic should be enabled after some time, the time (in core cycles) else 0
stop_at_timeIf the statistic should be disabled after some time, the time (in core cycles) else 0
output_factorIf the statistic should be output at a regular time interval, the interval (in core cycles) else 0

References SST::Statistics::StatisticBase::getComponent(), SST::Statistics::StatisticBase::getFullStatName(), SST::Statistics::StatisticBase::isNullStatistic(), SST::Statistics::StatisticBase::isOutputPeriodic(), stat_default_groups_, and SST::Output::verbose().

◆ serialize_order()

void SST::Statistics::StatisticProcessingEngine::serialize_order ( SST::Core::Serialization::serializer ser)
overridevirtual

Serialization support for the engine.

Implements SST::Core::Serialization::serializable_base.

References simulation_started_, stat_groups_, and stat_load_level_.

Field Documentation

◆ simulation_started_

bool SST::Statistics::StatisticProcessingEngine::simulation_started_

Flag showing if Simulation has started

Referenced by serialize_order().

◆ start_time_map_

StatMap_t SST::Statistics::StatisticProcessingEngine::start_time_map_

Map of Array's of Statistics that are started at a sim time

Referenced by getStatisticStartTimeFactor().

◆ stat_default_groups_

std::map<SimTime_t, StatisticGroup> SST::Statistics::StatisticProcessingEngine::stat_default_groups_

Statistic groups for statistics that are not explicitly assigned to one

Referenced by performGlobalStatisticOutput(), reregisterStatisticWithEngine(), StatisticProcessingEngine(), and ~StatisticProcessingEngine().

◆ stat_groups_

std::vector<StatisticGroup> SST::Statistics::StatisticProcessingEngine::stat_groups_

A list of all statistic group objects

Referenced by performGlobalStatisticOutput(), serialize_order(), and ~StatisticProcessingEngine().

◆ stat_load_level_

uint8_t SST::Statistics::StatisticProcessingEngine::stat_load_level_

The global statistic load level

Referenced by getStatLoadLevel(), and serialize_order().

◆ stat_outputs_

std::vector< StatisticOutput * > SST::Statistics::StatisticProcessingEngine::stat_outputs_
static

The statistic output objects that exist on this engine's rank

Referenced by getStatOutputs(), stat_outputs_simulation_end(), stat_outputs_simulation_start(), and static_setup().

◆ stop_time_map_

StatMap_t SST::Statistics::StatisticProcessingEngine::stop_time_map_

Map of Array's of Statistics that are stopped at a sim time

Referenced by getStatisticStopTimeFactor().


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