@@ -82,7 +82,7 @@ BaseComponent::~BaseComponent()
8282 my_info->component = nullptr ;
8383 if ( my_info->parent_info ) {
8484 std::map<ComponentId_t, ComponentInfo>& parent_subcomps = my_info->parent_info ->getSubComponents ();
85- size_t deleted = parent_subcomps.erase (my_info->id );
85+ size_t deleted = parent_subcomps.erase (my_info->id_ );
8686 if ( deleted != 1 ) {
8787 // Should never happen, but issue warning just in case
8888 sim_->getSimulationOutput ().output (
@@ -288,6 +288,7 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
288288 tmp = my_info->parent_info ->component ->getLinkFromParentSharedPort (name, port_modules);
289289 // If I got a link from my parent, I need to put it in my
290290 // link map
291+
291292 if ( nullptr != tmp ) {
292293 if ( nullptr == myLinks ) {
293294 myLinks = new LinkMap ();
@@ -299,8 +300,11 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
299300
300301 // Need to see if I got any port_modules, if so, need
301302 // to add them to my_info->portModules
303+
302304 if ( port_modules.size () > 0 ) {
303305 if ( nullptr == my_info->portModules ) {
306+ // This memory is currently leaked as portModules is otherwise a pointer to ConfigComponent
307+ // ConfigComponent does not exist for anonymous subcomponents
304308 my_info->portModules = new std::map<std::string, std::vector<ConfigPortModule>>();
305309 }
306310 (*my_info->portModules )[name].swap (port_modules);
@@ -331,7 +335,9 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
331335 }
332336
333337 // Check for PortModules
334- if ( my_info->portModules != nullptr ) {
338+ // portModules pointer may be invalid after wire up
339+ // Only SelfLinks can be initialized after wire up and SelfLinks do not support PortModules
340+ if ( !sim_->isWireUpFinished () && my_info->portModules != nullptr ) {
335341 auto it = my_info->portModules ->find (name);
336342 if ( it != my_info->portModules ->end () ) {
337343 EventHandlerMetaData mdata (my_info->getID (), getName (), getType (), name);
@@ -683,13 +689,11 @@ BaseComponent::getComponentInfoStatisticEnableLevel(const std::string& statistic
683689}
684690
685691void
686- BaseComponent::configureCollectionMode (
687- Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name)
692+ BaseComponent::configureCollectionMode (Statistics::StatisticBase* statistic, const std::string& name)
688693{
689694 StatisticBase::StatMode_t statCollectionMode = StatisticBase::STAT_MODE_COUNT;
690695 Output& out = Simulation_impl::getSimulationOutput ();
691- std::string statRateParam = params.find <std::string>(" rate" , " 0ns" );
692- UnitAlgebra collectionRate (statRateParam);
696+ UnitAlgebra collectionRate = statistic->getCollectionRate ();
693697
694698 // make sure we have a valid collection rate
695699 // Check that the Collection Rate is a valid unit type that we can use
@@ -766,7 +770,7 @@ BaseComponent::createStatistic(
766770 cpp_params.insert (python_params);
767771 std::string type = cpp_params.find <std::string>(" type" , " sst.AccumulatorStatistic" );
768772 auto * stat = fxn (this , engine, type, name, subId, cpp_params);
769- configureCollectionMode (stat, cpp_params, name);
773+ configureCollectionMode (stat, name);
770774 engine->registerStatisticWithEngine (stat);
771775 return stat;
772776}
@@ -775,16 +779,16 @@ Statistics::StatisticBase*
775779BaseComponent::createEnabledAllStatistic (
776780 Params& params, const std::string& name, const std::string& statSubId, StatCreateFunction fxn)
777781{
778- auto iter = m_enabledAllStats .find (name);
779- if ( iter != m_enabledAllStats .end () ) {
782+ auto iter = m_enabled_all_stats_ .find (name);
783+ if ( iter != m_enabled_all_stats_ .end () ) {
780784 auto & submap = iter->second ;
781785 auto subiter = submap.find (statSubId);
782786 if ( subiter != submap.end () ) { return subiter->second ; }
783787 }
784788
785789 // a matching statistic was not found
786- auto * stat = createStatistic (params, my_info->allStatConfig ->params , name, statSubId, true , std::move (fxn));
787- m_enabledAllStats [name][statSubId] = stat;
790+ auto * stat = createStatistic (params, my_info->all_stat_config_ ->params , name, statSubId, true , std::move (fxn));
791+ if ( !stat-> isNullStatistic () ) { m_enabled_all_stats_ [name][statSubId] = stat; }
788792 return stat;
789793}
790794
@@ -799,8 +803,8 @@ BaseComponent::createExplicitlyEnabledStatistic(
799803 name.c_str ());
800804 }
801805
802- auto piter = my_info->statConfigs ->find (id);
803- if ( piter == my_info->statConfigs ->end () ) {
806+ auto piter = my_info->stat_configs_ ->find (id);
807+ if ( piter == my_info->stat_configs_ ->end () ) {
804808 out.fatal (
805809 CALL_INFO, 1 , " Explicitly enabled statistic '%s' does not have parameters mapped to its ID" , name.c_str ());
806810 }
@@ -919,9 +923,7 @@ BaseComponent::serialize_order(SST::Core::Serialization::serializer& ser)
919923 }
920924}
921925
922- namespace Core {
923- namespace Serialization {
924- namespace pvt {
926+ namespace Core ::Serialization::pvt {
925927
926928static const long null_ptr_id = -1 ;
927929
@@ -987,7 +989,7 @@ SerializeBaseComponentHelper::map_basecomponent(serializable_base*& s, serialize
987989 ObjectMap* my_info_dir = new ObjectMapHierarchyOnly ();
988990 ser.mapper ().map_hierarchy_start (" my_info" , my_info_dir);
989991 ser.mapper ().setNextObjectReadOnly ();
990- sst_map_object (ser, const_cast <ComponentId_t&>(comp->my_info ->id ), " id" );
992+ sst_map_object (ser, const_cast <ComponentId_t&>(comp->my_info ->id_ ), " id" );
991993 ser.mapper ().setNextObjectReadOnly ();
992994 sst_map_object (ser, const_cast <std::string&>(comp->my_info ->type ), " type" );
993995 sst_map_object (ser, comp->my_info ->defaultTimeBase , " defaultTimeBase" );
@@ -997,9 +999,6 @@ SerializeBaseComponentHelper::map_basecomponent(serializable_base*& s, serialize
997999 ser.mapper ().map_hierarchy_end (); // obj_map
9981000}
9991001
1000- } // namespace pvt
1001- } // namespace Serialization
1002- } // namespace Core
1003-
1002+ } // namespace Core::Serialization::pvt
10041003
10051004} // namespace SST
0 commit comments