Changes to add tracing and replaying command-line options

Trace is automatically ended upon a manual checkpoint
This commit is contained in:
Polina Dudnik 2009-07-13 12:50:10 -05:00
parent b28058917c
commit 9a675a0391
4 changed files with 35 additions and 5 deletions

View file

@ -9,6 +9,7 @@
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/system/MemoryVector.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/recorder/Tracer.hh"
string RubyRequestType_to_string(const RubyRequestType& obj)
{
@ -204,6 +205,20 @@ void libruby_print_stats(std::ostream & out)
{
RubySystem::printStats(out);
}
void libruby_playback_trace(char * trace_filename)
{
RubySystem::getTracer()->playbackTrace(trace_filename);
}
void libruby_start_tracing(char * record_filename) {
// start the trace
RubySystem::getTracer()->startTrace(record_filename);
}
void libruby_stop_tracing() {
// start the trace
RubySystem::getTracer()->stopTrace();
}
uint64_t libruby_get_time() {
return RubySystem::getCycleCount(0);

View file

@ -102,6 +102,20 @@ void libruby_print_config(std::ostream & out);
*/
void libruby_print_stats(std::ostream & out);
/**
* does not return until done
*/
void libruby_playback_trace(char * trace_filename);
/*
* enables the tracer and opens the trace file
*/
void libruby_start_tracing(char * record_filename);
/*
* closes the trace file
*/
void libruby_stop_tracing();
/**
* get time

View file

@ -92,10 +92,11 @@ void Tracer::startTrace(string filename)
void Tracer::stopTrace()
{
assert(m_enabled == true);
m_trace_file.close();
cout << "Request trace file closed." << endl;
m_enabled = false;
if (m_enabled == true) {
m_trace_file.close();
cout << "Request trace file closed." << endl;
m_enabled = false;
}
}
void Tracer::traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time)

View file

@ -106,7 +106,7 @@ public:
static int getNumberOfSequencers() { return m_sequencers.size(); }
Profiler* getProfiler() {assert(m_profiler_ptr != NULL); return m_profiler_ptr; }
Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; }
static Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; }
static MemoryVector* getMemoryVector() { assert(m_mem_vec_ptr != NULL); return m_mem_vec_ptr;}
void recordCacheContents(CacheRecorder& tr) const;