12 #ifndef SST_CORE_COMPONENT_H
13 #define SST_CORE_COMPONENT_H
15 #include <sst/core/sst_types.h>
20 #include <sst/core/clock.h>
21 #include <sst/core/oneshot.h>
22 #include <sst/core/event.h>
26 #include <sst/core/statapi/statoutput.h>
27 #include <sst/core/statapi/statengine.h>
28 #include <sst/core/statapi/statnull.h>
29 #include <sst/core/statapi/stataccumulator.h>
30 #include <sst/core/statapi/stathistogram.h>
31 #include <sst/core/statapi/statuniquecount.h>
32 #include "sst/core/simulation.h"
33 #include "sst/core/unitAlgebra.h"
34 #include "sst/core/statapi/statbase.h"
48 class SharedRegionMerger;
50 #define _COMP_DBG( fmt, args...) __DBG( DBG_COMP, Component, fmt, ## args )
59 static bool isPortValidForComponent(
const std::string& comp_name,
const std::string& port_name);
76 inline ComponentId_t
getId()
const {
return id; }
80 inline const std::string&
getName()
const {
return my_info->getName(); }
91 virtual void init(
unsigned int phase) {}
110 bool isPortConnected(
const std::string &name)
const;
193 TimeConverter* registerTimeBase( std::string base,
bool regAll =
true);
204 return getCurrentSimTime(defaultTimeBase);
208 SimTime_t getCurrentSimTime(std::string base);
211 SimTime_t getCurrentSimTimeNano()
const;
213 SimTime_t getCurrentSimTimeMicro()
const;
215 SimTime_t getCurrentSimTimeMilli()
const;
233 template <
typename T>
239 #include "sst/core/statapi/componentregisterstat_impl.h"
242 template <
typename T>
243 Statistic<T>* registerStatistic(std::string statName, std::string statSubId =
"")
247 if (
false == doesComponentInfoStatisticExist(statName)) {
248 printf(
"Error: Statistic %s name %s is not found in ElementInfoStatistic, exiting...\n",
249 StatisticBase::buildStatisticFullName(getName().c_str(), statName, statSubId).c_str(),
253 return registerStatisticCore<T>(statName, statSubId);
256 template <
typename T>
257 Statistic<T>* registerStatistic(
const char* statName,
const char* statSubId =
"")
259 return registerStatistic<T>(std::string(statName), std::string(statSubId));
279 bool unregisterExit();
303 void registerAsPrimaryComponent();
312 void primaryComponentDoNotEndSim();
321 void primaryComponentOKToEndSim();
328 Module* loadModule(std::string type, Params& params);
336 Module* loadModuleWithComponent(std::string type, Component* comp, Params& params);
344 SubComponent* loadSubComponent(std::string type, Component* comp, Params& params);
351 defaultTimeBase = tc;
364 SharedRegion* getLocalSharedRegion(
const std::string &key,
size_t size);
368 Simulation* getSimulation()
const {
return sim; }
374 void addSelfLink(std::string name);
377 bool doesComponentInfoStatisticExist(std::string statisticName);
379 uint8_t getComponentInfoStatisticEnableLevel(std::string statisticName);
381 std::string getComponentInfoStatisticUnits(std::string statisticName);
390 std::string currentlyLoadingSubComponent;
394 template <
typename T>
406 if (0 == strcasecmp(
"sst.nullstatistic", type.c_str())) {
410 if (0 == strcasecmp(
"sst.accumulatorstatistic", type.c_str())) {
414 if (0 == strcasecmp(
"sst.histogramstatistic", type.c_str())) {
418 if(0 == strcasecmp(
"sst.uniquecountstatistic", type.c_str())) {
423 printf(
"ERROR: Statistic %s is not supported by the SST Core...\n", type.c_str());
435 #endif // SST_CORE_COMPONENT_H
Output object provides consistant method for outputing data to stdout, stderr and/or sst debug file...
Definition: output.h:54
Definition: sharedRegion.h:77
Main control class for a SST Simulation.
Definition: simulation.h:75
virtual void finish()
Called after simulation completes, but before objects are destroyed.
Definition: component.h:97
virtual bool Status()
Currently unused function.
Definition: component.h:100
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:25
Main component object for the simulation.
Definition: component.h:56
Creates a Statistic which counts unique values provided to it.
Definition: statuniquecount.h:32
Utility class to define how to merge multiple pieces of shared memory regions Useful in the multi-MPI...
Definition: sharedRegion.h:30
Allows the online gathering of statistical information about a single quantity.
Definition: stataccumulator.h:42
TimeConverter * defaultTimeBase
Timebase used if no other timebase is specified for calls like Component::getCurrentSimTime().
Definition: component.h:357
Holder of data grouped into pre-determined width bins.
Definition: stathistogram.h:41
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:263
virtual void emergencyShutdown(void)
Called when SIGINT or SIGTERM has been seen.
Definition: component.h:73
SimTime_t getCurrentSimTime() const
return the time since the simulation began in the default timebase
Definition: component.h:203
virtual void init(unsigned int phase)
Component's type, set by the factory when the object is created.
Definition: component.h:91
ComponentId_t getId() const
Returns unique component ID.
Definition: component.h:76
virtual void setup()
Called after all components have been constructed and inialization has completed, but before simulati...
Definition: component.h:94
Statistic< T > * registerStatisticCore(std::string statName, std::string statSubId="")
Registers a statistic.
Definition: component.h:234
Functor classes for Clock handling.
Definition: clock.h:44
const std::string & getName() const
Returns component Name.
Definition: component.h:80
Parameter store.
Definition: params.h:46
Functor classes for Event handling.
Definition: event.h:86
virtual void printStatus(Output &out)
Called by the Simulation to request that the component print it's current status. ...
Definition: component.h:107
Definition: simulation.h:62
Performs Unit math in full precision.
Definition: unitAlgebra.h:112
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:27
Definition: componentInfo.h:36
Link between two components.
Definition: link.h:33
An empty statistic place holder.
Definition: statnull.h:42
void setDefaultTimeBase(TimeConverter *tc)
Manually set the default detaulTimeBase.
Definition: component.h:350
Functor classes for OneShot handling.
Definition: oneshot.h:39