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/module.h>
17 #include <sst/core/params.h>
18 #include <sst/core/statapi/statfieldinfo.h>
19 #include <sst/core/statapi/statbase.h>
20 #include <unordered_map>
25 #define STATISTICSDEFAULTOUTPUTNAME "sst.statOutputConsole"
26 #define STATISTICSDEFAULTLOADLEVEL 0
28 extern int main(
int argc,
char **argv);
33 namespace Statistics {
34 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;
86 if (
is_type_same<T, int32_t >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::INT32)); implRegisteredField(res);
return res; }
87 if (
is_type_same<T, uint32_t >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::UINT32)); implRegisteredField(res);
return res; }
88 if (
is_type_same<T, int64_t >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::INT64)); implRegisteredField(res);
return res; }
89 if (
is_type_same<T, uint64_t >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::UINT64)); implRegisteredField(res);
return res; }
90 if (
is_type_same<T, float >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::FLOAT)); implRegisteredField(res);
return res; }
91 if (
is_type_same<T, double >::value){
auto res = generateFileHandle(addFieldToLists(fieldName, StatisticFieldInfo::DOUBLE)); implRegisteredField(res);
return res; }
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;
160 void outputField(fieldHandle_t fieldHandle, int32_t data);
161 void outputField(fieldHandle_t fieldHandle, uint32_t data);
162 void outputField(fieldHandle_t fieldHandle, int64_t data);
163 void outputField(fieldHandle_t fieldHandle, uint64_t data);
164 void outputField(fieldHandle_t fieldHandle,
float data);
165 void outputField(fieldHandle_t fieldHandle,
double data);
174 friend int ::main(
int argc,
char **argv);
190 virtual void implStartRegisterFields(
StatisticBase *statistic) {}
191 virtual void implRegisteredField(fieldHandle_t fieldHandle) {}
192 virtual void implStopRegisterFields() {}
215 virtual void implOutputField(fieldHandle_t fieldHandle, int32_t data) = 0;
216 virtual void implOutputField(fieldHandle_t fieldHandle, uint32_t data) = 0;
217 virtual void implOutputField(fieldHandle_t fieldHandle, int64_t data) = 0;
218 virtual void implOutputField(fieldHandle_t fieldHandle, uint64_t data) = 0;
219 virtual void implOutputField(fieldHandle_t fieldHandle,
float data) = 0;
220 virtual void implOutputField(fieldHandle_t fieldHandle,
double data) = 0;
225 void startRegisterFields(StatisticBase *statistic);
226 void stopRegisterFields();
229 void setStatisticLoadLevel(uint8_t loadLevel) {m_statLoadLevel = loadLevel;}
232 void startOutputEntries(StatisticBase* statistic);
233 void stopOutputEntries();
236 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
237 fieldHandle_t generateFileHandle(StatisticFieldInfo* FieldInfo);
242 void setStatisticOutputName(std::string name) {m_statOutputName = name;}
244 void lock() { m_lock.lock(); }
245 void unlock() { m_lock.unlock(); }
248 std::string m_statOutputName;
249 Params m_outputParameters;
250 FieldInfoArray_t m_outputFieldInfoArray;
251 FieldNameMap_t m_outputFieldNameMap;
252 fieldHandle_t m_highestFieldHandle;
253 std::string m_currentFieldCompName;
254 std::string m_currentFieldStatName;
255 uint8_t m_statLoadLevel;
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:75
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
Definition: statfieldinfo.h:22
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:84
Main component object for the simulation.
Definition: component.h:56
Forms the base class for statistics gathering within SST.
Definition: statbase.h:36
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:120
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:23
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:69
Parameter store.
Definition: params.h:44
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:155
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the heirarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:95
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:151
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:33
std::string getFieldUniqueName() const
Return the field type related to this field info.
Definition: statfieldinfo.cc:35
void outputField(fieldHandle_t fieldHandle, int32_t data)
Output field data.
Definition: statoutput.cc:119
fieldType_t
Supported Field Types.
Definition: statfieldinfo.h:36
uint8_t getStatisticLoadLevel()
Return the statistics load level for the system.
Definition: statoutput.h:66
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.