#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"
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;
RubySystem::init()
{
m_profiler_ptr->clearStats();
+ m_network_ptr->clearStats();
}
void
// 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) {
}
void
-RubySystem::clearStats() const
+RubySystem::resetStats()
{
m_profiler_ptr->clearStats();
m_network_ptr->clearStats();
* queue is executed.
*/
void
-RubyExitCallback::process()
+RubyDumpStatsCallback::process()
{
- std::ostream *os = simout.create(stats_filename);
ruby_system->printStats(*os);
}
#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"
}
void printStats(std::ostream& out);
- void clearStats() const;
+ void resetStats();
uint64 getInstructionCount(int thread) { return 1; }
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;
}