12 #ifndef _H_SST_CORE_STATISTICS_BASE
13 #define _H_SST_CORE_STATISTICS_BASE
15 #include <sst/core/sst_types.h>
16 #include <sst/core/params.h>
17 #include <sst/core/oneshot.h>
18 #include <sst/core/statapi/statfieldinfo.h>
23 namespace Statistics {
24 class StatisticOutput;
25 class StatisticProcessingEngine;
40 typedef enum {STAT_MODE_UNDEFINED, STAT_MODE_COUNT, STAT_MODE_PERIODIC}
StatMode_t;
44 void enable() {m_statEnabled =
true;}
87 inline const std::string&
getStatName()
const {
return m_statName;}
90 inline const std::string&
getStatSubId()
const {
return m_statSubId;}
181 void setRegisteredCollectionMode(
StatMode_t mode) {m_registeredCollectionMode = mode;}
184 static std::string buildStatisticFullName(
const char* compName,
const char* statName,
const char* statSubId);
185 static std::string buildStatisticFullName(
const std::string& compName,
const std::string& statName,
const std::string& statSubId);
192 virtual void registerOutputFields(StatisticOutput* statOutput) = 0;
199 virtual void outputStatisticData(StatisticOutput* statOutput,
bool EndOfSimFlag) = 0;
206 virtual bool isStatModeSupported(
StatMode_t mode)
const {
return true;}
209 bool operator==(StatisticBase& checkStat);
212 void initializeStatName(
const char* compName,
const char* statName,
const char* statSubId);
213 void initializeStatName(
const std::string& compName,
const std::string& statName,
const std::string& statSubId);
215 void initializeProperties();
216 void checkEventForOutput();
219 void delayOutputExpiredHandler();
220 void delayCollectionExpiredHandler();
226 Component* m_component;
227 std::string m_statName;
228 std::string m_statSubId;
229 std::string m_statFullName;
230 std::string m_statTypeName;
233 uint64_t m_currentCollectionCount;
234 uint64_t m_collectionCountLimit;
238 bool m_outputEnabled;
239 bool m_resetCountOnOutput;
240 bool m_clearDataOnOutput;
241 bool m_outputAtEndOfSim;
243 bool m_outputDelayed;
244 bool m_collectionDelayed;
245 bool m_savedStatEnabled;
246 bool m_savedOutputEnabled;
247 OneShot::HandlerBase* m_outputDelayedHandler;
248 OneShot::HandlerBase* m_collectionDelayedHandler;
262 template <
typename T>
301 virtual void addData_impl(T data) = 0;
void setFlagOutputAtEndOfSim(bool flag)
Set the Output At End Of Sim flag.
Definition: statbase.h:80
void addData(T data)
Add data to the Statistic This will call the addData_impl() routine in the derived Statistic...
Definition: statbase.h:270
virtual void setCollectionCountLimit(uint64_t newLimit)
Set the collection count limit to a defined value.
Definition: statbase.cc:52
Statistic(Component *comp, std::string &statName, std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:289
void delayCollection(const char *delayTime)
Delay the statistic from collecting data for a specified delay time.
Definition: statbase.cc:124
void setFlagClearDataOnOutput(bool flag)
Set the Clear Data On Output flag.
Definition: statbase.h:75
Main component object for the simulation.
Definition: component.h:56
Forms the base class for statistics gathering within SST.
Definition: statbase.h:36
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:177
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:120
void enable()
Enable Statistic for collections.
Definition: statbase.h:44
void delayOutput(const char *delayTime)
Delay the statistic from outputting data for a specified delay time.
Definition: statbase.cc:110
StatMode_t getRegisteredCollectionMode() const
Return the collection mode that is registered.
Definition: statbase.h:132
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:263
virtual bool isNullStatistic() const
Indicate if the Statistic is a NullStatistic.
Definition: statbase.h:150
Component * getComponent() const
Return a pointer to the parent Component.
Definition: statbase.h:108
const std::string & getCompName() const
Return the Component Name.
Definition: statbase.cc:30
virtual void incrementCollectionCount()
Increment current collection count.
Definition: statbase.cc:35
virtual void resetCollectionCount()
Set the current collection count to 0.
Definition: statbase.cc:47
const StatisticFieldInfo::fieldType_t & getStatDataType() const
Return the Statistic data type.
Definition: statbase.h:99
bool getFlagOutputAtEndOfSim() const
Return the OutputAtEndOfSim flag value.
Definition: statbase.h:129
bool getFlagClearDataOnOutput() const
Return the ClearDataOnOutput flag value.
Definition: statbase.h:126
bool isEnabled() const
Return the enable status of the Statistic.
Definition: statbase.h:111
virtual bool isReady() const
Indicate that the Statistic is Ready to be used.
Definition: statbase.h:147
void disable()
Disable Statistic for collections.
Definition: statbase.h:47
bool isOutputEnabled() const
Return the enable status of the Statistic's ability to output data.
Definition: statbase.h:114
StatMode_t
Statistic collection mode.
Definition: statbase.h:40
virtual void clearStatisticData()
Inform the Statistic to clear its data.
Definition: statbase.h:51
void setFlagResetCountOnOutput(bool flag)
Set the Reset Count On Output flag.
Definition: statbase.h:69
Parameter store.
Definition: params.h:46
bool getFlagResetCountOnOutput() const
Return the ResetCountOnOutput flag value.
Definition: statbase.h:123
const std::string & getStatSubId() const
Return the Statistic SubId.
Definition: statbase.h:90
const char * getStatDataTypeFullName() const
Return the Statistic data type.
Definition: statbase.h:105
const std::string & getFullStatName() const
Return the full Statistic name of Component.StatName.SubId.
Definition: statbase.h:93
virtual void setCollectionCount(uint64_t newCount)
Set the current collection count to a defined value.
Definition: statbase.cc:41
const char * getStatDataTypeShortName() const
Return the Statistic data type.
Definition: statbase.h:102
void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType)
Set the Statistic Data Type.
Definition: statbase.h:174
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:33
Params & getParams()
Return the Statistic Parameters.
Definition: statbase.h:171
uint64_t getCollectionCountLimit() const
Return the collection count limit.
Definition: statbase.h:117
const std::string & getStatTypeName() const
Return the Statistic type name.
Definition: statbase.h:96
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:27
const std::string & getStatName() const
Return the Statistic Name.
Definition: statbase.h:87
fieldType_t
Supported Field Types.
Definition: statfieldinfo.h:36