ruby: Removed RubySystem::getNumberOfSequencers
authorBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:21 +0000 (20:29 -0800)
committerBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:21 +0000 (20:29 -0800)
removed the static function RubySystem::getNumberOfSequencers and replaced
it with a python config variable

configs/ruby/Ruby.py
src/mem/ruby/common/Set.cc
src/mem/ruby/profiler/AddressProfiler.cc
src/mem/ruby/profiler/AddressProfiler.hh
src/mem/ruby/profiler/Profiler.cc
src/mem/ruby/profiler/Profiler.hh
src/mem/ruby/profiler/Profiler.py
src/mem/ruby/system/System.hh

index 4504bda85b1d45e12f1780e14e3dff0f739808a4..37c43602d8c35e0593e6fbf0b4d4d84040e44dde 100644 (file)
@@ -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)
index 467a09186d70a1a6dbbb19dc2de6296b336961ee..55648043c35bfda8bce95c3c65ae3b4d31951167 100644 (file)
@@ -51,7 +51,8 @@
 Set::Set()
 {
   m_p_nArray = NULL;
-  setSize(RubySystem::getNumberOfSequencers());
+  m_nArrayLen = 0;
+  m_nSize = 0;
 }
 
 // copy constructor
index 9c9445de31bfba74ee2bccae1ddccfb15b285e1e..c613431cafc6cfb1df40818993c06eff7665d704 100644 (file)
 #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;
index 24ee2af05f6169140d59f4315b45253ef657924e..177aa56d66fece69a010711cf2f3440fb1a2119d 100644 (file)
@@ -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
index 0a65f88fca89d6881bd0186f730ce4d21ac14c3d..a4f0a7c97d4aa887eb71bd3ba10933b67d589125 100644 (file)
@@ -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;
index 8c5e54f5175c08b209d5b653d4e3cd7465c6c229..4af0f559d5dbdbf2b33c52f8a959109a2032bf6c 100644 (file)
@@ -262,6 +262,8 @@ private:
   //added by SS
   bool m_hot_lines;
   bool m_all_instructions;
+
+  int m_num_of_sequencers;
 };
 
 // Output operator declaration
index 9210c3c0b21edc05c2156bf3d3900f6091a78119..9d81d40148f8a31f049ce76860524fc72b25553a 100644 (file)
@@ -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("")
index bc5cd3f3dbc6fcca56a295f21f900e71b2587bd6..02676f4c7422ccc385f1f23647bc1afafd10d612 100644 (file)
@@ -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;}