12 #ifndef SST_CORE_STATAPI_STATOUTPUT_H
13 #define SST_CORE_STATAPI_STATOUTPUT_H
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/module.h"
17 #include "sst/core/params.h"
18 #include "sst/core/sst_types.h"
19 #include "sst/core/statapi/statbase.h"
20 #include "sst/core/statapi/statfieldinfo.h"
21 #include "sst/core/warnmacros.h"
24 #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 {
return false; }
81 static const std::vector<SST::ElementInfoParam>& ELI_getParams()
83 static std::vector<SST::ElementInfoParam> var {};
118 virtual void stopOutputGroup() = 0;
121 virtual void stopRegisterGroup() = 0;
131 void setStatisticOutputName(
const std::string& name) { m_statOutputName = name; }
133 void lock() { m_lock.lock(); }
134 void unlock() { m_lock.unlock(); }
137 std::string m_statOutputName;
138 Params m_outputParameters;
139 std::recursive_mutex m_lock;
148 void output(
StatisticBase* statistic,
bool endOfSimFlag)
override;
151 void stopOutputGroup()
override;
154 void stopRegisterGroup()
override;
187 template <
typename T>
192 StatisticFieldInfo::fieldType_t FieldType =
193 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
198 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->
getFieldUniqueName());
199 if ( found != m_outputFieldNameMap.end() ) {
202 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
203 delete NewStatFieldInfo;
204 return ExistingStatFieldInfo;
207 delete NewStatFieldInfo;
222 virtual void outputField(fieldHandle_t fieldHandle, int32_t data);
223 virtual void outputField(fieldHandle_t fieldHandle, uint32_t data);
224 virtual void outputField(fieldHandle_t fieldHandle, int64_t data);
225 virtual void outputField(fieldHandle_t fieldHandle, uint64_t data);
226 virtual void outputField(fieldHandle_t fieldHandle,
float data);
227 virtual void outputField(fieldHandle_t fieldHandle,
double data);
238 template <
typename T>
241 StatisticFieldInfo::fieldType_t FieldType =
242 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
244 auto res = generateFieldHandle(addFieldToLists(fieldName, FieldType));
245 implRegisteredField(res);
266 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
267 fieldHandle_t generateFieldHandle(StatisticFieldInfo* FieldInfo);
268 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)) {}
270 FieldInfoArray_t m_outputFieldInfoArray;
271 FieldNameMap_t m_outputFieldNameMap;
272 fieldHandle_t m_highestFieldHandle;
273 std::string m_currentFieldStatName;
279 virtual void stopRegisterFields();
281 virtual void startOutputEntries(StatisticBase* statistic);
282 virtual void stopOutputEntries();
Definition: paramsInfo.h:41
Parameter store.
Definition: params.h:56
Main control class for a SST Simulation.
Definition: simulation.h:39
Forms the base class for statistics gathering within SST.
Definition: statbase.h:64
The class for representing Statistic Output Fields.
Definition: statfieldinfo.h:94
std::string getFieldUniqueName() const
Return the field type related to this field info.
Definition: statfieldinfo.cc:41
Definition: statoutput.h:143
FieldInfoArray_t & getFieldInfoArray()
Return the array of registered field infos.
Definition: statoutput.h:212
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:239
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:203
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Return the information on a registered field via the field handle.
Definition: statoutput.cc:104
StatisticFieldInfo * getRegisteredField(const char *statisticName, const char *fieldName)
Return the information on a registered field via known names.
Definition: statoutput.h:188
virtual void implStopOutputEntries()=0
Indicate to Statistic Output that a statistic is finished sending data to be output Allows object to ...
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...
virtual void outputField(fieldHandle_t fieldHandle, int32_t data)
Output field data.
virtual void startRegisterFields(StatisticBase *statistic)
These can be overriden, if necessary, but must be callable by the derived class.
Definition: statoutput.cc:218
Definition: statgroup.h:29
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:50
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:68
virtual void startOfSimulation()=0
Indicate to Statistic Output that simulation has started.
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:71
virtual void printUsage()=0
Have Statistic Object print out its usage and parameter info.
std::string & getStatisticOutputName()
Return the Statistic Output name.
Definition: statoutput.h:65
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52