From a49b1df3f0d1e1c9ce46675d9fce7787d98caca7 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 10 Feb 2013 21:26:22 -0600 Subject: ruby: record fully busy cycle with in the controller This patch does several things. First, the counter for fully busy cycles for a controller is now kept with in the controller, instead of being part of the profiler. Second, the topology class no longer keeps an array of controllers which was only used for printing stats. Instead, ruby system will now ask each controller to print the stats. Thirdly, the statistical variable for recording how many different types were created is being moved in to the controller from the profiler. Note that for printing, the profiler will collate results from different controllers. --- src/mem/ruby/system/MachineID.hh | 6 +++++- src/mem/ruby/system/System.cc | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src/mem/ruby/system') diff --git a/src/mem/ruby/system/MachineID.hh b/src/mem/ruby/system/MachineID.hh index 18beac5d8..0bcd10efc 100644 --- a/src/mem/ruby/system/MachineID.hh +++ b/src/mem/ruby/system/MachineID.hh @@ -38,7 +38,11 @@ struct MachineID { MachineType type; - int num; // range: 0 ... number of this machine's components in system - 1 + //! range: 0 ... number of this machine's components in system - 1 + uint32_t num; + + MachineType getType() const { return type; } + uint32_t getNum() const { return num; } }; inline std::string diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 01e50ef0b..d2c7d357b 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -72,7 +72,6 @@ RubySystem::RubySystem(const Params *p) m_memory_size_bits = ceilLog2(m_memory_size_bytes); } - g_system_ptr = this; if (p->no_mem_vec) { m_mem_vec_ptr = NULL; } else { @@ -86,6 +85,12 @@ RubySystem::RubySystem(const Params *p) m_warmup_enabled = false; m_cooldown_enabled = false; + + // Setup the global variables used in Ruby + g_system_ptr = this; + + // Resize to the size of different machine types + g_abs_controls.resize(MachineType_NUM); } void @@ -111,6 +116,9 @@ void RubySystem::registerAbstractController(AbstractController* cntrl) { m_abs_cntrl_vec.push_back(cntrl); + + MachineID id = cntrl->getMachineID(); + g_abs_controls[id.getType()][id.getNum()] = cntrl; } void @@ -144,6 +152,15 @@ RubySystem::printStats(ostream& out) m_profiler_ptr->printStats(out); m_network_ptr->printStats(out); + + for (uint32_t i = 0;i < g_abs_controls.size(); ++i) { + for (map::iterator it = + g_abs_controls[i].begin(); + it != g_abs_controls[i].end(); ++it) { + + ((*it).second)->printStats(out); + } + } } void @@ -397,6 +414,9 @@ RubySystem::resetStats() { m_profiler_ptr->clearStats(); m_network_ptr->clearStats(); + for (uint32_t cntrl = 0; cntrl < m_abs_cntrl_vec.size(); cntrl++) { + m_abs_cntrl_vec[cntrl]->clearStats(); + } } bool -- cgit v1.2.3