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
33 namespace Statistics {
34 class StatisticProcessingEngine;
55 using fieldType_t = StatisticFieldInfo::fieldType_t;
56 using fieldHandle_t = StatisticFieldInfo::fieldHandle_t;
57 using FieldInfoArray_t = std::vector<StatisticFieldInfo*>;
58 using FieldNameMap_t = std::unordered_map<std::string, fieldHandle_t> ;
91 StatisticFieldInfo::fieldType_t FieldType =
92 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
94 auto res = generateFieldHandle(addFieldToLists(fieldName, FieldType));
95 implRegisteredField(res);
100 static const std::vector<SST::ElementInfoParam>& ELI_getParams() {
101 static std::vector<SST::ElementInfoParam> var{};
132 StatisticFieldInfo::fieldType_t FieldType = StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
137 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->getFieldUniqueName());
138 if (found != m_outputFieldNameMap.end()) {
141 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
142 delete NewStatFieldInfo;
143 return ExistingStatFieldInfo;
146 delete NewStatFieldInfo;
161 virtual void outputField(fieldHandle_t fieldHandle, int32_t data);
162 virtual void outputField(fieldHandle_t fieldHandle, uint32_t data);
163 virtual void outputField(fieldHandle_t fieldHandle, int64_t data);
164 virtual void outputField(fieldHandle_t fieldHandle, uint64_t data);
165 virtual void outputField(fieldHandle_t fieldHandle,
float data);
166 virtual void outputField(fieldHandle_t fieldHandle,
double data);
189 virtual void implStartRegisterFields(
StatisticBase *UNUSED(statistic)) {}
190 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)) {}
191 virtual void implStopRegisterFields() {}
211 virtual void implStartRegisterGroup(StatisticGroup* UNUSED(group)) {}
212 virtual void implStopRegisterGroup() {}
213 virtual void implStartOutputGroup(StatisticGroup* UNUSED(group)) {}
214 virtual void implStopOutputGroup() {}
220 void registerStatistic(StatisticBase *stat);
221 void registerGroup(StatisticGroup *group);
223 void startRegisterFields(StatisticBase *statistic);
224 void stopRegisterFields();
227 void outputEntries(StatisticBase* statistic,
bool endOfSimFlag);
228 void startOutputEntries(StatisticBase* statistic);
229 void stopOutputEntries();
231 void outputGroup(StatisticGroup* group,
bool endOfSimFlag);
232 void startOutputGroup(StatisticGroup* group);
233 void stopOutputGroup();
238 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
239 fieldHandle_t generateFieldHandle(StatisticFieldInfo* FieldInfo);
244 void setStatisticOutputName(std::string name) {m_statOutputName = name;}
246 void lock() { m_lock.lock(); }
247 void unlock() { m_lock.unlock(); }
250 std::string m_statOutputName;
251 Params m_outputParameters;
252 FieldInfoArray_t m_outputFieldInfoArray;
253 FieldNameMap_t m_outputFieldNameMap;
254 fieldHandle_t m_highestFieldHandle;
255 std::string m_currentFieldStatName;
256 std::recursive_mutex m_lock;
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...
Main control class for a SST Simulation.
Definition: simulation.h:72
std::string & getStatisticOutputName()
Return the Statistic Output name.
Definition: statoutput.h:68
The class for representing Statistic Output Fields
Definition: statfieldinfo.h:98
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:48
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:89
Forms the base class for statistics gathering within SST.
Definition: statbase.h:63
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
Module is a tag class used with the loadModule function.
Definition: module.h:22
Definition: paramsInfo.h:28
virtual void startOfSimulation()=0
Indicate to Statistic Output that simulation has started.
virtual void printUsage()=0
Have Statistic Object print out its usage and parameter info.
StatisticFieldInfo * getRegisteredField(const char *statisticName, const char *fieldName)
Return the information on a registered field via known names.
Definition: statoutput.h:128
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:74
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:25
virtual void outputField(fieldHandle_t fieldHandle, int32_t data)
Output field data.
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:71
Parameter store.
Definition: params.h:45
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:217
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the hierarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:111
virtual void implStopOutputEntries()=0
Indicate to Statistic Output that a statistic is finished sending data to be output Allows object to ...
FieldInfoArray_t & getFieldInfoArray()
Return the array of registered field infos.
Definition: statoutput.h:151
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.