2c2
< * Copyright (c) 2011-2014,2017 ARM Limited
---
> * Copyright (c) 2011-2014,2017-2018 ARM Limited
138c138
< tmp_id = getMasterId("writebacks");
---
> tmp_id = getMasterId(this, "writebacks");
140c140
< tmp_id = getMasterId("functional");
---
> tmp_id = getMasterId(this, "functional");
142c142
< tmp_id = getMasterId("interrupt");
---
> tmp_id = getMasterId(this, "interrupt");
495c495
< System::getMasterId(std::string master_name)
---
> System::getGlobalMasterId(std::string master_name)
497c497,509
< // strip off system name if the string starts with it
---
> return _getMasterId(nullptr, master_name);
> }
>
> MasterID
> System::getMasterId(const SimObject* master, std::string submaster)
> {
> auto master_name = leafMasterName(master, submaster);
> return _getMasterId(master, master_name);
> }
>
> MasterID
> System::_getMasterId(const SimObject* master, std::string master_name)
> {
502,503c514,515
< for (int i = 0; i < masterIds.size(); i++) {
< if (masterIds[i] == master_name) {
---
> for (int i = 0; i < masters.size(); i++) {
> if (masters[i].masterName == master_name) {
517c529,530
< masterIds.push_back(master_name);
---
> // Generate a new MasterID incrementally
> MasterID master_id = masters.size();
519c532,535
< return masterIds.size() - 1;
---
> // Append the new Master metadata to the group of system Masters.
> masters.emplace_back(master, master_name, master_id);
>
> return masters.back().masterId;
522a539,547
> System::leafMasterName(const SimObject* master, const std::string& submaster)
> {
> // Get the full master name by appending the submaster name to
> // the root SimObject master name
> auto master_name = master->name() + "." + submaster;
> return master_name;
> }
>
> std::string
525c550
< if (master_id >= masterIds.size())
---
> if (master_id >= masters.size())
528c553,554
< return masterIds[master_id];
---
> const auto& master_info = masters[master_id];
> return master_info.masterName;