diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:20 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:20 -0800 |
commit | 0f6535dba1e94d97118023adb6df811af58b752f (patch) | |
tree | 5fffc96bff9bcb55c1aa71b6e27b3c9ebf6c8329 | |
parent | 2c9ca672dfe4a204ebe21c73b344d2939c0e0eff (diff) | |
download | gem5-0f6535dba1e94d97118023adb6df811af58b752f.tar.xz |
ruby: Convered ruby tracing support usage of sequencer
Modified ruby's tracing support to no longer rely on the RubySystem map
to convert a sequencer string name to a sequencer pointer. As a
temporary solution, the code uses the sim_object find function.
Eventually, we should develop a better fix.
-rw-r--r-- | src/mem/ruby/recorder/CacheRecorder.cc | 8 | ||||
-rw-r--r-- | src/mem/ruby/recorder/CacheRecorder.hh | 7 | ||||
-rw-r--r-- | src/mem/ruby/recorder/TraceRecord.cc | 46 | ||||
-rw-r--r-- | src/mem/ruby/recorder/TraceRecord.hh | 15 | ||||
-rw-r--r-- | src/mem/ruby/recorder/Tracer.cc | 8 | ||||
-rw-r--r-- | src/mem/ruby/recorder/Tracer.hh | 7 | ||||
-rw-r--r-- | src/mem/ruby/system/Sequencer.cc | 2 |
7 files changed, 69 insertions, 24 deletions
diff --git a/src/mem/ruby/recorder/CacheRecorder.cc b/src/mem/ruby/recorder/CacheRecorder.cc index 672c175e3..09c4e0597 100644 --- a/src/mem/ruby/recorder/CacheRecorder.cc +++ b/src/mem/ruby/recorder/CacheRecorder.cc @@ -48,9 +48,13 @@ CacheRecorder::~CacheRecorder() delete m_records_ptr; } -void CacheRecorder::addRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time) +void CacheRecorder::addRecord(Sequencer* sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time) { - m_records_ptr->insert(TraceRecord(sequencer_name, data_addr, pc_addr, type, time)); + m_records_ptr->insert(TraceRecord(sequencer, data_addr, pc_addr, type, time)); } int CacheRecorder::dumpRecords(string filename) diff --git a/src/mem/ruby/recorder/CacheRecorder.hh b/src/mem/ruby/recorder/CacheRecorder.hh index 144e841b3..88cc5eaca 100644 --- a/src/mem/ruby/recorder/CacheRecorder.hh +++ b/src/mem/ruby/recorder/CacheRecorder.hh @@ -47,6 +47,7 @@ template <class TYPE> class PrioHeap; class Address; class TraceRecord; +class Sequencer; class CacheRecorder { public: @@ -57,7 +58,11 @@ public: ~CacheRecorder(); // Public Methods - void addRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time); + void addRecord(Sequencer* sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time); int dumpRecords(string filename); void print(ostream& out) const; diff --git a/src/mem/ruby/recorder/TraceRecord.cc b/src/mem/ruby/recorder/TraceRecord.cc index 8f426d690..e700687d6 100644 --- a/src/mem/ruby/recorder/TraceRecord.cc +++ b/src/mem/ruby/recorder/TraceRecord.cc @@ -36,10 +36,15 @@ #include "mem/ruby/system/Sequencer.hh" #include "mem/ruby/system/System.hh" #include "mem/protocol/CacheMsg.hh" +#include "sim/sim_object.hh" -TraceRecord::TraceRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time) +TraceRecord::TraceRecord(Sequencer* _sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time) { - m_sequencer_name = sequencer_name; + m_sequencer_ptr = _sequencer; m_data_address = data_addr; m_pc_address = pc_addr; m_time = time; @@ -63,7 +68,7 @@ TraceRecord::TraceRecord(const TraceRecord& obj) TraceRecord& TraceRecord::operator=(const TraceRecord& obj) { - m_sequencer_name = obj.m_sequencer_name; + m_sequencer_ptr = obj.m_sequencer_ptr; m_time = obj.m_time; m_data_address = obj.m_data_address; m_pc_address = obj.m_pc_address; @@ -73,34 +78,38 @@ TraceRecord& TraceRecord::operator=(const TraceRecord& obj) void TraceRecord::issueRequest() const { - // Lookup sequencer pointer from system - // Note that the chip index also needs to take into account SMT configurations - Sequencer* sequencer_ptr = RubySystem::getSequencer(m_sequencer_name); - assert(sequencer_ptr != NULL); + assert(m_sequencer_ptr != NULL); - RubyRequest request(m_data_address.getAddress(), NULL, RubySystem::getBlockSizeBytes(), m_pc_address.getAddress(), m_type, RubyAccessMode_User); + RubyRequest request(m_data_address.getAddress(), + NULL, + RubySystem::getBlockSizeBytes(), + m_pc_address.getAddress(), + m_type, + RubyAccessMode_User); // Clear out the sequencer - while (!sequencer_ptr->empty()) { + while (!m_sequencer_ptr->empty()) { g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100); } - sequencer_ptr->makeRequest(request); + m_sequencer_ptr->makeRequest(request); // Clear out the sequencer - while (!sequencer_ptr->empty()) { + while (!m_sequencer_ptr->empty()) { g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100); } } void TraceRecord::print(ostream& out) const { - out << "[TraceRecord: Node, " << m_sequencer_name << ", " << m_data_address << ", " << m_pc_address << ", " << m_type << ", Time: " << m_time << "]"; + out << "[TraceRecord: Node, " << m_sequencer_ptr->name() << ", " + << m_data_address << ", " << m_pc_address << ", " + << m_type << ", Time: " << m_time << "]"; } void TraceRecord::output(ostream& out) const { - out << m_sequencer_name << " "; + out << m_sequencer_ptr->name() << " "; m_data_address.output(out); out << " "; m_pc_address.output(out); @@ -111,7 +120,16 @@ void TraceRecord::output(ostream& out) const bool TraceRecord::input(istream& in) { - in >> m_sequencer_name; + string sequencer_name; + in >> sequencer_name; + + // + // The SimObject find function is slow and iterates through the + // simObjectList to find the sequencer pointer. Therefore, expect trace + // playback to be slow. + // + m_sequencer_ptr = (Sequencer*)SimObject::find(sequencer_name.c_str()); + m_data_address.input(in); m_pc_address.input(in); string type; diff --git a/src/mem/ruby/recorder/TraceRecord.hh b/src/mem/ruby/recorder/TraceRecord.hh index 081d392e5..beb66d9b3 100644 --- a/src/mem/ruby/recorder/TraceRecord.hh +++ b/src/mem/ruby/recorder/TraceRecord.hh @@ -49,8 +49,17 @@ class CacheMsg; class TraceRecord { public: // Constructors - TraceRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time); - TraceRecord() { m_sequencer_name = ""; m_time = 0; m_type = RubyRequestType_NULL; } + TraceRecord(Sequencer* _sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time); + + TraceRecord() { + m_sequencer_ptr = NULL; + m_time = 0; + m_type = RubyRequestType_NULL; + } // Destructor // ~TraceRecord(); @@ -70,7 +79,7 @@ private: // Private Methods // Data Members (m_ prefix) - string m_sequencer_name; + Sequencer* m_sequencer_ptr; Time m_time; Address m_data_address; Address m_pc_address; diff --git a/src/mem/ruby/recorder/Tracer.cc b/src/mem/ruby/recorder/Tracer.cc index 55b5efe39..b58fa1eb6 100644 --- a/src/mem/ruby/recorder/Tracer.cc +++ b/src/mem/ruby/recorder/Tracer.cc @@ -89,10 +89,14 @@ void Tracer::stopTrace() } } -void Tracer::traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time) +void Tracer::traceRequest(Sequencer* sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time) { assert(m_enabled == true); - TraceRecord tr(sequencer_name, data_addr, pc_addr, type, time); + TraceRecord tr(sequencer, data_addr, pc_addr, type, time); tr.output(m_trace_file); } diff --git a/src/mem/ruby/recorder/Tracer.hh b/src/mem/ruby/recorder/Tracer.hh index b806b7081..16432f5fc 100644 --- a/src/mem/ruby/recorder/Tracer.hh +++ b/src/mem/ruby/recorder/Tracer.hh @@ -52,6 +52,7 @@ template <class TYPE> class PrioHeap; class Address; class TraceRecord; +class Sequencer; class Tracer : public SimObject { public: @@ -67,7 +68,11 @@ public: void startTrace(string filename); void stopTrace(); bool traceEnabled() { return m_enabled; } - void traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time); + void traceRequest(Sequencer* sequencer, + const Address& data_addr, + const Address& pc_addr, + RubyRequestType type, + Time time); void print(ostream& out) const; diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index a5a6e3260..23a6b44e2 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -467,7 +467,7 @@ void Sequencer::issueRequest(const RubyRequest& request) { } if (g_system_ptr->getTracer()->traceEnabled()) { - g_system_ptr->getTracer()->traceRequest(m_name, line_addr, Address(request.pc), + g_system_ptr->getTracer()->traceRequest(this, line_addr, Address(request.pc), request.type, g_eventQueue_ptr->getTime()); } |