summaryrefslogtreecommitdiff
path: root/src/mem/ruby/recorder
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-31 16:56:45 -0700
committerNathan Binkert <nate@binkert.org>2010-03-31 16:56:45 -0700
commitbe10204729c107b41d5d7487323c732e9fa09df5 (patch)
tree5c8f4001c490c4d777e8756e536cd2f2340c9ebb /src/mem/ruby/recorder
parent60ae1d2b10002bb73b420fce91c4b74397c55457 (diff)
downloadgem5-be10204729c107b41d5d7487323c732e9fa09df5.tar.xz
style: another ruby style pass
Diffstat (limited to 'src/mem/ruby/recorder')
-rw-r--r--src/mem/ruby/recorder/CacheRecorder.cc56
-rw-r--r--src/mem/ruby/recorder/CacheRecorder.hh66
-rw-r--r--src/mem/ruby/recorder/TraceRecord.cc164
-rw-r--r--src/mem/ruby/recorder/TraceRecord.hh118
-rw-r--r--src/mem/ruby/recorder/Tracer.cc165
-rw-r--r--src/mem/ruby/recorder/Tracer.hh90
6 files changed, 280 insertions, 379 deletions
diff --git a/src/mem/ruby/recorder/CacheRecorder.cc b/src/mem/ruby/recorder/CacheRecorder.cc
index 09c4e0597..495a38fc8 100644
--- a/src/mem/ruby/recorder/CacheRecorder.cc
+++ b/src/mem/ruby/recorder/CacheRecorder.cc
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,53 +26,50 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- *
- */
+#include "gzstream.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/recorder/CacheRecorder.hh"
#include "mem/ruby/recorder/TraceRecord.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "gzstream.hh"
CacheRecorder::CacheRecorder()
{
- m_records_ptr = new PrioHeap<TraceRecord>;
+ m_records_ptr = new PrioHeap<TraceRecord>;
}
CacheRecorder::~CacheRecorder()
{
- delete m_records_ptr;
+ delete m_records_ptr;
}
-void CacheRecorder::addRecord(Sequencer* sequencer,
- 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, data_addr, pc_addr, type, time));
+ m_records_ptr->
+ insert(TraceRecord(sequencer, data_addr, pc_addr, type, time));
}
-int CacheRecorder::dumpRecords(string filename)
+int
+CacheRecorder::dumpRecords(string filename)
{
- ogzstream out(filename.c_str());
- if (out.fail()) {
- cout << "Error: error opening file '" << filename << "'" << endl;
- return 0;
- }
+ ogzstream out(filename.c_str());
+ if (out.fail()) {
+ cout << "Error: error opening file '" << filename << "'" << endl;
+ return 0;
+ }
- int counter = 0;
- while (m_records_ptr->size() != 0) {
- TraceRecord record = m_records_ptr->extractMin();
- record.output(out);
- counter++;
- }
- return counter;
+ int counter = 0;
+ while (m_records_ptr->size() != 0) {
+ TraceRecord record = m_records_ptr->extractMin();
+ record.output(out);
+ counter++;
+ }
+ return counter;
}
-void CacheRecorder::print(ostream& out) const
+void
+CacheRecorder::print(ostream& out) const
{
}
diff --git a/src/mem/ruby/recorder/CacheRecorder.hh b/src/mem/ruby/recorder/CacheRecorder.hh
index 2616f73ae..18c246c9f 100644
--- a/src/mem/ruby/recorder/CacheRecorder.hh
+++ b/src/mem/ruby/recorder/CacheRecorder.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -28,15 +27,12 @@
*/
/*
- * $Id$
- *
- * Description: Recording cache requests made to a ruby cache at certain
- * ruby time. Also dump the requests to a gziped file.
- *
+ * Recording cache requests made to a ruby cache at certain ruby
+ * time. Also dump the requests to a gziped file.
*/
-#ifndef CACHERECORDER_H
-#define CACHERECORDER_H
+#ifndef __MEM_RUBY_RECORDER_CACHERECORDER_HH__
+#define __MEM_RUBY_RECORDER_CACHERECORDER_HH__
#include <iostream>
#include <string>
@@ -51,46 +47,32 @@ class Address;
class TraceRecord;
class Sequencer;
-class CacheRecorder {
-public:
- // Constructors
- CacheRecorder();
-
- // Destructor
- ~CacheRecorder();
+class CacheRecorder
+{
+ public:
+ CacheRecorder();
+ ~CacheRecorder();
- // Public Methods
- void addRecord(Sequencer* sequencer,
- const Address& data_addr,
- const Address& pc_addr,
- RubyRequestType type,
- Time time);
- int dumpRecords(std::string filename);
+ void addRecord(Sequencer* sequencer, const Address& data_addr,
+ const Address& pc_addr, RubyRequestType type, Time time);
+ int dumpRecords(std::string filename);
- void print(std::ostream& out) const;
-private:
- // Private Methods
+ void print(std::ostream& out) const;
- // Private copy constructor and assignment operator
- CacheRecorder(const CacheRecorder& obj);
- CacheRecorder& operator=(const CacheRecorder& obj);
+ private:
+ // Private copy constructor and assignment operator
+ CacheRecorder(const CacheRecorder& obj);
+ CacheRecorder& operator=(const CacheRecorder& obj);
- // Data Members (m_ prefix)
- PrioHeap<TraceRecord>* m_records_ptr;
+ PrioHeap<TraceRecord>* m_records_ptr;
};
-// Output operator declaration
-std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const CacheRecorder& obj)
{
- obj.print(out);
- out << std::flush;
- return out;
+ obj.print(out);
+ out << std::flush;
+ return out;
}
-#endif //CACHERECORDER_H
+#endif // __MEM_RUBY_RECORDER_CACHERECORDER_HH__
diff --git a/src/mem/ruby/recorder/TraceRecord.cc b/src/mem/ruby/recorder/TraceRecord.cc
index 81d1e17d8..8c8daa051 100644
--- a/src/mem/ruby/recorder/TraceRecord.cc
+++ b/src/mem/ruby/recorder/TraceRecord.cc
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,125 +26,114 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- *
- */
-
+#include "mem/protocol/CacheMsg.hh"
#include "mem/ruby/recorder/TraceRecord.hh"
#include "mem/ruby/system/Sequencer.hh"
#include "mem/ruby/system/System.hh"
-#include "mem/protocol/CacheMsg.hh"
#include "sim/sim_object.hh"
-TraceRecord::TraceRecord(Sequencer* _sequencer,
- 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_ptr = _sequencer;
- m_data_address = data_addr;
- m_pc_address = pc_addr;
- m_time = time;
- m_type = type;
-
- // Don't differentiate between store misses and atomic requests in
- // the trace
- if (m_type == RubyRequestType_Locked_Read) {
- m_type = RubyRequestType_ST;
- }
- else if (m_type == RubyRequestType_Locked_Write) {
- m_type = RubyRequestType_ST;
- }
+ m_sequencer_ptr = _sequencer;
+ m_data_address = data_addr;
+ m_pc_address = pc_addr;
+ m_time = time;
+ m_type = type;
+
+ // Don't differentiate between store misses and atomic requests in
+ // the trace
+ if (m_type == RubyRequestType_Locked_Read) {
+ m_type = RubyRequestType_ST;
+ } else if (m_type == RubyRequestType_Locked_Write) {
+ m_type = RubyRequestType_ST;
+ }
}
-// Public copy constructor and assignment operator
TraceRecord::TraceRecord(const TraceRecord& obj)
{
- *this = obj; // Call assignment operator
+ // Call assignment operator
+ *this = obj;
}
-TraceRecord& TraceRecord::operator=(const TraceRecord& obj)
+TraceRecord&
+TraceRecord::operator=(const TraceRecord& obj)
{
- 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;
- m_type = obj.m_type;
- return *this;
+ 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;
+ m_type = obj.m_type;
+ return *this;
}
-void TraceRecord::issueRequest() const
+void
+TraceRecord::issueRequest() const
{
- assert(m_sequencer_ptr != NULL);
-
- RubyRequest request(m_data_address.getAddress(),
- NULL,
- RubySystem::getBlockSizeBytes(),
- m_pc_address.getAddress(),
- m_type,
- RubyAccessMode_User,
- NULL);
-
- // Clear out the sequencer
- while (!m_sequencer_ptr->empty()) {
- g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100);
- }
-
- m_sequencer_ptr->makeRequest(request);
-
- // Clear out the sequencer
- while (!m_sequencer_ptr->empty()) {
- g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100);
- }
+ assert(m_sequencer_ptr != NULL);
+
+ RubyRequest request(m_data_address.getAddress(), NULL,
+ RubySystem::getBlockSizeBytes(), m_pc_address.getAddress(),
+ m_type, RubyAccessMode_User, NULL);
+
+ // Clear out the sequencer
+ while (!m_sequencer_ptr->empty()) {
+ g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100);
+ }
+
+ m_sequencer_ptr->makeRequest(request);
+
+ // Clear out the sequencer
+ while (!m_sequencer_ptr->empty()) {
+ g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100);
+ }
}
-void TraceRecord::print(ostream& out) const
+void
+TraceRecord::print(ostream& out) const
{
- out << "[TraceRecord: Node, " << m_sequencer_ptr->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
+void
+TraceRecord::output(ostream& out) const
{
- out << m_sequencer_ptr->name() << " ";
- m_data_address.output(out);
- out << " ";
- m_pc_address.output(out);
- out << " ";
- out << m_type;
- out << endl;
+ out << m_sequencer_ptr->name() << " ";
+ m_data_address.output(out);
+ out << " ";
+ m_pc_address.output(out);
+ out << " ";
+ out << m_type;
+ out << endl;
}
-bool TraceRecord::input(istream& in)
+bool
+TraceRecord::input(istream& in)
{
- 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;
- if (!in.eof()) {
+ 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);
+ if (in.eof())
+ return false;
+
+ string type;
in >> type;
m_type = string_to_RubyRequestType(type);
// Ignore the rest of the line
char c = '\0';
while ((!in.eof()) && (c != '\n')) {
- in.get(c);
+ in.get(c);
}
return true;
- } else {
- return false;
- }
}
diff --git a/src/mem/ruby/recorder/TraceRecord.hh b/src/mem/ruby/recorder/TraceRecord.hh
index a187f2643..c8dae1986 100644
--- a/src/mem/ruby/recorder/TraceRecord.hh
+++ b/src/mem/ruby/recorder/TraceRecord.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -28,84 +27,69 @@
*/
/*
- * $Id$
- *
- * Description: A entry in the cache request record. It is aware of
- * the ruby time and can issue the request back to the
- * cache.
- *
+ * A entry in the cache request record. It is aware of the ruby time
+ * and can issue the request back to the cache.
*/
-#ifndef TRACERECORD_H
-#define TRACERECORD_H
+#ifndef __MEM_RUBY_RECORDER_TRACERECORD_HH__
+#define __MEM_RUBY_RECORDER_TRACERECORD_HH__
-#include "mem/ruby/libruby_internal.hh"
-#include "mem/ruby/system/Sequencer.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Address.hh"
+#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/libruby_internal.hh"
#include "mem/ruby/system/NodeID.hh"
-class CacheMsg;
-
-class TraceRecord {
-public:
- // Constructors
- 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();
-
- // Public copy constructor and assignment operator
- TraceRecord(const TraceRecord& obj);
- TraceRecord& operator=(const TraceRecord& obj);
-
- // Public Methods
- bool node_less_then_eq(const TraceRecord& rec) const { return (this->m_time <= rec.m_time); }
- void issueRequest() const;
+#include "mem/ruby/system/Sequencer.hh"
- void print(ostream& out) const;
- void output(ostream& out) const;
- bool input(istream& in);
-private:
- // Private Methods
+class CacheMsg;
- // Data Members (m_ prefix)
- Sequencer* m_sequencer_ptr;
- Time m_time;
- Address m_data_address;
- Address m_pc_address;
- RubyRequestType m_type;
+class TraceRecord
+{
+ public:
+ 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;
+ }
+
+ TraceRecord(const TraceRecord& obj);
+ TraceRecord& operator=(const TraceRecord& obj);
+
+ bool
+ node_less_then_eq(const TraceRecord& rec) const
+ {
+ return this->m_time <= rec.m_time;
+ }
+
+ void issueRequest() const;
+
+ void print(ostream& out) const;
+ void output(ostream& out) const;
+ bool input(istream& in);
+
+ private:
+ Sequencer* m_sequencer_ptr;
+ Time m_time;
+ Address m_data_address;
+ Address m_pc_address;
+ RubyRequestType m_type;
};
-inline extern bool node_less_then_eq(const TraceRecord& n1, const TraceRecord& n2);
-
-// Output operator declaration
-ostream& operator<<(ostream& out, const TraceRecord& obj);
-
-// ******************* Definitions *******************
-
-inline extern
-bool node_less_then_eq(const TraceRecord& n1, const TraceRecord& n2)
+inline bool
+node_less_then_eq(const TraceRecord& n1, const TraceRecord& n2)
{
- return n1.node_less_then_eq(n2);
+ return n1.node_less_then_eq(n2);
}
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const TraceRecord& obj)
+inline std::ostream&
+operator<<(ostream& out, const TraceRecord& obj)
{
- obj.print(out);
- out << flush;
- return out;
+ obj.print(out);
+ out << std::flush;
+ return out;
}
-#endif //TRACERECORD_H
+#endif // __MEM_RUBY_RECORDER_TRACERECORD_HH__
diff --git a/src/mem/ruby/recorder/Tracer.cc b/src/mem/ruby/recorder/Tracer.cc
index 5a20c2b02..e2d216ba3 100644
--- a/src/mem/ruby/recorder/Tracer.cc
+++ b/src/mem/ruby/recorder/Tracer.cc
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,131 +26,107 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- *
- */
-
-#include "mem/ruby/recorder/Tracer.hh"
-#include "mem/ruby/recorder/TraceRecord.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
+#include "base/cprintf.hh"
#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/eventqueue/RubyEventQueue.hh"
+#include "mem/ruby/recorder/TraceRecord.hh"
+#include "mem/ruby/recorder/Tracer.hh"
#include "mem/ruby/system/System.hh"
-//added by SS
Tracer::Tracer(const Params *p)
: SimObject(p)
{
- m_enabled = false;
- m_warmup_length = p->warmup_length;
- assert(m_warmup_length > 0);
- RubySystem::m_tracer_ptr = this;
-}
-
-//commented by SS
-//Tracer::Tracer()
-//{
-// m_enabled = false;
-//}
-
-Tracer::~Tracer()
-{
+ m_enabled = false;
+ m_warmup_length = p->warmup_length;
+ assert(m_warmup_length > 0);
+ RubySystem::m_tracer_ptr = this;
}
-void Tracer::init()
+void
+Tracer::startTrace(std::string filename)
{
+ if (m_enabled)
+ stopTrace();
+
+ if (filename != "") {
+ m_trace_file.open(filename.c_str());
+ if (m_trace_file.fail()) {
+ cprintf("Error: error opening file '%s'\n", filename);
+ cprintf("Trace not enabled.\n");
+ return;
+ }
+ cprintf("Request trace enabled to output file '%s'\n", filename);
+ m_enabled = true;
+ }
}
-void Tracer::startTrace(std::string filename)
+void
+Tracer::stopTrace()
{
- if (m_enabled) {
- stopTrace();
- }
-
- if (filename != "") {
- m_trace_file.open(filename.c_str());
- if (m_trace_file.fail()) {
- cout << "Error: error opening file '" << filename << "'" << endl;
- cout << "Trace not enabled." << endl;
- return;
+ if (m_enabled) {
+ m_trace_file.close();
+ cout << "Request trace file closed." << endl;
+ m_enabled = false;
}
- cout << "Request trace enabled to output file '" << filename << "'" << endl;
- m_enabled = true;
- }
}
-void Tracer::stopTrace()
+void
+Tracer::traceRequest(Sequencer* sequencer, const Address& data_addr,
+ const Address& pc_addr, RubyRequestType type, Time time)
{
- if (m_enabled == true) {
- m_trace_file.close();
- cout << "Request trace file closed." << endl;
- m_enabled = false;
- }
+ assert(m_enabled);
+ TraceRecord tr(sequencer, data_addr, pc_addr, type, time);
+ tr.output(m_trace_file);
}
-void Tracer::traceRequest(Sequencer* sequencer,
- const Address& data_addr,
- const Address& pc_addr,
- RubyRequestType type,
- Time time)
+int
+Tracer::playbackTrace(std::string filename)
{
- assert(m_enabled == true);
- TraceRecord tr(sequencer, data_addr, pc_addr, type, time);
- tr.output(m_trace_file);
-}
+ igzstream in(filename.c_str());
+ if (in.fail()) {
+ cprintf("Error: error opening file '%s'\n", filename);
+ return 0;
+ }
-// Class method
-int Tracer::playbackTrace(std::string filename)
-{
- igzstream in(filename.c_str());
- if (in.fail()) {
- cout << "Error: error opening file '" << filename << "'" << endl;
- return 0;
- }
-
- time_t start_time = time(NULL);
-
- TraceRecord record;
- int counter = 0;
- // Read in the next TraceRecord
- bool ok = record.input(in);
- while (ok) {
- // Put it in the right cache
- record.issueRequest();
- counter++;
+ time_t start_time = time(NULL);
+ TraceRecord record;
+ int counter = 0;
// Read in the next TraceRecord
- ok = record.input(in);
-
- // Clear the statistics after warmup
-/* if (counter == m_warmup_length) {
- cout << "Clearing stats after warmup of length " << m_warmup_length << endl;
- g_system_ptr->clearStats();
+ bool ok = record.input(in);
+ while (ok) {
+ // Put it in the right cache
+ record.issueRequest();
+ counter++;
+
+ // Read in the next TraceRecord
+ ok = record.input(in);
+
+ // Clear the statistics after warmup
+ if (counter == m_warmup_length) {
+ cprintf("Clearing stats after warmup of length %s\n",
+ m_warmup_length);
+ g_system_ptr->clearStats();
+ }
}
-*/
- if (counter == m_warmup_length) {
- cout << "Clearing stats after warmup of length " << m_warmup_length << endl;
- g_system_ptr->clearStats();
- }
-
- }
- // Flush the prefetches through the system
- g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 1000); // FIXME - should be smarter
+ // Flush the prefetches through the system
+ // FIXME - should be smarter
+ g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 1000);
- time_t stop_time = time(NULL);
- double seconds = difftime(stop_time, start_time);
- double minutes = seconds / 60.0;
- cout << "playbackTrace: " << minutes << " minutes" << endl;
+ time_t stop_time = time(NULL);
+ double seconds = difftime(stop_time, start_time);
+ double minutes = seconds / 60.0;
+ cout << "playbackTrace: " << minutes << " minutes" << endl;
- return counter;
+ return counter;
}
-void Tracer::print(std::ostream& out) const
+void
+Tracer::print(std::ostream& out) const
{
}
-
Tracer *
RubyTracerParams::create()
{
diff --git a/src/mem/ruby/recorder/Tracer.hh b/src/mem/ruby/recorder/Tracer.hh
index a068c32eb..d468b4920 100644
--- a/src/mem/ruby/recorder/Tracer.hh
+++ b/src/mem/ruby/recorder/Tracer.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -28,87 +27,64 @@
*/
/*
- * $Id$
- *
- * Description: Controller class of the tracer. Can stop/start/playback
- * the ruby cache requests trace.
- *
+ * Controller class of the tracer. Can stop/start/playback the ruby
+ * cache requests trace.
*/
-#ifndef TRACER_H
-#define TRACER_H
+#ifndef __MEM_RUBY_RECORDER_TRACER_HH__
+#define __MEM_RUBY_RECORDER_TRACER_HH__
#include <iostream>
#include <string>
-#include "mem/ruby/libruby_internal.hh"
+#include "gzstream.hh"
+#include "mem/protocol/CacheRequestType.hh"
#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/libruby_internal.hh"
#include "mem/ruby/system/NodeID.hh"
-#include "mem/protocol/CacheRequestType.hh"
-#include "sim/sim_object.hh"
-
#include "params/RubyTracer.hh"
-
-#include "gzstream.hh"
+#include "sim/sim_object.hh"
template <class TYPE> class PrioHeap;
class Address;
class TraceRecord;
class Sequencer;
-class Tracer : public SimObject {
-public:
- // Constructors
-// Tracer();
+class Tracer : public SimObject
+{
+ public:
typedef RubyTracerParams Params;
- Tracer(const Params *p);
-
- // Destructor
- ~Tracer();
+ Tracer(const Params *p);
- // Public Methods
- void startTrace(std::string filename);
- void stopTrace();
- bool traceEnabled() { return m_enabled; }
- void traceRequest(Sequencer* sequencer,
- const Address& data_addr,
- const Address& pc_addr,
- RubyRequestType type,
- Time time);
+ void startTrace(std::string filename);
+ void stopTrace();
+ bool traceEnabled() { return m_enabled; }
+ void traceRequest(Sequencer* sequencer, const Address& data_addr,
+ const Address& pc_addr, RubyRequestType type, Time time);
- void print(std::ostream& out) const;
+ void print(std::ostream& out) const;
- // Public Class Methods
- int playbackTrace(std::string filename);
- void init();
-private:
- // Private Methods
+ int playbackTrace(std::string filename);
- // Private copy constructor and assignment operator
- Tracer(const Tracer& obj);
- Tracer& operator=(const Tracer& obj);
+ private:
+ // Private copy constructor and assignment operator
+ Tracer(const Tracer& obj);
+ Tracer& operator=(const Tracer& obj);
- // Data Members (m_ prefix)
- ogzstream m_trace_file;
- bool m_enabled;
+ ogzstream m_trace_file;
+ bool m_enabled;
- //added by SS
- int m_warmup_length;
+ //added by SS
+ int m_warmup_length;
};
-// Output operator declaration
-std::ostream& operator<<(std::ostream& out, const Tracer& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-std::ostream& operator<<(std::ostream& out, const Tracer& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const Tracer& obj)
{
- obj.print(out);
- out << std::flush;
- return out;
+ obj.print(out);
+ out << std::flush;
+ return out;
}
-#endif //TRACER_H
+#endif // __MEM_RUBY_RECORDER_TRACER_HH__