diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:21 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:21 -0800 |
commit | cfe41d0a1bc3b778995cd1b22f8d58037300143b (patch) | |
tree | 93b720fd86a6a9a79dc4dc2632ff95fd5c0fa0c3 | |
parent | 1907e39fd2c30ead9589f0bb6995972cbd0e153f (diff) | |
download | gem5-cfe41d0a1bc3b778995cd1b22f8d58037300143b.tar.xz |
ruby: Removed RubySystem::getNumberOfSequencers
removed the static function RubySystem::getNumberOfSequencers and replaced
it with a python config variable
-rw-r--r-- | configs/ruby/Ruby.py | 3 | ||||
-rw-r--r-- | src/mem/ruby/common/Set.cc | 3 | ||||
-rw-r--r-- | src/mem/ruby/profiler/AddressProfiler.cc | 32 | ||||
-rw-r--r-- | src/mem/ruby/profiler/AddressProfiler.hh | 3 | ||||
-rw-r--r-- | src/mem/ruby/profiler/Profiler.cc | 36 | ||||
-rw-r--r-- | src/mem/ruby/profiler/Profiler.hh | 2 | ||||
-rw-r--r-- | src/mem/ruby/profiler/Profiler.py | 1 | ||||
-rw-r--r-- | src/mem/ruby/system/System.hh | 3 |
8 files changed, 49 insertions, 34 deletions
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py index 4504bda85..37c43602d 100644 --- a/configs/ruby/Ruby.py +++ b/configs/ruby/Ruby.py @@ -66,7 +66,8 @@ def create_system(options, physmem, piobus = None, dma_devices = []): ranksPerDimm = dir_cntrls[0].memBuffer.ranks_per_dimm dimmsPerChannel = dir_cntrls[0].memBuffer.dimms_per_channel - ruby_profiler = RubyProfiler(mem_cntrl_count = mcCount, + ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers), + mem_cntrl_count = mcCount, banks_per_rank = banksPerRank, ranks_per_dimm = ranksPerDimm, dimms_per_channel = dimmsPerChannel) diff --git a/src/mem/ruby/common/Set.cc b/src/mem/ruby/common/Set.cc index 467a09186..55648043c 100644 --- a/src/mem/ruby/common/Set.cc +++ b/src/mem/ruby/common/Set.cc @@ -51,7 +51,8 @@ Set::Set() { m_p_nArray = NULL; - setSize(RubySystem::getNumberOfSequencers()); + m_nArrayLen = 0; + m_nSize = 0; } // copy constructor diff --git a/src/mem/ruby/profiler/AddressProfiler.cc b/src/mem/ruby/profiler/AddressProfiler.cc index 9c9445de3..c613431ca 100644 --- a/src/mem/ruby/profiler/AddressProfiler.cc +++ b/src/mem/ruby/profiler/AddressProfiler.cc @@ -45,15 +45,22 @@ #include "mem/ruby/profiler/Profiler.hh" // Helper functions -static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map); -static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description); +static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, + Map<Address, + AccessTraceForAddress>* record_map); -AddressProfiler::AddressProfiler() +static void printSorted(ostream& out, + int num_of_sequencers, + const Map<Address, AccessTraceForAddress>* record_map, + string description); + +AddressProfiler::AddressProfiler(int num_of_sequencers) { m_dataAccessTrace = new Map<Address, AccessTraceForAddress>; m_macroBlockAccessTrace = new Map<Address, AccessTraceForAddress>; m_programCounterAccessTrace = new Map<Address, AccessTraceForAddress>; m_retryProfileMap = new Map<Address, AccessTraceForAddress>; + m_num_of_sequencers = num_of_sequencers; clearStats(); } @@ -88,18 +95,18 @@ void AddressProfiler::printStats(ostream& out) const out << "Hot Data Blocks" << endl; out << "---------------" << endl; out << endl; - printSorted(out, m_dataAccessTrace, "block_address"); + printSorted(out, m_num_of_sequencers, m_dataAccessTrace, "block_address"); out << endl; out << "Hot MacroData Blocks" << endl; out << "--------------------" << endl; out << endl; - printSorted(out, m_macroBlockAccessTrace, "macroblock_address"); + printSorted(out, m_num_of_sequencers, m_macroBlockAccessTrace, "macroblock_address"); out << "Hot Instructions" << endl; out << "----------------" << endl; out << endl; - printSorted(out, m_programCounterAccessTrace, "pc_address"); + printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, "pc_address"); } if (m_all_instructions){ @@ -107,7 +114,7 @@ void AddressProfiler::printStats(ostream& out) const out << "All Instructions Profile:" << endl; out << "-------------------------" << endl; out << endl; - printSorted(out, m_programCounterAccessTrace, "pc_address"); + printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, "pc_address"); out << endl; } @@ -123,7 +130,7 @@ void AddressProfiler::printStats(ostream& out) const m_retryProfileHisto.printPercent(out); out << endl; - printSorted(out, m_retryProfileMap, "block_address"); + printSorted(out, m_num_of_sequencers, m_retryProfileMap, "block_address"); out << endl; } @@ -212,7 +219,10 @@ void AddressProfiler::profileRetry(const Address& data_addr, AccessType type, in // ***** Normal Functions ****** -static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description) +static void printSorted(ostream& out, + int num_of_sequencers, + const Map<Address, AccessTraceForAddress>* record_map, + string description) { const int records_printed = 100; @@ -241,8 +251,8 @@ static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* // Allows us to track how many lines where touched by n processors Vector<int64> m_touched_vec; Vector<int64> m_touched_weighted_vec; - m_touched_vec.setSize(RubySystem::getNumberOfSequencers()+1); - m_touched_weighted_vec.setSize(RubySystem::getNumberOfSequencers()+1); + m_touched_vec.setSize(num_of_sequencers+1); + m_touched_weighted_vec.setSize(num_of_sequencers+1); for (int i=0; i<m_touched_vec.size(); i++) { m_touched_vec[i] = 0; m_touched_weighted_vec[i] = 0; diff --git a/src/mem/ruby/profiler/AddressProfiler.hh b/src/mem/ruby/profiler/AddressProfiler.hh index 24ee2af05..177aa56d6 100644 --- a/src/mem/ruby/profiler/AddressProfiler.hh +++ b/src/mem/ruby/profiler/AddressProfiler.hh @@ -53,7 +53,7 @@ template <class KEY_TYPE, class VALUE_TYPE> class Map; class AddressProfiler { public: // Constructors - AddressProfiler(); + AddressProfiler(int num_of_sequencers); // Destructor ~AddressProfiler(); @@ -95,6 +95,7 @@ private: bool m_hot_lines; bool m_all_instructions; + int m_num_of_sequencers; }; // Output operator declaration diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc index 0a65f88fc..a4f0a7c97 100644 --- a/src/mem/ruby/profiler/Profiler.cc +++ b/src/mem/ruby/profiler/Profiler.cc @@ -88,6 +88,8 @@ Profiler::Profiler(const Params *p) m_hot_lines = p->hot_lines; m_all_instructions = p->all_instructions; + m_num_of_sequencers = p->num_of_sequencers; + // // Initialize the memory controller profiler structs // @@ -125,12 +127,12 @@ Profiler::Profiler(const Params *p) m_hot_lines = false; m_all_instructions = false; - m_address_profiler_ptr = new AddressProfiler; + m_address_profiler_ptr = new AddressProfiler(m_num_of_sequencers); m_address_profiler_ptr -> setHotLines(m_hot_lines); m_address_profiler_ptr -> setAllInstructions(m_all_instructions); if (m_all_instructions) { - m_inst_profiler_ptr = new AddressProfiler; + m_inst_profiler_ptr = new AddressProfiler(m_num_of_sequencers); m_inst_profiler_ptr -> setHotLines(m_hot_lines); m_inst_profiler_ptr -> setAllInstructions(m_all_instructions); } @@ -156,9 +158,9 @@ void Profiler::wakeup() // FIXME - avoid the repeated code Vector<integer_t> perProcCycleCount; - perProcCycleCount.setSize(RubySystem::getNumberOfSequencers()); + perProcCycleCount.setSize(m_num_of_sequencers); - for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) { + for(int i=0; i < m_num_of_sequencers; i++) { perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1; // The +1 allows us to avoid division by zero } @@ -317,11 +319,11 @@ void Profiler::printStats(ostream& out, bool short_stats) Vector<double> perProcMissesPerTrans; - perProcCycleCount.setSize(RubySystem::getNumberOfSequencers()); - perProcCyclesPerTrans.setSize(RubySystem::getNumberOfSequencers()); - perProcMissesPerTrans.setSize(RubySystem::getNumberOfSequencers()); + perProcCycleCount.setSize(m_num_of_sequencers); + perProcCyclesPerTrans.setSize(m_num_of_sequencers); + perProcMissesPerTrans.setSize(m_num_of_sequencers); - for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) { + for(int i=0; i < m_num_of_sequencers; i++) { perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1; // The +1 allows us to avoid division by zero @@ -342,7 +344,7 @@ void Profiler::printStats(ostream& out, bool short_stats) integer_t transactions_started = m_perProcStartTransaction.sum(); integer_t transactions_ended = m_perProcEndTransaction.sum(); - double cycles_per_transaction = (transactions_ended != 0) ? (RubySystem::getNumberOfSequencers() * double(ruby_cycles)) / double(transactions_ended) : 0; + double cycles_per_transaction = (transactions_ended != 0) ? (m_num_of_sequencers * double(ruby_cycles)) / double(transactions_ended) : 0; double misses_per_transaction = (transactions_ended != 0) ? double(total_misses) / double(transactions_ended) : 0; out << "Total_misses: " << total_misses << endl; @@ -566,8 +568,8 @@ void Profiler::clearStats() { m_ruby_start = g_eventQueue_ptr->getTime(); - m_cycles_executed_at_start.setSize(RubySystem::getNumberOfSequencers()); - for (int i=0; i < RubySystem::getNumberOfSequencers(); i++) { + m_cycles_executed_at_start.setSize(m_num_of_sequencers); + for (int i=0; i < m_num_of_sequencers; i++) { if (g_system_ptr == NULL) { m_cycles_executed_at_start[i] = 0; } else { @@ -575,13 +577,13 @@ void Profiler::clearStats() } } - m_perProcTotalMisses.setSize(RubySystem::getNumberOfSequencers()); - m_perProcUserMisses.setSize(RubySystem::getNumberOfSequencers()); - m_perProcSupervisorMisses.setSize(RubySystem::getNumberOfSequencers()); - m_perProcStartTransaction.setSize(RubySystem::getNumberOfSequencers()); - m_perProcEndTransaction.setSize(RubySystem::getNumberOfSequencers()); + m_perProcTotalMisses.setSize(m_num_of_sequencers); + m_perProcUserMisses.setSize(m_num_of_sequencers); + m_perProcSupervisorMisses.setSize(m_num_of_sequencers); + m_perProcStartTransaction.setSize(m_num_of_sequencers); + m_perProcEndTransaction.setSize(m_num_of_sequencers); - for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) { + for(int i=0; i < m_num_of_sequencers; i++) { m_perProcTotalMisses[i] = 0; m_perProcUserMisses[i] = 0; m_perProcSupervisorMisses[i] = 0; diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh index 8c5e54f51..4af0f559d 100644 --- a/src/mem/ruby/profiler/Profiler.hh +++ b/src/mem/ruby/profiler/Profiler.hh @@ -262,6 +262,8 @@ private: //added by SS bool m_hot_lines; bool m_all_instructions; + + int m_num_of_sequencers; }; // Output operator declaration diff --git a/src/mem/ruby/profiler/Profiler.py b/src/mem/ruby/profiler/Profiler.py index 9210c3c0b..9d81d4014 100644 --- a/src/mem/ruby/profiler/Profiler.py +++ b/src/mem/ruby/profiler/Profiler.py @@ -6,6 +6,7 @@ class RubyProfiler(SimObject): cxx_class = 'Profiler' hot_lines = Param.Bool(False, "") all_instructions = Param.Bool(False, "") + num_of_sequencers = Param.Int("") mem_cntrl_count = Param.Int(0, "") banks_per_rank = Param.Int("") ranks_per_dimm = Param.Int("") diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh index bc5cd3f3d..02676f4c7 100644 --- a/src/mem/ruby/system/System.hh +++ b/src/mem/ruby/system/System.hh @@ -124,9 +124,6 @@ public: static RubyEventQueue* getEventQueue() { return g_eventQueue_ptr; } - static int getNumberOfDirectories() { return m_directories.size(); } - static int getNumberOfSequencers() { return m_sequencers.size(); } - Profiler* getProfiler() {assert(m_profiler_ptr != NULL); return m_profiler_ptr; } static Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; } static MemoryVector* getMemoryVector() { assert(m_mem_vec_ptr != NULL); return m_mem_vec_ptr;} |