12 #ifndef _H_SST_CORE_STATISTICS_BASE
13 #define _H_SST_CORE_STATISTICS_BASE
17 #include <sst/core/sst_types.h>
18 #include <sst/core/warnmacros.h>
19 #include <sst/core/params.h>
20 #include <sst/core/oneshot.h>
21 #include <sst/core/statapi/statfieldinfo.h>
22 #include <sst/core/serialization/serializable.h>
27 namespace Statistics {
28 class StatisticOutput;
29 class StatisticProcessingEngine;
39 StatisticInfo(
const std::string &name,
const Params ¶ms) : name(name), params(params) { }
65 typedef enum {STAT_MODE_UNDEFINED, STAT_MODE_COUNT, STAT_MODE_PERIODIC}
StatMode_t;
69 void enable() {m_statEnabled =
true;}
112 inline const std::string&
getStatName()
const {
return m_statName;}
208 void setRegisteredCollectionMode(
StatMode_t mode) {m_registeredCollectionMode = mode;}
211 static std::string buildStatisticFullName(
const char* compName,
const char* statName,
const char* statSubId);
212 static std::string buildStatisticFullName(
const std::string& compName,
const std::string& statName,
const std::string& statSubId);
219 virtual void registerOutputFields(StatisticOutput* statOutput) = 0;
226 virtual void outputStatisticData(StatisticOutput* statOutput,
bool EndOfSimFlag) = 0;
233 virtual bool isStatModeSupported(
StatMode_t UNUSED(mode))
const {
return true;}
236 bool operator==(StatisticBase& checkStat);
239 void initializeStatName(
const char* compName,
const char* statName,
const char* statSubId);
240 void initializeStatName(
const std::string& compName,
const std::string& statName,
const std::string& statSubId);
242 void initializeProperties();
243 void checkEventForOutput();
246 void delayOutputExpiredHandler();
247 void delayCollectionExpiredHandler();
249 const StatisticGroup* getGroup()
const {
return m_group; }
250 void setGroup(
const StatisticGroup *group ) { m_group = group; }
256 BaseComponent* m_component;
257 std::string m_statName;
258 std::string m_statSubId;
259 std::string m_statFullName;
260 std::string m_statTypeName;
263 uint64_t m_currentCollectionCount;
264 uint64_t m_collectionCountLimit;
268 bool m_outputEnabled;
269 bool m_resetCountOnOutput;
270 bool m_clearDataOnOutput;
271 bool m_outputAtEndOfSim;
273 bool m_outputDelayed;
274 bool m_collectionDelayed;
275 bool m_savedStatEnabled;
276 bool m_savedOutputEnabled;
277 OneShot::HandlerBase* m_outputDelayedHandler;
278 OneShot::HandlerBase* m_collectionDelayedHandler;
279 const StatisticGroup* m_group;
293 template <
typename T>
333 virtual void addData_impl(T data) = 0;
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
void setFlagOutputAtEndOfSim(bool flag)
Set the Output At End Of Sim flag.
Definition: statbase.h:105
void addData(T data)
Add data to the Statistic This will call the addData_impl() routine in the derived Statistic...
Definition: statbase.h:301
virtual void setCollectionCountLimit(uint64_t newLimit)
Set the collection count limit to a defined value.
Definition: statbase.cc:56
void delayCollection(const char *delayTime)
Delay the statistic from collecting data for a specified delay time.
Definition: statbase.cc:128
void setFlagClearDataOnOutput(bool flag)
Set the Clear Data On Output flag.
Definition: statbase.h:100
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:47
Forms the base class for statistics gathering within SST.
Definition: statbase.h:61
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:202
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:145
void enable()
Enable Statistic for collections.
Definition: statbase.h:69
void delayOutput(const char *delayTime)
Delay the statistic from outputting data for a specified delay time.
Definition: statbase.cc:114
StatMode_t getRegisteredCollectionMode() const
Return the collection mode that is registered.
Definition: statbase.h:157
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:294
Definition: serializable.h:109
virtual bool isNullStatistic() const
Indicate if the Statistic is a NullStatistic.
Definition: statbase.h:175
const std::string & getCompName() const
Return the Component Name.
Definition: statbase.cc:34
virtual void incrementCollectionCount()
Increment current collection count.
Definition: statbase.cc:39
virtual void resetCollectionCount()
Set the current collection count to 0.
Definition: statbase.cc:51
const StatisticFieldInfo::fieldType_t & getStatDataType() const
Return the Statistic data type.
Definition: statbase.h:124
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:321
bool getFlagOutputAtEndOfSim() const
Return the OutputAtEndOfSim flag value.
Definition: statbase.h:154
bool getFlagClearDataOnOutput() const
Return the ClearDataOnOutput flag value.
Definition: statbase.h:151
bool isEnabled() const
Return the enable status of the Statistic.
Definition: statbase.h:136
virtual bool isReady() const
Indicate that the Statistic is Ready to be used.
Definition: statbase.h:172
Main component object for the simulation.
Definition: baseComponent.h:104
void disable()
Disable Statistic for collections.
Definition: statbase.h:72
bool isOutputEnabled() const
Return the enable status of the Statistic's ability to output data.
Definition: statbase.h:139
StatMode_t
Statistic collection mode.
Definition: statbase.h:65
virtual void clearStatisticData()
Inform the Statistic to clear its data.
Definition: statbase.h:76
void setFlagResetCountOnOutput(bool flag)
Set the Reset Count On Output flag.
Definition: statbase.h:94
Parameter store.
Definition: params.h:45
bool getFlagResetCountOnOutput() const
Return the ResetCountOnOutput flag value.
Definition: statbase.h:148
const std::string & getStatSubId() const
Return the Statistic SubId.
Definition: statbase.h:115
Definition: statbase.h:33
const char * getStatDataTypeFullName() const
Return the Statistic data type.
Definition: statbase.h:130
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:45
const std::string & getFullStatName() const
Return the full Statistic name of Component.StatName.SubId.
Definition: statbase.h:118
virtual void setCollectionCount(uint64_t newCount)
Set the current collection count to a defined value.
Definition: statbase.cc:45
const char * getStatDataTypeShortName() const
Return the Statistic data type.
Definition: statbase.h:127
void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType)
Set the Statistic Data Type.
Definition: statbase.h:199
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:49
Definition: statgroup.h:29
Params & getParams()
Return the Statistic Parameters.
Definition: statbase.h:196
uint64_t getCollectionCountLimit() const
Return the collection count limit.
Definition: statbase.h:142
BaseComponent * getComponent() const
Return a pointer to the parent Component.
Definition: statbase.h:133
const std::string & getStatTypeName() const
Return the Statistic type name.
Definition: statbase.h:121
const std::string & getStatName() const
Return the Statistic Name.
Definition: statbase.h:112
StatisticBase(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a StatisticBase.
Definition: statbase.cc:20
fieldType_t
Supported Field Types.
Definition: statfieldinfo.h:36