ruby: added ruby stats print
Moved the previous rubymem stats print feature to ruby System so that ruby stats are printed on simulation exit.
This commit is contained in:
parent
020716cab3
commit
1907e39fd2
|
@ -225,6 +225,7 @@ void SimpleNetwork::printStats(ostream& out) const
|
||||||
for(int i=0; i<m_switch_ptr_vector.size(); i++) {
|
for(int i=0; i<m_switch_ptr_vector.size(); i++) {
|
||||||
m_switch_ptr_vector[i]->printStats(out);
|
m_switch_ptr_vector[i]->printStats(out);
|
||||||
}
|
}
|
||||||
|
m_topology_ptr->printStats(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleNetwork::clearStats()
|
void SimpleNetwork::clearStats()
|
||||||
|
@ -232,6 +233,7 @@ void SimpleNetwork::clearStats()
|
||||||
for(int i=0; i<m_switch_ptr_vector.size(); i++) {
|
for(int i=0; i<m_switch_ptr_vector.size(); i++) {
|
||||||
m_switch_ptr_vector[i]->clearStats();
|
m_switch_ptr_vector[i]->clearStats();
|
||||||
}
|
}
|
||||||
|
m_topology_ptr->clearStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleNetwork::printConfig(ostream& out) const
|
void SimpleNetwork::printConfig(ostream& out) const
|
||||||
|
|
|
@ -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
|
void Topology::printConfig(ostream& out) const
|
||||||
{
|
{
|
||||||
if (m_print_config == false) return;
|
if (m_print_config == false) return;
|
||||||
|
|
|
@ -102,8 +102,8 @@ public:
|
||||||
void initNetworkPtr(Network* net_ptr);
|
void initNetworkPtr(Network* net_ptr);
|
||||||
|
|
||||||
const string getName() { return m_name; }
|
const string getName() { return m_name; }
|
||||||
void printStats(ostream& out) const {}
|
void printStats(ostream& out) const;
|
||||||
void clearStats() {}
|
void clearStats();
|
||||||
void printConfig(ostream& out) const;
|
void printConfig(ostream& out) const;
|
||||||
void print(ostream& out) const { out << "[Topology]"; }
|
void print(ostream& out) const { out << "[Topology]"; }
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,5 @@ class RubySystem(SimObject):
|
||||||
debug = Param.RubyDebug("the default debug object")
|
debug = Param.RubyDebug("the default debug object")
|
||||||
profiler = Param.RubyProfiler("");
|
profiler = Param.RubyProfiler("");
|
||||||
tracer = Param.RubyTracer("");
|
tracer = Param.RubyTracer("");
|
||||||
|
stats_filename = Param.String("ruby.stats",
|
||||||
|
"file to which ruby dumps its stats")
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
//#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
|
//#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
|
||||||
//#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
|
//#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
|
||||||
#include "mem/ruby/system/MemoryControl.hh"
|
#include "mem/ruby/system/MemoryControl.hh"
|
||||||
|
#include "base/output.hh"
|
||||||
|
|
||||||
int RubySystem::m_random_seed;
|
int RubySystem::m_random_seed;
|
||||||
bool RubySystem::m_randomization;
|
bool RubySystem::m_randomization;
|
||||||
|
@ -109,6 +110,12 @@ RubySystem::RubySystem(const Params *p)
|
||||||
g_system_ptr = this;
|
g_system_ptr = this;
|
||||||
m_mem_vec_ptr = new MemoryVector;
|
m_mem_vec_ptr = new MemoryVector;
|
||||||
m_mem_vec_ptr->setSize(m_memory_size_bytes);
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
RubySystem *
|
RubySystem *
|
||||||
RubySystemParams::create()
|
RubySystemParams::create()
|
||||||
{
|
{
|
||||||
return new RubySystem(this);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "sim/sim_object.hh"
|
#include "sim/sim_object.hh"
|
||||||
#include "params/RubySystem.hh"
|
#include "params/RubySystem.hh"
|
||||||
|
#include "base/callback.hh"
|
||||||
|
|
||||||
class Profiler;
|
class Profiler;
|
||||||
class Network;
|
class Network;
|
||||||
|
@ -201,6 +202,27 @@ ostream& operator<<(ostream& out, const RubySystem& obj)
|
||||||
return out;
|
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
|
#endif //SYSTEM_H
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue