summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system/System.cc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2014-01-10 16:19:47 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2014-01-10 16:19:47 -0600
commit407f37e15f19a2da350a94272ac7739891e935f4 (patch)
treedb413665cc1d2fc411b960339e1653cce0e182e8 /src/mem/ruby/system/System.cc
parentcfe912a5127b51273d7e3e78c15095ac832f20bd (diff)
downloadgem5-407f37e15f19a2da350a94272ac7739891e935f4.tar.xz
ruby: move all statistics to stats.txt, eliminate ruby.stats
Diffstat (limited to 'src/mem/ruby/system/System.cc')
-rw-r--r--src/mem/ruby/system/System.cc63
1 files changed, 18 insertions, 45 deletions
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index 016169bcc..b2f439178 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -37,7 +37,6 @@
#include "debug/RubySystem.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/network/Network.hh"
-#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/system/System.hh"
#include "sim/eventq.hh"
#include "sim/simulate.hh"
@@ -73,16 +72,12 @@ RubySystem::RubySystem(const Params *p)
}
if (p->no_mem_vec) {
- m_mem_vec_ptr = NULL;
+ m_mem_vec = NULL;
} else {
- m_mem_vec_ptr = new MemoryVector;
- m_mem_vec_ptr->resize(m_memory_size_bytes);
+ m_mem_vec = new MemoryVector;
+ m_mem_vec->resize(m_memory_size_bytes);
}
- // Print ruby configuration and stats at exit and when asked for
- Stats::registerDumpCallback(new RubyDumpStatsCallback(p->stats_filename,
- this));
-
m_warmup_enabled = false;
m_cooldown_enabled = false;
@@ -91,18 +86,17 @@ RubySystem::RubySystem(const Params *p)
// Resize to the size of different machine types
g_abs_controls.resize(MachineType_NUM);
-}
-void
-RubySystem::registerNetwork(Network* network_ptr)
-{
- m_network_ptr = network_ptr;
+ // Collate the statistics before they are printed.
+ Stats::registerDumpCallback(new RubyStatsCallback(this));
+ // Create the profiler
+ m_profiler = new Profiler(p);
}
void
-RubySystem::registerProfiler(Profiler* profiler_ptr)
+RubySystem::registerNetwork(Network* network_ptr)
{
- m_profiler_ptr = profiler_ptr;
+ m_network = network_ptr;
}
void
@@ -127,16 +121,10 @@ RubySystem::registerMemController(MemoryControl *mc) {
RubySystem::~RubySystem()
{
- delete m_network_ptr;
- delete m_profiler_ptr;
- if (m_mem_vec_ptr)
- delete m_mem_vec_ptr;
-}
-
-void
-RubySystem::printStats(ostream& out)
-{
- m_profiler_ptr->printStats(out);
+ delete m_network;
+ delete m_profiler;
+ if (m_mem_vec)
+ delete m_mem_vec;
}
void
@@ -223,8 +211,8 @@ RubySystem::serialize(std::ostream &os)
uint8_t *raw_data = NULL;
- if (m_mem_vec_ptr != NULL) {
- uint64 memory_trace_size = m_mem_vec_ptr->collatePages(raw_data);
+ if (m_mem_vec != NULL) {
+ uint64 memory_trace_size = m_mem_vec->collatePages(raw_data);
string memory_trace_file = name() + ".memory.gz";
writeCompressedTrace(raw_data, memory_trace_file,
@@ -289,7 +277,7 @@ RubySystem::unserialize(Checkpoint *cp, const string &section)
{
uint8_t *uncompressed_trace = NULL;
- if (m_mem_vec_ptr != NULL) {
+ if (m_mem_vec != NULL) {
string memory_trace_file;
uint64 memory_trace_size = 0;
@@ -299,7 +287,7 @@ RubySystem::unserialize(Checkpoint *cp, const string &section)
readCompressedTrace(memory_trace_file, uncompressed_trace,
memory_trace_size);
- m_mem_vec_ptr->populatePages(uncompressed_trace);
+ m_mem_vec->populatePages(uncompressed_trace);
delete [] uncompressed_trace;
uncompressed_trace = NULL;
@@ -401,11 +389,6 @@ RubySystem::RubyEvent::process()
void
RubySystem::resetStats()
{
- m_profiler_ptr->clearStats();
- for (uint32_t cntrl = 0; cntrl < m_abs_cntrl_vec.size(); cntrl++) {
- m_abs_cntrl_vec[cntrl]->clearStats();
- }
-
g_ruby_start = curCycle();
}
@@ -552,7 +535,7 @@ RubySystem::functionalWrite(PacketPtr pkt)
m_memory_controller_vec[i]->functionalWriteBuffers(pkt);
}
- num_functional_writes += m_network_ptr->functionalWrite(pkt);
+ num_functional_writes += m_network->functionalWrite(pkt);
DPRINTF(RubySystem, "Messages written = %u\n", num_functional_writes);
return true;
@@ -615,13 +598,3 @@ RubySystemParams::create()
{
return new RubySystem(this);
}
-
-/**
- * virtual process function that is invoked when the callback
- * queue is executed.
- */
-void
-RubyDumpStatsCallback::process()
-{
- ruby_system->printStats(*os);
-}