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 <unordered_map>
26 #define STATISTICSDEFAULTOUTPUTNAME "sst.statOutputConsole"
27 #define STATISTICSDEFAULTLOADLEVEL 0
32 namespace Statistics {
33 class StatisticProcessingEngine;
51 typedef StatisticFieldInfo::fieldHandle_t fieldHandle_t;
52 typedef std::vector<StatisticFieldInfo*> FieldInfoArray_t;
53 typedef std::unordered_map<std::string, fieldHandle_t> FieldNameMap_t;
88 if ( FieldType == StatisticFieldInfo::UNDEFINED )
91 auto res = generateFileHandle(addFieldToLists(fieldName, FieldType));
92 implRegisteredField(res);
128 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->getFieldUniqueName());
129 if (found != m_outputFieldNameMap.end()) {
132 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
133 delete NewStatFieldInfo;
134 return ExistingStatFieldInfo;
137 delete NewStatFieldInfo;
151 void outputField(fieldHandle_t fieldHandle, int32_t data);
152 void outputField(fieldHandle_t fieldHandle, uint32_t data);
153 void outputField(fieldHandle_t fieldHandle, int64_t data);
154 void outputField(fieldHandle_t fieldHandle, uint64_t data);
155 void outputField(fieldHandle_t fieldHandle,
float data);
156 void outputField(fieldHandle_t fieldHandle,
double data);
179 virtual void implStartRegisterFields(
StatisticBase *UNUSED(statistic)) {}
180 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)) {}
181 virtual void implStopRegisterFields() {}
201 virtual void implStartRegisterGroup(StatisticGroup* UNUSED(group)) {}
202 virtual void implStopRegisterGroup() {}
203 virtual void implStartOutputGroup(StatisticGroup* UNUSED(group)) {}
204 virtual void implStopOutputGroup() {}
208 virtual void implOutputField(fieldHandle_t fieldHandle, int32_t data) = 0;
209 virtual void implOutputField(fieldHandle_t fieldHandle, uint32_t data) = 0;
210 virtual void implOutputField(fieldHandle_t fieldHandle, int64_t data) = 0;
211 virtual void implOutputField(fieldHandle_t fieldHandle, uint64_t data) = 0;
212 virtual void implOutputField(fieldHandle_t fieldHandle,
float data) = 0;
213 virtual void implOutputField(fieldHandle_t fieldHandle,
double data) = 0;
219 void registerStatistic(StatisticBase *stat);
220 void registerGroup(StatisticGroup *group);
222 void startRegisterFields(StatisticBase *statistic);
223 void stopRegisterFields();
226 void outputEntries(StatisticBase* statistic,
bool endOfSimFlag);
227 void startOutputEntries(StatisticBase* statistic);
228 void stopOutputEntries();
230 void outputGroup(StatisticGroup* group,
bool endOfSimFlag);
231 void startOutputGroup(StatisticGroup* group);
232 void stopOutputGroup();
235 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
236 fieldHandle_t generateFileHandle(StatisticFieldInfo* FieldInfo);
241 void setStatisticOutputName(std::string name) {m_statOutputName = name;}
243 void lock() { m_lock.lock(); }
244 void unlock() { m_lock.unlock(); }
247 std::string m_statOutputName;
248 Params m_outputParameters;
249 FieldInfoArray_t m_outputFieldInfoArray;
250 FieldNameMap_t m_outputFieldNameMap;
251 fieldHandle_t m_highestFieldHandle;
252 std::string m_currentFieldStatName;
253 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:63
The class for representing Statistic Output Fields
Definition: statfieldinfo.h:32
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:47
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:85
Forms the base class for statistics gathering within SST.
Definition: statbase.h:61
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
Module is a tag class used with the loadModule function.
Definition: module.h:20
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:119
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:69
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:24
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:66
Parameter store.
Definition: params.h:45
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:202
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the heirarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:108
virtual void implStopOutputEntries()=0
Indicate to Statistic Output that a statistic is finished sending data to be output Allows object to ...
virtual void implOutputField(fieldHandle_t fieldHandle, int32_t data)=0
Implementation of outputField() for derived classes.
FieldInfoArray_t & getFieldInfoArray()
Return the array of registered field infos.
Definition: statoutput.h:142
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:49
void outputField(fieldHandle_t fieldHandle, int32_t data)
Output field data.
Definition: statoutput.cc:166
fieldType_t
Supported Field Types.
Definition: statfieldinfo.h:36
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.