summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2010-01-29 20:29:22 -0800
committerBrad Beckmann <Brad.Beckmann@amd.com>2010-01-29 20:29:22 -0800
commitf88faa6c11bbb5c5f95fe32ccffca73c7c4758c8 (patch)
tree73f1ccfa1f56d86a8787f6e04a8c2cb116167e8c /src/mem/ruby/system
parentcfe41d0a1bc3b778995cd1b22f8d58037300143b (diff)
downloadgem5-f88faa6c11bbb5c5f95fe32ccffca73c7c4758c8.tar.xz
ruby: cleaned up ruby profilers
Cleaned up the ruby profilers by moving the memory controller profiling code out of the main profiler object and into a separate object similar to the current CacheProfiler. Both the CacheProfiler and MemCntrlProfiler are specific to a particular Ruby object, CacheMemory and MemoryControl respectively. Therefore, these profilers should not be SimObjects and created by the python configuration system, but instead private objects. This simplifies the creation of these profilers.
Diffstat (limited to 'src/mem/ruby/system')
-rw-r--r--src/mem/ruby/system/Cache.py1
-rw-r--r--src/mem/ruby/system/CacheMemory.cc2
-rw-r--r--src/mem/ruby/system/MemoryControl.cc52
-rw-r--r--src/mem/ruby/system/MemoryControl.hh7
4 files changed, 39 insertions, 23 deletions
diff --git a/src/mem/ruby/system/Cache.py b/src/mem/ruby/system/Cache.py
index 5cec5d6e6..209d6f6e2 100644
--- a/src/mem/ruby/system/Cache.py
+++ b/src/mem/ruby/system/Cache.py
@@ -9,4 +9,3 @@ class RubyCache(SimObject):
latency = Param.Int("");
assoc = Param.Int("");
replacement_policy = Param.String("PSEUDO_LRU", "");
- cache_profiler = Param.CacheProfiler("");
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc
index 60783c433..8c5112183 100644
--- a/src/mem/ruby/system/CacheMemory.cc
+++ b/src/mem/ruby/system/CacheMemory.cc
@@ -57,7 +57,7 @@ CacheMemory::CacheMemory(const Params *p)
m_latency = p->latency;
m_cache_assoc = p->assoc;
m_policy = p->replacement_policy;
- m_profiler_ptr = p->cache_profiler;
+ m_profiler_ptr = new CacheProfiler(name());
}
diff --git a/src/mem/ruby/system/MemoryControl.cc b/src/mem/ruby/system/MemoryControl.cc
index 0a7b93e6f..0f12efc36 100644
--- a/src/mem/ruby/system/MemoryControl.cc
+++ b/src/mem/ruby/system/MemoryControl.cc
@@ -154,7 +154,6 @@ ostream& operator<<(ostream& out, const MemoryControl& obj)
MemoryControl::MemoryControl(const Params *p)
: SimObject(p)
{
- m_version = p->version;
m_mem_bus_cycle_multiplier = p->mem_bus_cycle_multiplier;
m_banks_per_rank = p->banks_per_rank;
m_ranks_per_dimm = p->ranks_per_dimm;
@@ -172,6 +171,11 @@ MemoryControl::MemoryControl(const Params *p)
m_tFaw = p->tFaw;
m_mem_random_arbitrate = p->mem_random_arbitrate;
m_mem_fixed_delay = p->mem_fixed_delay;
+
+ m_profiler_ptr = new MemCntrlProfiler(name(),
+ m_banks_per_rank,
+ m_ranks_per_dimm,
+ m_dimms_per_channel);
}
void MemoryControl::init()
@@ -179,8 +183,6 @@ void MemoryControl::init()
m_msg_counter = 0;
m_debug = 0;
- //if (m_version == 0) m_debug = 1;
-
assert(m_tFaw <= 62); // must fit in a uint64 shift register
@@ -235,6 +237,7 @@ MemoryControl::~MemoryControl () {
delete [] m_bankQueues;
delete [] m_bankBusyCounter;
delete [] m_oldRequest;
+ delete m_profiler_ptr;
}
@@ -268,7 +271,7 @@ void MemoryControl::enqueueMemRef (MemoryNode& memRef) {
printf("bank =%3x\n", bank);
}
- g_system_ptr->getProfiler()->profileMemReq(m_version, bank);
+ m_profiler_ptr->profileMemReq(bank);
m_input_queue.push_back(memRef);
if (!m_awakened) {
g_eventQueue_ptr->scheduleEvent(this, 1);
@@ -321,6 +324,7 @@ void MemoryControl::print (ostream& out) const {
void MemoryControl::printConfig (ostream& out) {
+ out << "Memory Control " << name() << ":" << endl;
out << " Ruby cycles per memory cycle: " << m_mem_bus_cycle_multiplier << endl;
out << " Basic read latency: " << m_mem_ctl_latency << endl;
if (m_mem_fixed_delay) {
@@ -348,6 +352,16 @@ void MemoryControl::setDebug (int debugFlag) {
m_debug = debugFlag;
}
+void MemoryControl::clearStats() const
+{
+ m_profiler_ptr->clearStats();
+}
+
+void MemoryControl::printStats(ostream& out) const
+{
+ m_profiler_ptr->printStats(out);
+}
+
// ****************************************************************
@@ -394,19 +408,19 @@ int MemoryControl::getRank (int bank) {
bool MemoryControl::queueReady (int bank) {
if ((m_bankBusyCounter[bank] > 0) && !m_mem_fixed_delay) {
- g_system_ptr->getProfiler()->profileMemBankBusy(m_version);
+ m_profiler_ptr->profileMemBankBusy();
//if (m_debug) printf(" bank %x busy %d\n", bank, m_bankBusyCounter[bank]);
return false;
}
if (m_mem_random_arbitrate >= 2) {
if ((random() % 100) < m_mem_random_arbitrate) {
- g_system_ptr->getProfiler()->profileMemRandBusy(m_version);
+ m_profiler_ptr->profileMemRandBusy();
return false;
}
}
if (m_mem_fixed_delay) return true;
if ((m_ageCounter > (2 * m_bank_busy_time)) && !m_oldRequest[bank]) {
- g_system_ptr->getProfiler()->profileMemNotOld(m_version);
+ m_profiler_ptr->profileMemNotOld();
return false;
}
if (m_busBusyCounter_Basic == m_basic_bus_busy_time) {
@@ -415,26 +429,26 @@ bool MemoryControl::queueReady (int bank) {
// a bus wait. This is a little inaccurate since it MIGHT
// have also been blocked waiting for a read-write or a
// read-read instead, but it's pretty close.
- g_system_ptr->getProfiler()->profileMemArbWait(m_version, 1);
+ m_profiler_ptr->profileMemArbWait(1);
return false;
}
if (m_busBusyCounter_Basic > 0) {
- g_system_ptr->getProfiler()->profileMemBusBusy(m_version);
+ m_profiler_ptr->profileMemBusBusy();
return false;
}
int rank = getRank(bank);
if (m_tfaw_count[rank] >= ACTIVATE_PER_TFAW) {
- g_system_ptr->getProfiler()->profileMemTfawBusy(m_version);
+ m_profiler_ptr->profileMemTfawBusy();
return false;
}
bool write = !m_bankQueues[bank].front().m_is_mem_read;
if (write && (m_busBusyCounter_Write > 0)) {
- g_system_ptr->getProfiler()->profileMemReadWriteBusy(m_version);
+ m_profiler_ptr->profileMemReadWriteBusy();
return false;
}
if (!write && (rank != m_busBusy_WhichRank)
&& (m_busBusyCounter_ReadNewRank > 0)) {
- g_system_ptr->getProfiler()->profileMemDataBusBusy(m_version);
+ m_profiler_ptr->profileMemDataBusBusy();
return false;
}
return true;
@@ -459,7 +473,7 @@ bool MemoryControl::issueRefresh (int bank) {
//uint64 current_time = g_eventQueue_ptr->getTime();
//printf(" Refresh bank %3x at %lld\n", bank, current_time);
//}
- g_system_ptr->getProfiler()->profileMemRefresh(m_version);
+ m_profiler_ptr->profileMemRefresh();
m_need_refresh--;
m_refresh_bank++;
if (m_refresh_bank >= m_total_banks) m_refresh_bank = 0;
@@ -503,12 +517,12 @@ void MemoryControl::issueRequest (int bank) {
m_bankBusyCounter[bank] = m_bank_busy_time;
m_busBusy_WhichRank = rank;
if (req.m_is_mem_read) {
- g_system_ptr->getProfiler()->profileMemRead(m_version);
+ m_profiler_ptr->profileMemRead();
m_busBusyCounter_Basic = m_basic_bus_busy_time;
m_busBusyCounter_Write = m_basic_bus_busy_time + m_read_write_delay;
m_busBusyCounter_ReadNewRank = m_basic_bus_busy_time + m_rank_rank_delay;
} else {
- g_system_ptr->getProfiler()->profileMemWrite(m_version);
+ m_profiler_ptr->profileMemWrite();
m_busBusyCounter_Basic = m_basic_bus_busy_time;
m_busBusyCounter_Write = m_basic_bus_busy_time;
m_busBusyCounter_ReadNewRank = m_basic_bus_busy_time;
@@ -577,7 +591,7 @@ void MemoryControl::executeCycle () {
issueRefresh(m_roundRobin);
int qs = m_bankQueues[m_roundRobin].size();
if (qs > 1) {
- g_system_ptr->getProfiler()->profileMemBankQ(m_version, qs-1);
+ m_profiler_ptr->profileMemBankQ(qs-1);
}
if (qs > 0) {
m_idleCount = IDLECOUNT_MAX_VALUE; // we're not idle if anything is queued
@@ -586,14 +600,14 @@ void MemoryControl::executeCycle () {
issueRequest(m_roundRobin);
banksIssued++;
if (m_mem_fixed_delay) {
- g_system_ptr->getProfiler()->profileMemWaitCycles(m_version, m_mem_fixed_delay);
+ m_profiler_ptr->profileMemWaitCycles(m_mem_fixed_delay);
}
}
}
}
// memWaitCycles is a redundant catch-all for the specific counters in queueReady
- g_system_ptr->getProfiler()->profileMemWaitCycles(m_version, queueHeads - banksIssued);
+ m_profiler_ptr->profileMemWaitCycles(queueHeads - banksIssued);
// Check input queue and move anything to bank queues if not full.
// Since this is done here at the end of the cycle, there will always
@@ -610,7 +624,7 @@ void MemoryControl::executeCycle () {
m_input_queue.pop_front();
m_bankQueues[bank].push_back(req);
}
- g_system_ptr->getProfiler()->profileMemInputQ(m_version, m_input_queue.size());
+ m_profiler_ptr->profileMemInputQ(m_input_queue.size());
}
}
diff --git a/src/mem/ruby/system/MemoryControl.hh b/src/mem/ruby/system/MemoryControl.hh
index c875c0bbc..b96055cb1 100644
--- a/src/mem/ruby/system/MemoryControl.hh
+++ b/src/mem/ruby/system/MemoryControl.hh
@@ -42,7 +42,7 @@
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/profiler/Profiler.hh"
+#include "mem/ruby/profiler/MemCntrlProfiler.hh"
#include "mem/ruby/system/System.hh"
#include "mem/ruby/slicc_interface/Message.hh"
#include "mem/gems_common/util.hh"
@@ -99,6 +99,8 @@ public:
void printConfig (ostream& out);
void print (ostream& out) const;
void setDebug (int debugFlag);
+ void clearStats() const;
+ void printStats(ostream& out) const;
//added by SS
@@ -123,7 +125,6 @@ private:
// data members
Consumer* m_consumer_ptr; // Consumer to signal a wakeup()
- int m_version;
string m_description;
int m_msg_counter;
int m_awakened;
@@ -178,6 +179,8 @@ private:
int m_ageCounter; // age of old requests; to detect starvation
int m_idleCount; // watchdog timer for shutting down
int m_debug; // turn on printf's
+
+ MemCntrlProfiler* m_profiler_ptr;
};
#endif // MEMORY_CONTROL_H