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/system | |
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/system')
-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 |
3 files changed, 43 insertions, 2 deletions
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 |