Main component object for the simulation. More...
#include <component.h>
Public Types | |
typedef std::map< std::string, std::string > | Params_t |
Public Member Functions | |
Component (ComponentId_t id) | |
Constructor. | |
ComponentId_t | getId () const |
Returns unique component ID. | |
virtual int | Setup () |
Called after all components have been constructed, but before simulation time has begun. | |
virtual int | Finish () |
Called after simulation completes, but before objects are destroyed. | |
virtual bool | Status () |
Link * | configureLink (std::string name, TimeConverter *time_base, Event::HandlerBase *handler=NULL) |
Link * | configureLink (std::string name, std::string time_base, Event::HandlerBase *handler=NULL) |
Link * | configureLink (std::string name, Event::HandlerBase *handler=NULL) |
Link * | configureSelfLink (std::string name, TimeConverter *time_base, Event::HandlerBase *handler=NULL) |
Link * | configureSelfLink (std::string name, std::string time_base, Event::HandlerBase *handler=NULL) |
Link * | configureSelfLink (std::string name, Event::HandlerBase *handler=NULL) |
TimeConverter * | registerClock (std::string freq, Clock::HandlerBase *handler, bool regAll=true) |
Registers a clock for this component. | |
void | unregisterClock (TimeConverter *tc, Clock::HandlerBase *handler) |
TimeConverter * | registerTimeBase (std::string base, bool regAll=true) |
Registers a default time base for the component and optionally sets the the component's links to that timebase. | |
SimTime_t | getCurrentSimTime (TimeConverter *tc) |
return the time since the simulation began in units specified by the parameter. | |
SimTime_t | getCurrentSimTime () |
return the time since the simulation began in the default timebase | |
SimTime_t | getCurrentSimTime (std::string base) |
return the time since the simulation began in timebase specified | |
SimTime_t | getCurrentSimTimeNano () |
Utility function to return the time since the simulation began in nanoseconds. | |
SimTime_t | getCurrentSimTimeMicro () |
Utility function to return the time since the simulation began in microseconds. | |
SimTime_t | getCurrentSimTimeMilli () |
Utility function to return the time since the simulation began in milliseconds. | |
bool | registerExit () |
Register that the simulation should not end until this component says it is OK to. | |
bool | unregisterExit () |
Indicate permission for the simulation to end. | |
Data Fields | |
std::string | type |
Component's type, set by the factory when the object is created. | |
Protected Member Functions | |
void | setDefaultTimeBase (TimeConverter *tc) |
Manually set the default detaulTimeBase. | |
Link * | selfLink (std::string name, Event::HandlerBase *handler=NULL) |
Protected Attributes | |
TimeConverter * | defaultTimeBase |
Timebase used if no other timebase is specified for calls like Component::getCurrentSimTime(). | |
Friends | |
class | boost::serialization::access |
Main component object for the simulation.
All models inherit from this.
SST::Component::Component | ( | ComponentId_t | id | ) |
Constructor.
Generally only called by the factory class.
id | Unique component ID |
virtual int SST::Component::Finish | ( | ) | [inline, virtual] |
Called after simulation completes, but before objects are destroyed.
A good place to print out statistics.
Reimplemented in Cpu, Cpu_data, Cpu_power, Cpu_PowerAndData, Cpu_router_power, DRAMSimC, event_test, Cpu, PHXSimC, PHXSimC, trig_cpu, trig_nic, Routermodel, SST::RtrIF, SS_router, RtrIF, sstdisksim, and sstdisksim_tracereader.
SimTime_t SST::Component::getCurrentSimTime | ( | std::string | base | ) |
return the time since the simulation began in timebase specified
base | Timebase frequency in SI Units |
SimTime_t SST::Component::getCurrentSimTime | ( | TimeConverter * | tc | ) |
return the time since the simulation began in units specified by the parameter.
tc | TimeConverter specificing the units |
TimeConverter * SST::Component::registerClock | ( | std::string | freq, | |
Clock::HandlerBase * | handler, | |||
bool | regAll = true | |||
) |
Registers a clock for this component.
freq | Frequency for the clock in SI units | |
handler | Pointer to Clock::HandlerBase which is to be invoked at the specified interval | |
regAll | Should this clock perioud be used as the default time base for all of the links connected to this component |
bool SST::Component::registerExit | ( | ) |
Register that the simulation should not end until this component says it is OK to.
Calling this function (generally done in Component::Setup()) increments a global counter. Calls to Component::unregisterExit() decrement the counter. The simulation cannot end unless this counter reaches zero, or the simulation time limit is reached. This counter is synchonized periodically with the other nodes.
TimeConverter * SST::Component::registerTimeBase | ( | std::string | base, | |
bool | regAll = true | |||
) |
Registers a default time base for the component and optionally sets the the component's links to that timebase.
Useful for components which do not have a clock, but would like a default timebase. base Frequency for the clock in SI units regAll Should this clock perioud be used as the default time base for all of the links connected to this component
virtual int SST::Component::Setup | ( | ) | [inline, virtual] |
Called after all components have been constructed, but before simulation time has begun.
Reimplemented in Cpu, Cpu_data, Cpu_power, Cpu_PowerAndData, Cpu_router_power, event_test, Cpu, trig_cpu, trig_nic, Routermodel, sstdisksim, and sstdisksim_tracereader.
bool SST::Component::unregisterExit | ( | ) |
Indicate permission for the simulation to end.
This function is the mirror of Component::registerExit(). It decrements the global counter, which, upon reaching zero, indicates that the simulation can terminate.
Referenced by sstdisksim_tracereader::Setup().
TimeConverter* SST::Component::defaultTimeBase [protected] |
Timebase used if no other timebase is specified for calls like Component::getCurrentSimTime().
Often set by Component::registerClock() function
Referenced by getCurrentSimTime(), SST::IntrospectedComponent::getFreq(), and setDefaultTimeBase().
std::string SST::Component::type |
Component's type, set by the factory when the object is created.
It is identical to the configuration string used to create the component. I.e. the XML "<component id="aFoo"><foo>..." would set component::type to "foo"