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;}
79 virtual void resetCollectionCount();
82 virtual void incrementCollectionCount();
85 virtual void setCollectionCount(uint64_t newCount);
88 virtual void setCollectionCountLimit(uint64_t newLimit);
109 const std::string& getCompName()
const;
112 inline const std::string&
getStatName()
const {
return m_statName;}
163 void delayOutput(
const char* delayTime);
168 void delayCollection(
const char* delayTime);
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);
226 virtual void outputStatisticData(
StatisticOutput* statOutput,
bool EndOfSimFlag) = 0;
233 virtual bool isStatModeSupported(StatMode_t UNUSED(mode))
const {
return true;}
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();
257 std::string m_statName;
258 std::string m_statSubId;
259 std::string m_statFullName;
260 std::string m_statTypeName;
262 StatMode_t m_registeredCollectionMode;
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;
293 template <
typename T>
305 if (
true == isEnabled()) {
307 incrementCollectionCount();
324 setStatisticDataType(StatisticFieldInfo::getFieldTypeFromTemplate<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
bool isOutputEnabled() const
Return the enable status of the Statistic's ability to output data.
Definition: statbase.h:139
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
const StatisticFieldInfo::fieldType_t & getStatDataType() const
Return the Statistic data type.
Definition: statbase.h:124
Forms the base class for statistics gathering within SST.
Definition: statbase.h:61
const std::string & getStatName() const
Return the Statistic Name.
Definition: statbase.h:112
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:202
const char * getStatDataTypeFullName() const
Return the Statistic data type.
Definition: statbase.h:130
void enable()
Enable Statistic for collections.
Definition: statbase.h:69
bool getFlagResetCountOnOutput() const
Return the ResetCountOnOutput flag value.
Definition: statbase.h:148
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:294
Definition: serializable.h:109
bool getFlagClearDataOnOutput() const
Return the ClearDataOnOutput flag value.
Definition: statbase.h:151
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
bool getFlagOutputAtEndOfSim() const
Return the OutputAtEndOfSim flag value.
Definition: statbase.h:154
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:321
const char * getStatDataTypeShortName() const
Return the Statistic data type.
Definition: statbase.h:127
virtual bool isNullStatistic() const
Indicate if the Statistic is a NullStatistic.
Definition: statbase.h:175
bool isEnabled() const
Return the enable status of the Statistic.
Definition: statbase.h:136
Main component object for the simulation.
Definition: baseComponent.h:104
void disable()
Disable Statistic for collections.
Definition: statbase.h:72
const std::string & getStatTypeName() const
Return the Statistic type name.
Definition: statbase.h:121
StatMode_t
Statistic collection mode.
Definition: statbase.h:65
virtual void clearStatisticData()
Inform the Statistic to clear its data.
Definition: statbase.h:76
const std::string & getStatSubId() const
Return the Statistic SubId.
Definition: statbase.h:115
void setFlagResetCountOnOutput(bool flag)
Set the Reset Count On Output flag.
Definition: statbase.h:94
Parameter store.
Definition: params.h:45
Definition: statbase.h:33
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:45
void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType)
Set the Statistic Data Type.
Definition: statbase.h:199
StatMode_t getRegisteredCollectionMode() const
Return the collection mode that is registered.
Definition: statbase.h:157
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
virtual bool isReady() const
Indicate that the Statistic is Ready to be used.
Definition: statbase.h:172
fieldType_t
Supported Field Types.
Definition: statfieldinfo.h:36
const std::string & getFullStatName() const
Return the full Statistic name of Component.StatName.SubId.
Definition: statbase.h:118
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:145
Functor classes for OneShot handling.
Definition: oneshot.h:39