changeset 323cd43a3c46 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=323cd43a3c46
description:
ruby: Memory Controller Profiler with new config system
This patch includes a rather substantial change to the memory controller
profiler in order to work with the new configuration system. Most
noteably, the mem_cntrl_profiler no longer uses a string map, but
instead
a vector. Eventually this support should be removed from the main
profiler and go into a separate object. Each memory controller should
have
a pointer to that new mem_cntrl profile object.
diffstat:
8 files changed, 273 insertions(+), 173 deletions(-)
configs/example/memtest-ruby.py | 26 ++
src/mem/ruby/profiler/Profiler.cc | 311 +++++++++++++++++++++-------------
src/mem/ruby/profiler/Profiler.hh | 66 +++----
src/mem/ruby/profiler/Profiler.py | 4
src/mem/ruby/system/MemoryControl.cc | 35 +--
src/mem/ruby/system/MemoryControl.hh | 2
src/mem/ruby/system/MemoryControl.py | 1
src/mem/ruby/system/System.cc | 1
diffs (truncated from 710 to 300 lines):
diff -r de8e755aca4f -r 323cd43a3c46 configs/example/memtest-ruby.py
--- a/configs/example/memtest-ruby.py Fri Jan 29 20:29:19 2010 -0800
+++ b/configs/example/memtest-ruby.py Fri Jan 29 20:29:20 2010 -0800
@@ -135,9 +135,11 @@
L1DcacheMemory = l1d_cache,
L2cacheMemory = l2_cache)
+ mem_cntrl = RubyMemoryControl(version = i)
+
dir_cntrl = Directory_Controller(version = i,
directory = RubyDirectoryMemory(),
- memBuffer = RubyMemoryControl())
+ memBuffer = mem_cntrl)
dma_cntrl = DMA_Controller(version = i,
dma_sequencer = DMASequencer())
@@ -167,13 +169,27 @@
mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
for dir_cntrl in dir_cntrl_nodes])
+#
+# determine the number of memory controllers and other memory controller
+# parameters for the profiler
+#
+mcCount = len(dir_cntrl_nodes)
+banksPerRank = dir_cntrl_nodes[0].memBuffer.banks_per_rank
+ranksPerDimm = dir_cntrl_nodes[0].memBuffer.ranks_per_dimm
+dimmsPerChannel = dir_cntrl_nodes[0].memBuffer.dimms_per_channel
+
+ruby_profiler = RubyProfiler(mem_cntrl_count = mcCount,
+ banks_per_rank = banksPerRank,
+ ranks_per_dimm = ranksPerDimm,
+ dimms_per_channel = dimmsPerChannel)
+
system.ruby = RubySystem(clock = '1GHz',
network = network,
- profiler = RubyProfiler(),
+ profiler = ruby_profiler,
tracer = RubyTracer(),
- debug = RubyDebug(filter_string = 'qQin',
- verbosity_string = 'high',
- protocol_trace = True),
+ debug = RubyDebug(filter_string = 'none',
+ verbosity_string = 'none',
+ protocol_trace = False),
mem_size_mb = mem_size_mb)
diff -r de8e755aca4f -r 323cd43a3c46 src/mem/ruby/profiler/Profiler.cc
--- a/src/mem/ruby/profiler/Profiler.cc Fri Jan 29 20:29:19 2010 -0800
+++ b/src/mem/ruby/profiler/Profiler.cc Fri Jan 29 20:29:20 2010 -0800
@@ -88,57 +88,40 @@
m_hot_lines = p->hot_lines;
m_all_instructions = p->all_instructions;
- RubySystem::m_profiler_ptr = this;
-}
+ //
+ // Initialize the memory controller profiler structs
+ //
+ m_mc_profilers.setSize(p->mem_cntrl_count);
+ for (int mem_cntrl = 0; mem_cntrl < p->mem_cntrl_count; mem_cntrl++) {
+ m_mc_profilers[mem_cntrl] = new memory_control_profiler;
+ m_mc_profilers[mem_cntrl]->m_memReq = 0;
+ m_mc_profilers[mem_cntrl]->m_memBankBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memBusBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memReadWriteBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memDataBusBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memTfawBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memRefresh = 0;
+ m_mc_profilers[mem_cntrl]->m_memRead = 0;
+ m_mc_profilers[mem_cntrl]->m_memWrite = 0;
+ m_mc_profilers[mem_cntrl]->m_memWaitCycles = 0;
+ m_mc_profilers[mem_cntrl]->m_memInputQ = 0;
+ m_mc_profilers[mem_cntrl]->m_memBankQ = 0;
+ m_mc_profilers[mem_cntrl]->m_memArbWait = 0;
+ m_mc_profilers[mem_cntrl]->m_memRandBusy = 0;
+ m_mc_profilers[mem_cntrl]->m_memNotOld = 0;
-Profiler::~Profiler()
-{
- if (m_periodic_output_file_ptr != &cerr) {
- delete m_periodic_output_file_ptr;
- }
- delete m_requestProfileMap_ptr;
-}
+ m_mc_profilers[mem_cntrl]->m_banks_per_rank = p->banks_per_rank;
+ m_mc_profilers[mem_cntrl]->m_ranks_per_dimm = p->ranks_per_dimm;
+ m_mc_profilers[mem_cntrl]->m_dimms_per_channel =
+ p->dimms_per_channel;
-void Profiler::init(const vector<string> & argv, vector<string>
memory_control_names)
-{
- // added by SS
- vector<string>::iterator it;
- memory_control_profiler* mcp;
- m_memory_control_names = memory_control_names;
-// printf ( "Here in Profiler::init \n");
- for ( it=memory_control_names.begin() ; it < memory_control_names.end();
it++ ){
-// printf ( "Here in Profiler::init memory control name %s \n",
(*it).c_str());
- mcp = new memory_control_profiler;
- mcp->m_memReq = 0;
- mcp->m_memBankBusy = 0;
- mcp->m_memBusBusy = 0;
- mcp->m_memReadWriteBusy = 0;
- mcp->m_memDataBusBusy = 0;
- mcp->m_memTfawBusy = 0;
- mcp->m_memRefresh = 0;
- mcp->m_memRead = 0;
- mcp->m_memWrite = 0;
- mcp->m_memWaitCycles = 0;
- mcp->m_memInputQ = 0;
- mcp->m_memBankQ = 0;
- mcp->m_memArbWait = 0;
- mcp->m_memRandBusy = 0;
- mcp->m_memNotOld = 0;
+ int totalBanks = p->banks_per_rank *
+ p->ranks_per_dimm *
+ p->dimms_per_channel;
- mcp->m_banks_per_rank =
RubySystem::getMemoryControl((*it).c_str())->getBanksPerRank();
- mcp->m_ranks_per_dimm =
RubySystem::getMemoryControl((*it).c_str())->getRanksPerDimm();
- mcp->m_dimms_per_channel =
RubySystem::getMemoryControl((*it).c_str())->getDimmsPerChannel();
+ m_mc_profilers[mem_cntrl]->m_memBankCount.setSize(totalBanks);
+ }
- int totalBanks = mcp->m_banks_per_rank
- * mcp->m_ranks_per_dimm
- * mcp->m_dimms_per_channel;
-
- mcp->m_memBankCount.setSize(totalBanks);
-
- m_memory_control_profilers [(*it).c_str()] = mcp;
- }
-
- clearStats();
m_hot_lines = false;
m_all_instructions = false;
@@ -153,6 +136,21 @@
}
}
+Profiler::~Profiler()
+{
+ if (m_periodic_output_file_ptr != &cerr) {
+ delete m_periodic_output_file_ptr;
+ }
+
+ for (int mem_cntrl = 0;
+ mem_cntrl < m_mc_profilers.size();
+ mem_cntrl++) {
+ delete m_mc_profilers[mem_cntrl];
+ }
+
+ delete m_requestProfileMap_ptr;
+}
+
void Profiler::wakeup()
{
// FIXME - avoid the repeated code
@@ -170,17 +168,51 @@
integer_t transactions_started = m_perProcStartTransaction.sum();
integer_t transactions_ended = m_perProcEndTransaction.sum();
- (*m_periodic_output_file_ptr) << "ruby_cycles: " <<
g_eventQueue_ptr->getTime()-m_ruby_start << endl;
- (*m_periodic_output_file_ptr) << "total_misses: " << total_misses << " " <<
m_perProcTotalMisses << endl;
- (*m_periodic_output_file_ptr) << "simics_cycles_executed: " <<
simics_cycles_executed << " " << perProcCycleCount << endl;
- (*m_periodic_output_file_ptr) << "transactions_started: " <<
transactions_started << " " << m_perProcStartTransaction << endl;
- (*m_periodic_output_file_ptr) << "transactions_ended: " <<
transactions_ended << " " << m_perProcEndTransaction << endl;
- (*m_periodic_output_file_ptr) << "mbytes_resident: " <<
process_memory_resident() << endl;
- (*m_periodic_output_file_ptr) << "mbytes_total: " << process_memory_total()
<< endl;
+ (*m_periodic_output_file_ptr) << "ruby_cycles: "
+ << g_eventQueue_ptr->getTime()-m_ruby_start
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "total_misses: "
+ << total_misses
+ << " "
+ << m_perProcTotalMisses
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "simics_cycles_executed: "
+ << simics_cycles_executed
+ << " "
+ << perProcCycleCount
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "transactions_started: "
+ << transactions_started
+ << " "
+ << m_perProcStartTransaction
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "transactions_ended: "
+ << transactions_ended
+ << " "
+ << m_perProcEndTransaction
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "mbytes_resident: "
+ << process_memory_resident()
+ << endl;
+
+ (*m_periodic_output_file_ptr) << "mbytes_total: "
+ << process_memory_total()
+ << endl;
+
if (process_memory_total() > 0) {
- (*m_periodic_output_file_ptr) << "resident_ratio: " <<
process_memory_resident()/process_memory_total() << endl;
+ (*m_periodic_output_file_ptr) << "resident_ratio: "
+ << process_memory_resident()/process_memory_total()
+ << endl;
}
- (*m_periodic_output_file_ptr) << "miss_latency: " <<
m_allMissLatencyHistogram << endl;
+
+ (*m_periodic_output_file_ptr) << "miss_latency: "
+ << m_allMissLatencyHistogram
+ << endl;
*m_periodic_output_file_ptr << endl;
@@ -207,7 +239,9 @@
void Profiler::setPeriodicStatsInterval(integer_t period)
{
- cout << "Recording periodic statistics every " << m_stats_period << " Ruby
cycles" << endl;
+ cout << "Recording periodic statistics every " << m_stats_period
+ << " Ruby cycles" << endl;
+
m_stats_period = period;
g_eventQueue_ptr->scheduleEvent(this, 1);
}
@@ -271,7 +305,8 @@
out << "mbytes_resident: " << process_memory_resident() << endl;
out << "mbytes_total: " << process_memory_total() << endl;
if (process_memory_total() > 0) {
- out << "resident_ratio: " <<
process_memory_resident()/process_memory_total() << endl;
+ out << "resident_ratio: "
+ << process_memory_resident()/process_memory_total() << endl;
}
out << endl;
@@ -326,30 +361,30 @@
out << endl;
- vector<string>::iterator it;
-
- for ( it=m_memory_control_names.begin() ; it < m_memory_control_names.end();
it++ ){
- long long int m_memReq = m_memory_control_profilers[(*it).c_str()] ->
m_memReq;
- long long int m_memRefresh = m_memory_control_profilers[(*it).c_str()] ->
m_memRefresh;
- long long int m_memInputQ = m_memory_control_profilers[(*it).c_str()] ->
m_memInputQ;
- long long int m_memBankQ = m_memory_control_profilers[(*it).c_str()] ->
m_memBankQ;
- long long int m_memWaitCycles = m_memory_control_profilers[(*it).c_str()]
-> m_memWaitCycles;
- long long int m_memRead = m_memory_control_profilers[(*it).c_str()] ->
m_memRead;
- long long int m_memWrite = m_memory_control_profilers[(*it).c_str()] ->
m_memWrite;
- long long int m_memBankBusy = m_memory_control_profilers[(*it).c_str()] ->
m_memBankBusy;
- long long int m_memRandBusy = m_memory_control_profilers[(*it).c_str()] ->
m_memRandBusy;
- long long int m_memNotOld = m_memory_control_profilers[(*it).c_str()] ->
m_memNotOld;
- long long int m_memArbWait = m_memory_control_profilers[(*it).c_str()] ->
m_memArbWait;
- long long int m_memBusBusy = m_memory_control_profilers[(*it).c_str()] ->
m_memBusBusy;
- long long int m_memTfawBusy = m_memory_control_profilers[(*it).c_str()] ->
m_memTfawBusy;
- long long int m_memReadWriteBusy =
m_memory_control_profilers[(*it).c_str()] -> m_memReadWriteBusy;
- long long int m_memDataBusBusy = m_memory_control_profilers[(*it).c_str()]
-> m_memDataBusBusy;
- Vector<long long int> m_memBankCount =
m_memory_control_profilers[(*it).c_str()] -> m_memBankCount;
+ for (int mem_cntrl = 0;
+ mem_cntrl < m_mc_profilers.size();
+ mem_cntrl++) {
+ uint64 m_memReq = m_mc_profilers[mem_cntrl]->m_memReq;
+ uint64 m_memRefresh = m_mc_profilers[mem_cntrl]->m_memRefresh;
+ uint64 m_memInputQ = m_mc_profilers[mem_cntrl]->m_memInputQ;
+ uint64 m_memBankQ = m_mc_profilers[mem_cntrl]->m_memBankQ;
+ uint64 m_memWaitCycles = m_mc_profilers[mem_cntrl]->m_memWaitCycles;
+ uint64 m_memRead = m_mc_profilers[mem_cntrl]->m_memRead;
+ uint64 m_memWrite = m_mc_profilers[mem_cntrl]->m_memWrite;
+ uint64 m_memBankBusy = m_mc_profilers[mem_cntrl]->m_memBankBusy;
+ uint64 m_memRandBusy = m_mc_profilers[mem_cntrl]->m_memRandBusy;
+ uint64 m_memNotOld = m_mc_profilers[mem_cntrl]->m_memNotOld;
+ uint64 m_memArbWait = m_mc_profilers[mem_cntrl]->m_memArbWait;
+ uint64 m_memBusBusy = m_mc_profilers[mem_cntrl]->m_memBusBusy;
+ uint64 m_memTfawBusy = m_mc_profilers[mem_cntrl]->m_memTfawBusy;
+ uint64 m_memReadWriteBusy = m_mc_profilers[mem_cntrl]->m_memReadWriteBusy;
+ uint64 m_memDataBusBusy = m_mc_profilers[mem_cntrl]->m_memDataBusBusy;
+ Vector<uint64> m_memBankCount = m_mc_profilers[mem_cntrl]->m_memBankCount;
if (m_memReq || m_memRefresh) { // if there's a memory controller at all
- long long int total_stalls = m_memInputQ + m_memBankQ + m_memWaitCycles;
+ uint64 total_stalls = m_memInputQ + m_memBankQ + m_memWaitCycles;
double stallsPerReq = total_stalls * 1.0 / m_memReq;
- out << "Memory control " << (*it) << ":" << endl;
+ out << "Memory control " << mem_cntrl << ":" << endl;
out << " memory_total_requests: " << m_memReq << endl; // does not
include refreshes
out << " memory_reads: " << m_memRead << endl;
out << " memory_writes: " << m_memWrite << endl;
@@ -609,25 +644,29 @@
//added by SS
vector<string>::iterator it;
- for ( it=m_memory_control_names.begin() ; it < m_memory_control_names.end();
it++ ){
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev