# HG changeset patch
# User Brad Beckmann <[email protected]>
# Date 1260657437 28800
# Node ID a47f0bcef634e82f98f1f35f3aef3d08f8420d22
# Parent 2d19b51213922c91d5ca388835c8753750b73cbc
ruby: added ruby stats print
Moved the previous rubymem stats print feature to ruby System so that ruby
stats are printed on simulation exit.
diff -r 2d19b5121392 -r a47f0bcef634
src/mem/ruby/network/simple/SimpleNetwork.cc
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc Sat Dec 12 14:37:17
2009 -0800
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc Sat Dec 12 14:37:17
2009 -0800
@@ -252,6 +252,7 @@
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()
@@ -259,6 +260,7 @@
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 -r 2d19b5121392 -r a47f0bcef634 src/mem/ruby/network/simple/Topology.cc
--- a/src/mem/ruby/network/simple/Topology.cc Sat Dec 12 14:37:17 2009 -0800
+++ b/src/mem/ruby/network/simple/Topology.cc Sat Dec 12 14:37:17 2009 -0800
@@ -450,6 +450,20 @@
}
}
+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 -r 2d19b5121392 -r a47f0bcef634 src/mem/ruby/network/simple/Topology.hh
--- a/src/mem/ruby/network/simple/Topology.hh Sat Dec 12 14:37:17 2009 -0800
+++ b/src/mem/ruby/network/simple/Topology.hh Sat Dec 12 14:37:17 2009 -0800
@@ -105,8 +105,8 @@
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 -r 2d19b5121392 -r a47f0bcef634 src/mem/ruby/system/RubySystem.py
--- a/src/mem/ruby/system/RubySystem.py Sat Dec 12 14:37:17 2009 -0800
+++ b/src/mem/ruby/system/RubySystem.py Sat Dec 12 14:37:17 2009 -0800
@@ -13,4 +13,5 @@
debug = Param.RubyDebug("")
profiler = Param.RubyProfiler("");
tracer = Param.RubyTracer("");
-
+ stats_filename = Param.String("ruby.stats",
+ "file to which ruby dumps its stats")
diff -r 2d19b5121392 -r a47f0bcef634 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc Sat Dec 12 14:37:17 2009 -0800
+++ b/src/mem/ruby/system/System.cc Sat Dec 12 14:37:17 2009 -0800
@@ -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;
@@ -111,6 +112,12 @@
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);
}
@@ -262,9 +269,20 @@
}
#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 -r 2d19b5121392 -r a47f0bcef634 src/mem/ruby/system/System.hh
--- a/src/mem/ruby/system/System.hh Sat Dec 12 14:37:17 2009 -0800
+++ b/src/mem/ruby/system/System.hh Sat Dec 12 14:37:17 2009 -0800
@@ -48,6 +48,7 @@
#include <map>
#include "sim/sim_object.hh"
#include "params/RubySystem.hh"
+#include "base/callback.hh"
class Profiler;
class Network;
@@ -203,6 +204,27 @@
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
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev