ruby: reset and dump stats along with reset of the system
This patch adds support to ruby so that the statistics maintained by ruby are reset/dumped when the statistics for the rest of the system are reset/dumped. For resetting the statistics, ruby now provides the resetStats() function that a sim object can provide. As a consequence, the clearStats() function has been removed from RubySystem. For dumping stats, Ruby now adds a callback event to the dumpStatsQueue. The exit callback that ruby used to add earlier is being removed. Created by: Hamid Reza Khaleghzadeh. Improved by: Lluc Alvarez, Nilay Vaish Committed by: Nilay Vaish
This commit is contained in:
parent
ce5766c409
commit
8cd475d58e
3 changed files with 17 additions and 13 deletions
|
@ -438,6 +438,7 @@ void
|
|||
Profiler::clearStats()
|
||||
{
|
||||
m_ruby_start = g_system_ptr->getTime();
|
||||
m_real_time_start_time = time(NULL);
|
||||
|
||||
m_cycles_executed_at_start.resize(m_num_of_sequencers);
|
||||
for (int i = 0; i < m_num_of_sequencers; i++) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <cstdio>
|
||||
|
||||
#include "base/intmath.hh"
|
||||
#include "base/output.hh"
|
||||
#include "base/statistics.hh"
|
||||
#include "debug/RubyCacheTrace.hh"
|
||||
#include "debug/RubySystem.hh"
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
|
@ -80,8 +80,9 @@ RubySystem::RubySystem(const Params *p)
|
|||
m_mem_vec_ptr->resize(m_memory_size_bytes);
|
||||
}
|
||||
|
||||
// Print ruby configuration and stats at exit
|
||||
registerExitCallback(new RubyExitCallback(p->stats_filename, this));
|
||||
// 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,6 +92,7 @@ void
|
|||
RubySystem::init()
|
||||
{
|
||||
m_profiler_ptr->clearStats();
|
||||
m_network_ptr->clearStats();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -297,7 +299,7 @@ RubySystem::unserialize(Checkpoint *cp, const string §ion)
|
|||
// that the profiler can correctly set its start time to the unserialized
|
||||
// value of curTick()
|
||||
//
|
||||
clearStats();
|
||||
resetStats();
|
||||
uint8_t *uncompressed_trace = NULL;
|
||||
|
||||
if (m_mem_vec_ptr != NULL) {
|
||||
|
@ -391,7 +393,7 @@ RubySystem::RubyEvent::process()
|
|||
}
|
||||
|
||||
void
|
||||
RubySystem::clearStats() const
|
||||
RubySystem::resetStats()
|
||||
{
|
||||
m_profiler_ptr->clearStats();
|
||||
m_network_ptr->clearStats();
|
||||
|
@ -625,8 +627,7 @@ RubySystemParams::create()
|
|||
* queue is executed.
|
||||
*/
|
||||
void
|
||||
RubyExitCallback::process()
|
||||
RubyDumpStatsCallback::process()
|
||||
{
|
||||
std::ostream *os = simout.create(stats_filename);
|
||||
ruby_system->printStats(*os);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define __MEM_RUBY_SYSTEM_SYSTEM_HH__
|
||||
|
||||
#include "base/callback.hh"
|
||||
#include "base/output.hh"
|
||||
#include "mem/packet.hh"
|
||||
#include "mem/ruby/common/Global.hh"
|
||||
#include "mem/ruby/recorder/CacheRecorder.hh"
|
||||
|
@ -103,7 +104,7 @@ class RubySystem : public ClockedObject
|
|||
}
|
||||
|
||||
void printStats(std::ostream& out);
|
||||
void clearStats() const;
|
||||
void resetStats();
|
||||
|
||||
uint64 getInstructionCount(int thread) { return 1; }
|
||||
|
||||
|
@ -172,18 +173,19 @@ operator<<(std::ostream& out, const RubySystem& obj)
|
|||
return out;
|
||||
}
|
||||
|
||||
class RubyExitCallback : public Callback
|
||||
class RubyDumpStatsCallback : public Callback
|
||||
{
|
||||
private:
|
||||
std::string stats_filename;
|
||||
std::ostream *os;
|
||||
RubySystem *ruby_system;
|
||||
|
||||
public:
|
||||
virtual ~RubyExitCallback() {}
|
||||
virtual ~RubyDumpStatsCallback() {}
|
||||
|
||||
RubyExitCallback(const std::string& _stats_filename, RubySystem *system)
|
||||
RubyDumpStatsCallback(const std::string& _stats_filename,
|
||||
RubySystem *system)
|
||||
{
|
||||
stats_filename = _stats_filename;
|
||||
os = simout.create(_stats_filename);
|
||||
ruby_system = system;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue