12 #ifndef _H_SST_CORE_STATISTICS_OUTPUT
13 #define _H_SST_CORE_STATISTICS_OUTPUT
15 #include "sst/core/sst_types.h"
16 #include "sst/core/warnmacros.h"
17 #include "sst/core/module.h"
18 #include "sst/core/params.h"
19 #include "sst/core/statapi/statfieldinfo.h"
20 #include "sst/core/statapi/statbase.h"
21 #include "sst/core/eli/elementinfo.h"
22 #include <unordered_map>
27 #define STATISTICSDEFAULTOUTPUTNAME "sst.statOutputConsole"
28 #define STATISTICSDEFAULTLOADLEVEL 0
29 #define STATISTICLOADLEVELUNINITIALIZED 0xff
34 namespace Statistics {
35 class StatisticProcessingEngine;
56 using fieldType_t = StatisticFieldInfo::fieldType_t;
57 using fieldHandle_t = StatisticFieldInfo::fieldHandle_t;
58 using FieldInfoArray_t = std::vector<StatisticFieldInfo*>;
59 using FieldNameMap_t = std::unordered_map<std::string, fieldHandle_t> ;
73 virtual void output(
StatisticBase* statistic,
bool endOfSimFlag) = 0;
75 virtual bool supportsDynamicRegistration()
const {
83 static const std::vector<SST::ElementInfoParam>& ELI_getParams() {
84 static std::vector<SST::ElementInfoParam> var{};
113 virtual void registerStatistic(StatisticBase *stat) = 0;
115 void registerGroup(StatisticGroup *group);
116 void outputGroup(StatisticGroup* group,
bool endOfSimFlag);
118 virtual void startOutputGroup(StatisticGroup* group) = 0;
119 virtual void stopOutputGroup() = 0;
121 virtual void startRegisterGroup(StatisticGroup* group) = 0;
122 virtual void stopRegisterGroup() = 0;
132 void setStatisticOutputName(
const std::string& name) {m_statOutputName = name;}
134 void lock() { m_lock.lock(); }
135 void unlock() { m_lock.unlock(); }
138 std::string m_statOutputName;
139 Params m_outputParameters;
140 std::recursive_mutex m_lock;
150 void output(
StatisticBase* statistic,
bool endOfSimFlag)
override;
153 void stopOutputGroup()
override;
156 void stopRegisterGroup()
override;
195 StatisticFieldInfo::fieldType_t FieldType = StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
200 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->getFieldUniqueName());
201 if (found != m_outputFieldNameMap.end()) {
204 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
205 delete NewStatFieldInfo;
206 return ExistingStatFieldInfo;
209 delete NewStatFieldInfo;
224 virtual void outputField(fieldHandle_t fieldHandle, int32_t data);
225 virtual void outputField(fieldHandle_t fieldHandle, uint32_t data);
226 virtual void outputField(fieldHandle_t fieldHandle, int64_t data);
227 virtual void outputField(fieldHandle_t fieldHandle, uint64_t data);
228 virtual void outputField(fieldHandle_t fieldHandle,
float data);
229 virtual void outputField(fieldHandle_t fieldHandle,
double data);
243 StatisticFieldInfo::fieldType_t FieldType =
244 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
246 auto res = generateFieldHandle(addFieldToLists(fieldName, FieldType));
247 implRegisteredField(res);
268 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
269 fieldHandle_t generateFieldHandle(StatisticFieldInfo* FieldInfo);
270 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)){}
272 FieldInfoArray_t m_outputFieldInfoArray;
273 FieldNameMap_t m_outputFieldNameMap;
274 fieldHandle_t m_highestFieldHandle;
275 std::string m_currentFieldStatName;
281 virtual void stopRegisterFields();
283 virtual void startOutputEntries(StatisticBase* statistic);
284 virtual void stopOutputEntries();
Main control class for a SST Simulation.
Definition: simulation.h:73
std::string & getStatisticOutputName()
Return the Statistic Output name.
Definition: statoutput.h:65
The class for representing Statistic Output Fields.
Definition: statfieldinfo.h:99
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:49
virtual void implStopOutputEntries()=0
Indicate to Statistic Output that a statistic is finished sending data to be output Allows object to ...
Forms the base class for statistics gathering within SST.
Definition: statbase.h:64
virtual void implStartOutputEntries(StatisticBase *statistic)=0
Indicate to Statistic Output that a statistic is about to send data to be output Allows object to per...
FieldInfoArray_t & getFieldInfoArray()
Return the array of registered field infos.
Definition: statoutput.h:214
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:212
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:241
Definition: paramsInfo.h:39
virtual void startOfSimulation()=0
Indicate to Statistic Output that simulation has started.
virtual void outputField(fieldHandle_t fieldHandle, int32_t data)
Output field data.
virtual void printUsage()=0
Have Statistic Object print out its usage and parameter info.
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:71
Definition: statoutput.h:144
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:25
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:68
Parameter store.
Definition: params.h:44
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the hierarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:105
Definition: statgroup.h:29
virtual void startRegisterFields(StatisticBase *statistic)
These can be overriden, if necessary, but must be callable by the derived class.
Definition: statoutput.cc:226
StatisticFieldInfo * getRegisteredField(const char *statisticName, const char *fieldName)
Return the information on a registered field via known names.
Definition: statoutput.h:191
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.