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 {};
88 friend class SST::Simulation;
127 virtual void registerStatistic(StatisticBase* stat) = 0;
129 void registerGroup(StatisticGroup* group);
130 void outputGroup(StatisticGroup* group,
bool endOfSimFlag);
132 virtual void startOutputGroup(StatisticGroup* group) = 0;
133 virtual void stopOutputGroup() = 0;
135 virtual void startRegisterGroup(StatisticGroup* group) = 0;
136 virtual void stopRegisterGroup() = 0;
146 void setStatisticOutputName(
const std::string& name) { m_statOutputName = name; }
148 void lock() { m_lock.lock(); }
149 void unlock() { m_lock.unlock(); }
152 std::string m_statOutputName;
153 Params m_outputParameters;
154 std::recursive_mutex m_lock;
163 void output(
StatisticBase* statistic,
bool endOfSimFlag)
override;
166 void stopOutputGroup()
override;
169 void stopRegisterGroup()
override;
202 template <
typename T>
207 StatisticFieldInfo::fieldType_t FieldType =
208 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
213 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->getFieldUniqueName());
214 if ( found != m_outputFieldNameMap.end() ) {
217 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
218 delete NewStatFieldInfo;
219 return ExistingStatFieldInfo;
222 delete NewStatFieldInfo;
237 virtual void outputField(fieldHandle_t fieldHandle, int32_t data);
238 virtual void outputField(fieldHandle_t fieldHandle, uint32_t data);
239 virtual void outputField(fieldHandle_t fieldHandle, int64_t data);
240 virtual void outputField(fieldHandle_t fieldHandle, uint64_t data);
241 virtual void outputField(fieldHandle_t fieldHandle,
float data);
242 virtual void outputField(fieldHandle_t fieldHandle,
double data);
253 template <
typename T>
256 StatisticFieldInfo::fieldType_t FieldType =
257 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
259 auto res = generateFieldHandle(addFieldToLists(fieldName, FieldType));
260 implRegisteredField(res);
281 StatisticFieldInfo* addFieldToLists(
const char* fieldName, fieldType_t fieldType);
282 fieldHandle_t generateFieldHandle(StatisticFieldInfo* FieldInfo);
283 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)) {}
285 FieldInfoArray_t m_outputFieldInfoArray;
286 FieldNameMap_t m_outputFieldNameMap;
287 fieldHandle_t m_highestFieldHandle;
288 std::string m_currentFieldStatName;
294 virtual void stopRegisterFields();
296 virtual void startOutputEntries(StatisticBase* statistic);
297 virtual void stopOutputEntries();
303 #endif // SST_CORE_STATAPI_STATOUTPUT_H std::string & getStatisticOutputName()
Return the Statistic Output name.
Definition: statoutput.h:65
The class for representing Statistic Output Fields.
Definition: statfieldinfo.h:93
RankInfo getRank()
Gets the Rank (MPI rank and thread) that this StatisticOutput is associated with. ...
Definition: statoutput.cc:72
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:227
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:227
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:254
Definition: paramsInfo.h:40
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.
Definition: statoutput.h:157
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:26
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:68
SimTime_t getCurrentSimCycle()
Gets the current simulstion cycle.
Definition: statoutput.cc:78
Output & getSimulationOutput()
Gets the Output object for the Simulation object associeted with this StatOutput. ...
Definition: statoutput.cc:60
Parameter store.
Definition: params.h:55
RankInfo getNumRanks()
Gets the number of ranks for the simulation.
Definition: statoutput.cc:66
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:51
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the hierarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:128
Definition: statgroup.h:28
virtual void startRegisterFields(StatisticBase *statistic)
These can be overriden, if necessary, but must be callable by the derived class.
Definition: statoutput.cc:242
StatisticFieldInfo * getRegisteredField(const char *statisticName, const char *fieldName)
Return the information on a registered field via known names.
Definition: statoutput.h:203
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:71
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.