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 | 1907e39fd2c30ead9589f0bb6995972cbd0e153f (patch) | |
tree | 2e5c96fcd6dfc18af9b5a7e717590292f810ff52 /src/mem/ruby | |
parent | 020716cab3dca04d3f6b24b6dce67d5f5cbc4e5e (diff) | |
download | gem5-1907e39fd2c30ead9589f0bb6995972cbd0e153f.tar.xz |
ruby: added ruby stats print
Moved the previous rubymem stats print feature to ruby System so that ruby
stats are printed on simulation exit.
Diffstat (limited to 'src/mem/ruby')
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.cc | 2 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/Topology.cc | 14 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/Topology.hh | 4 | ||||
-rw-r--r-- | src/mem/ruby/system/RubySystem.py | 3 | ||||
-rw-r--r-- | src/mem/ruby/system/System.cc | 20 | ||||
-rw-r--r-- | src/mem/ruby/system/System.hh | 22 |
6 files changed, 61 insertions, 4 deletions
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index ecd38de1a..2de8d07e5 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -225,6 +225,7 @@ void SimpleNetwork::printStats(ostream& out) const for(int i=0; i<m_switch_ptr_vector.size(); i++) { m_switch_ptr_vector[i]->printStats(out); } + m_topology_ptr->printStats(out); } void SimpleNetwork::clearStats() @@ -232,6 +233,7 @@ void SimpleNetwork::clearStats() for(int i=0; i<m_switch_ptr_vector.size(); i++) { m_switch_ptr_vector[i]->clearStats(); } + m_topology_ptr->clearStats(); } void SimpleNetwork::printConfig(ostream& out) const diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc index 15c94d97d..e7fbe1ce3 100644 --- a/src/mem/ruby/network/simple/Topology.cc +++ b/src/mem/ruby/network/simple/Topology.cc @@ -238,6 +238,20 @@ void Topology::makeLink(Network *net, SwitchID src, SwitchID dest, const NetDest } } +void Topology::printStats(ostream& out) const +{ + for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { + m_controller_vector[cntrl]->printStats(out); + } +} + +void Topology::clearStats() +{ + for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { + m_controller_vector[cntrl]->clearStats(); + } +} + void Topology::printConfig(ostream& out) const { if (m_print_config == false) return; diff --git a/src/mem/ruby/network/simple/Topology.hh b/src/mem/ruby/network/simple/Topology.hh index fb010090f..c274ed330 100644 --- a/src/mem/ruby/network/simple/Topology.hh +++ b/src/mem/ruby/network/simple/Topology.hh @@ -102,8 +102,8 @@ public: void initNetworkPtr(Network* net_ptr); const string getName() { return m_name; } - void printStats(ostream& out) const {} - void clearStats() {} + void printStats(ostream& out) const; + void clearStats(); void printConfig(ostream& out) const; void print(ostream& out) const { out << "[Topology]"; } diff --git a/src/mem/ruby/system/RubySystem.py b/src/mem/ruby/system/RubySystem.py index 668a19544..d53271e45 100644 --- a/src/mem/ruby/system/RubySystem.py +++ b/src/mem/ruby/system/RubySystem.py @@ -14,4 +14,5 @@ class RubySystem(SimObject): debug = Param.RubyDebug("the default debug object") profiler = Param.RubyProfiler(""); tracer = Param.RubyTracer(""); - + stats_filename = Param.String("ruby.stats", + "file to which ruby dumps its stats") diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 4dcca2f83..3159a2888 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -56,6 +56,7 @@ //#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh" //#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh" #include "mem/ruby/system/MemoryControl.hh" +#include "base/output.hh" int RubySystem::m_random_seed; bool RubySystem::m_randomization; @@ -109,6 +110,12 @@ RubySystem::RubySystem(const Params *p) g_system_ptr = this; m_mem_vec_ptr = new MemoryVector; m_mem_vec_ptr->setSize(m_memory_size_bytes); + + // + // Print ruby configuration and stats at exit + // + RubyExitCallback* rubyExitCB = new RubyExitCallback(p->stats_filename); + registerExitCallback(rubyExitCB); } @@ -263,9 +270,20 @@ void RubySystem::checkGlobalCoherenceInvariant(const Address& addr ) { } #endif - RubySystem * RubySystemParams::create() { return new RubySystem(this); } + +/** + * virtual process function that is invoked when the callback + * queue is executed. + */ +void RubyExitCallback::process() +{ + std::ostream *os = simout.create(stats_filename); + RubySystem::printConfig(*os); + *os << endl; + RubySystem::printStats(*os); +} diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh index 1aebad748..bc5cd3f3d 100644 --- a/src/mem/ruby/system/System.hh +++ b/src/mem/ruby/system/System.hh @@ -48,6 +48,7 @@ #include <map> #include "sim/sim_object.hh" #include "params/RubySystem.hh" +#include "base/callback.hh" class Profiler; class Network; @@ -201,6 +202,27 @@ ostream& operator<<(ostream& out, const RubySystem& obj) return out; } +class RubyExitCallback : public Callback +{ + private: + string stats_filename; + + public: + /** + * virtualize the destructor to make sure that the correct one + * gets called. + */ + + virtual ~RubyExitCallback() {} + + RubyExitCallback(const string& _stats_filename) + { + stats_filename = _stats_filename; + } + + virtual void process(); +}; + #endif //SYSTEM_H |