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/serialization/serializable.h" 19 #include "sst/core/sst_types.h" 20 #include "sst/core/statapi/statbase.h" 21 #include "sst/core/statapi/statfieldinfo.h" 22 #include "sst/core/warnmacros.h" 25 #include <unordered_map> 28 #define STATISTICSDEFAULTOUTPUTNAME "sst.statOutputConsole" 29 #define STATISTICSDEFAULTLOADLEVEL 0 30 #define STATISTICLOADLEVELUNINITIALIZED 0xff 35 namespace Statistics {
36 class StatisticProcessingEngine;
57 using fieldType_t = StatisticFieldInfo::fieldType_t;
58 using fieldHandle_t = StatisticFieldInfo::fieldHandle_t;
59 using FieldInfoArray_t = std::vector<StatisticFieldInfo*>;
60 using FieldNameMap_t = std::unordered_map<std::string, fieldHandle_t>;
74 virtual void output(
StatisticBase* statistic,
bool endOfSimFlag) = 0;
76 virtual bool supportsDynamicRegistration()
const {
return false; }
86 static const std::vector<SST::ElementInfoParam>& ELI_getParams()
88 static std::vector<SST::ElementInfoParam> var {};
93 friend class SST::Simulation;
132 virtual void registerStatistic(StatisticBase* stat) = 0;
134 void registerGroup(StatisticGroup* group);
135 void outputGroup(StatisticGroup* group,
bool endOfSimFlag);
137 virtual void startOutputGroup(StatisticGroup* group) = 0;
138 virtual void stopOutputGroup() = 0;
140 virtual void startRegisterGroup(StatisticGroup* group) = 0;
141 virtual void stopRegisterGroup() = 0;
151 void setStatisticOutputName(
const std::string& name) { m_statOutputName = name; }
153 void lock() { m_lock.lock(); }
154 void unlock() { m_lock.unlock(); }
157 std::string m_statOutputName;
158 Params m_outputParameters;
159 std::recursive_mutex m_lock;
168 void output(
StatisticBase* statistic,
bool endOfSimFlag)
override;
171 void stopOutputGroup()
override;
174 void stopRegisterGroup()
override;
207 template <
typename T>
212 StatisticFieldInfo::fieldType_t FieldType =
213 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
218 FieldNameMap_t::const_iterator found = m_outputFieldNameMap.find(NewStatFieldInfo->getFieldUniqueName());
219 if ( found != m_outputFieldNameMap.end() ) {
222 ExistingStatFieldInfo = m_outputFieldInfoArray[found->second];
223 delete NewStatFieldInfo;
224 return ExistingStatFieldInfo;
227 delete NewStatFieldInfo;
242 virtual void outputField(fieldHandle_t fieldHandle, int32_t data);
243 virtual void outputField(fieldHandle_t fieldHandle, uint32_t data);
244 virtual void outputField(fieldHandle_t fieldHandle, int64_t data);
245 virtual void outputField(fieldHandle_t fieldHandle, uint64_t data);
246 virtual void outputField(fieldHandle_t fieldHandle,
float data);
247 virtual void outputField(fieldHandle_t fieldHandle,
double data);
258 template <
typename T>
261 StatisticFieldInfo::fieldType_t FieldType =
262 StatisticFieldInfo::StatisticFieldInfo::getFieldTypeFromTemplate<T>();
264 auto res = generateFieldHandle(addFieldToLists(fieldName, FieldType));
265 implRegisteredField(res);
291 virtual void implRegisteredField(fieldHandle_t UNUSED(fieldHandle)) {}
293 FieldInfoArray_t m_outputFieldInfoArray;
294 FieldNameMap_t m_outputFieldNameMap;
295 fieldHandle_t m_highestFieldHandle;
296 std::string m_currentFieldStatName;
302 virtual void stopRegisterFields();
304 virtual void startOutputEntries(StatisticBase* statistic);
305 virtual void stopOutputEntries();
311 #endif // SST_CORE_STATAPI_STATOUTPUT_H This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:43
std::string & getStatisticOutputName()
Return the Statistic Output name.
Definition: statoutput.h:66
The class for representing Statistic Output Fields.
Definition: statfieldinfo.h:96
ImplementVirtualSerializable(SST::Statistics::StatisticFieldsOutput) protected StatisticFieldsOutput()
Construct a base StatisticOutput.
Definition: statoutput.h:285
RankInfo getRank()
Gets the Rank (MPI rank and thread) that this StatisticOutput is associated with. ...
Definition: statoutput.cc:79
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:50
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:45
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...
Definition: serializable.h:24
FieldInfoArray_t & getFieldInfoArray()
Return the array of registered field infos.
Definition: statoutput.h:232
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
const char * getFieldTypeShortName(fieldType_t type)
Output field data.
Definition: statoutput.cc:234
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:259
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:162
StatisticOutput(Params &outputParameters)
Construct a base StatisticOutput.
Definition: statoutput.cc:26
Params & getOutputParameters()
Return the parameters for the StatisticOutput.
Definition: statoutput.h:69
SimTime_t getCurrentSimCycle()
Gets the current simulstion cycle.
Definition: statoutput.cc:85
Output & getSimulationOutput()
Gets the Output object for the Simulation object associeted with this StatOutput. ...
Definition: statoutput.cc:67
Parameter store.
Definition: params.h:55
RankInfo getNumRanks()
Gets the number of ranks for the simulation.
Definition: statoutput.cc:73
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52
StatisticFieldInfo * getRegisteredField(fieldHandle_t fieldHandle)
Adjust the hierarchy of the fields (FUTURE SUPPORT)
Definition: statoutput.cc:135
Definition: statgroup.h:29
virtual void startRegisterFields(StatisticBase *statistic)
These can be overriden, if necessary, but must be callable by the derived class.
Definition: statoutput.cc:251
StatisticFieldInfo * getRegisteredField(const char *statisticName, const char *fieldName)
Return the information on a registered field via known names.
Definition: statoutput.h:208
virtual bool acceptsGroups() const
True if this StatOutput can handle StatisticGroups.
Definition: statoutput.h:72
virtual void endOfSimulation()=0
Indicate to Statistic Output that simulation has ended.