summaryrefslogtreecommitdiff
path: root/src/mem/ruby/recorder
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
committerNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
commit92de70b69aaf3f399a855057b556ed198139e5d8 (patch)
treef8e7d0d494df8810cc960be4c52d8b555471f157 /src/mem/ruby/recorder
parent05f6a4a6b92370162da17ef5cccb5a7e3ba508e5 (diff)
downloadgem5-92de70b69aaf3f399a855057b556ed198139e5d8.tar.xz
ruby: Import the latest ruby changes from gems.
This was done with an automated process, so there could be things that were done in this tree in the past that didn't make it. One known regression is that atomic memory operations do not seem to work properly anymore.
Diffstat (limited to 'src/mem/ruby/recorder')
-rw-r--r--src/mem/ruby/recorder/CacheRecorder.cc38
-rw-r--r--src/mem/ruby/recorder/CacheRecorder.hh4
-rw-r--r--src/mem/ruby/recorder/TraceRecord.cc41
-rw-r--r--src/mem/ruby/recorder/TraceRecord.hh11
-rw-r--r--src/mem/ruby/recorder/Tracer.cc41
-rw-r--r--src/mem/ruby/recorder/Tracer.hh14
6 files changed, 85 insertions, 64 deletions
diff --git a/src/mem/ruby/recorder/CacheRecorder.cc b/src/mem/ruby/recorder/CacheRecorder.cc
index 21193ba68..672c175e3 100644
--- a/src/mem/ruby/recorder/CacheRecorder.cc
+++ b/src/mem/ruby/recorder/CacheRecorder.cc
@@ -36,44 +36,40 @@
#include "mem/ruby/recorder/TraceRecord.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/gems_common/PrioHeap.hh"
+#include "gzstream.hh"
CacheRecorder::CacheRecorder()
{
- std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented" << std::endl;
- // m_records_ptr = new PrioHeap<TraceRecord>;
+ m_records_ptr = new PrioHeap<TraceRecord>;
}
CacheRecorder::~CacheRecorder()
{
- std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented" << std::endl;
- // delete m_records_ptr;
+ delete m_records_ptr;
}
-void CacheRecorder::addRecord(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time)
+void CacheRecorder::addRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time)
{
- std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented" << std::endl;
- // m_records_ptr->insert(TraceRecord(id, data_addr, pc_addr, type, time));
+ m_records_ptr->insert(TraceRecord(sequencer_name, data_addr, pc_addr, type, time));
}
int CacheRecorder::dumpRecords(string filename)
{
- std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented" << std::endl;
- // 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
{
- std::cout << __FILE__ << "(" << __LINE__ << "): Not implemented" << std::endl;
}
diff --git a/src/mem/ruby/recorder/CacheRecorder.hh b/src/mem/ruby/recorder/CacheRecorder.hh
index 0f69f8478..144e841b3 100644
--- a/src/mem/ruby/recorder/CacheRecorder.hh
+++ b/src/mem/ruby/recorder/CacheRecorder.hh
@@ -38,6 +38,8 @@
#ifndef CACHERECORDER_H
#define CACHERECORDER_H
+#include "mem/ruby/libruby_internal.hh"
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh"
#include "mem/protocol/CacheRequestType.hh"
@@ -55,7 +57,7 @@ public:
~CacheRecorder();
// Public Methods
- void addRecord(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time);
+ void addRecord(const string & sequencer_name, 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 31b83690e..1521d2a3f 100644
--- a/src/mem/ruby/recorder/TraceRecord.cc
+++ b/src/mem/ruby/recorder/TraceRecord.cc
@@ -35,13 +35,11 @@
#include "mem/ruby/recorder/TraceRecord.hh"
#include "mem/ruby/system/Sequencer.hh"
#include "mem/ruby/system/System.hh"
-#include "mem/ruby/slicc_interface/AbstractChip.hh"
#include "mem/protocol/CacheMsg.hh"
-#include "mem/packet.hh"
-TraceRecord::TraceRecord(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time)
+TraceRecord::TraceRecord(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time)
{
- m_node_num = id;
+ m_sequencer_name = sequencer_name;
m_data_address = data_addr;
m_pc_address = pc_addr;
m_time = time;
@@ -49,8 +47,8 @@ TraceRecord::TraceRecord(NodeID id, const Address& data_addr, const Address& pc_
// Don't differentiate between store misses and atomic requests in
// the trace
- if (m_type == CacheRequestType_ATOMIC) {
- m_type = CacheRequestType_ST;
+ if (m_type == RubyRequestType_RMW) {
+ m_type = RubyRequestType_ST;
}
}
@@ -62,7 +60,7 @@ TraceRecord::TraceRecord(const TraceRecord& obj)
TraceRecord& TraceRecord::operator=(const TraceRecord& obj)
{
- m_node_num = obj.m_node_num;
+ m_sequencer_name = obj.m_sequencer_name;
m_time = obj.m_time;
m_data_address = obj.m_data_address;
m_pc_address = obj.m_pc_address;
@@ -74,32 +72,17 @@ void TraceRecord::issueRequest() const
{
// Lookup sequencer pointer from system
// Note that the chip index also needs to take into account SMT configurations
- AbstractChip* chip_ptr = g_system_ptr->getChip(m_node_num/RubyConfig::numberOfProcsPerChip()/RubyConfig::numberofSMTThreads());
- assert(chip_ptr != NULL);
- Sequencer* sequencer_ptr = chip_ptr->getSequencer((m_node_num/RubyConfig::numberofSMTThreads())%RubyConfig::numberOfProcsPerChip());
+ Sequencer* sequencer_ptr = RubySystem::getSequencer(m_sequencer_name);
assert(sequencer_ptr != NULL);
- Addr data_addr = m_data_address.getAddress();
- Addr pc_addr = m_pc_address.getAddress();
- Request request(0, data_addr, 0, Flags<unsigned int>(Request::PREFETCH), pc_addr, m_node_num, 0);
- MemCmd::Command command;
- if (m_type == CacheRequestType_LD || m_type == CacheRequestType_IFETCH)
- command = MemCmd::ReadReq;
- else if (m_type == CacheRequestType_ST)
- command = MemCmd::WriteReq;
- else if (m_type == CacheRequestType_ATOMIC)
- command = MemCmd::SwapReq; // TODO -- differentiate between atomic types
- else
- assert(false);
-
- Packet pkt(&request, command, 0); // TODO -- make dest a real NodeID
+ 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()) {
g_eventQueue_ptr->triggerEvents(g_eventQueue_ptr->getTime() + 100);
}
- sequencer_ptr->makeRequest(&pkt);
+ sequencer_ptr->makeRequest(request);
// Clear out the sequencer
while (!sequencer_ptr->empty()) {
@@ -109,12 +92,12 @@ void TraceRecord::issueRequest() const
void TraceRecord::print(ostream& out) const
{
- out << "[TraceRecord: Node, " << m_node_num << ", " << m_data_address << ", " << m_pc_address << ", " << m_type << ", Time: " << m_time << "]";
+ out << "[TraceRecord: Node, " << m_sequencer_name << ", " << m_data_address << ", " << m_pc_address << ", " << m_type << ", Time: " << m_time << "]";
}
void TraceRecord::output(ostream& out) const
{
- out << m_node_num << " ";
+ out << m_sequencer_name << " ";
m_data_address.output(out);
out << " ";
m_pc_address.output(out);
@@ -125,13 +108,13 @@ void TraceRecord::output(ostream& out) const
bool TraceRecord::input(istream& in)
{
- in >> m_node_num;
+ in >> m_sequencer_name;
m_data_address.input(in);
m_pc_address.input(in);
string type;
if (!in.eof()) {
in >> type;
- m_type = string_to_CacheRequestType(type);
+ m_type = string_to_RubyRequestType(type);
// Ignore the rest of the line
char c = '\0';
diff --git a/src/mem/ruby/recorder/TraceRecord.hh b/src/mem/ruby/recorder/TraceRecord.hh
index cfe2ff9e3..081d392e5 100644
--- a/src/mem/ruby/recorder/TraceRecord.hh
+++ b/src/mem/ruby/recorder/TraceRecord.hh
@@ -39,17 +39,18 @@
#ifndef TRACERECORD_H
#define TRACERECORD_H
+#include "mem/ruby/libruby_internal.hh"
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/system/NodeID.hh"
-#include "mem/protocol/CacheRequestType.hh"
class CacheMsg;
class TraceRecord {
public:
// Constructors
- TraceRecord(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time);
- TraceRecord() { m_node_num = 0; m_time = 0; m_type = CacheRequestType_NULL; }
+ 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; }
// Destructor
// ~TraceRecord();
@@ -69,11 +70,11 @@ private:
// Private Methods
// Data Members (m_ prefix)
- NodeID m_node_num;
+ string m_sequencer_name;
Time m_time;
Address m_data_address;
Address m_pc_address;
- CacheRequestType m_type;
+ RubyRequestType m_type;
};
inline extern bool node_less_then_eq(const TraceRecord& n1, const TraceRecord& n2);
diff --git a/src/mem/ruby/recorder/Tracer.cc b/src/mem/ruby/recorder/Tracer.cc
index 896bfd31e..d2df544d8 100644
--- a/src/mem/ruby/recorder/Tracer.cc
+++ b/src/mem/ruby/recorder/Tracer.cc
@@ -37,16 +37,41 @@
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/system/System.hh"
+#include "mem/ruby/config/RubyConfig.hh"
-Tracer::Tracer()
+//added by SS
+Tracer::Tracer(const string & name)
{
+ m_name = name;
m_enabled = false;
}
+//commented by SS
+//Tracer::Tracer()
+//{
+// m_enabled = false;
+//}
+
Tracer::~Tracer()
{
}
+void Tracer::init(const vector<string> & argv)
+{
+ m_warmup_length = 0;
+
+ for (size_t i=0; i<argv.size(); i+=2) {
+ if ( argv[i] == "warmup_length") {
+ m_warmup_length = atoi(argv[i+1].c_str());
+ }
+ else {
+ cerr << "WARNING: Tracer: Unkown configuration parameter: " << argv[i] << endl;
+ assert(false);
+ }
+ }
+ assert(m_warmup_length > 0);
+}
+
void Tracer::startTrace(string filename)
{
if (m_enabled) {
@@ -73,10 +98,10 @@ void Tracer::stopTrace()
m_enabled = false;
}
-void Tracer::traceRequest(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time)
+void Tracer::traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time)
{
assert(m_enabled == true);
- TraceRecord tr(id, data_addr, pc_addr, type, time);
+ TraceRecord tr(sequencer_name, data_addr, pc_addr, type, time);
tr.output(m_trace_file);
}
@@ -104,10 +129,16 @@ int Tracer::playbackTrace(string filename)
ok = record.input(in);
// Clear the statistics after warmup
- if (counter == g_trace_warmup_length) {
- cout << "Clearing stats after warmup of length " << g_trace_warmup_length << endl;
+/* if (counter == RubyConfig::getTraceWarmupLength()) {
+ cout << "Clearing stats after warmup of length " << RubyConfig::getTraceWarmupLength() << endl;
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
diff --git a/src/mem/ruby/recorder/Tracer.hh b/src/mem/ruby/recorder/Tracer.hh
index 0f78f54b2..27a1c95e1 100644
--- a/src/mem/ruby/recorder/Tracer.hh
+++ b/src/mem/ruby/recorder/Tracer.hh
@@ -38,6 +38,8 @@
#ifndef TRACER_H
#define TRACER_H
+#include "mem/ruby/libruby_internal.hh"
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh"
#include "mem/protocol/CacheRequestType.hh"
@@ -50,7 +52,8 @@ class TraceRecord;
class Tracer {
public:
// Constructors
- Tracer();
+// Tracer();
+ Tracer(const string & name);
// Destructor
~Tracer();
@@ -59,12 +62,13 @@ public:
void startTrace(string filename);
void stopTrace();
bool traceEnabled() { return m_enabled; }
- void traceRequest(NodeID id, const Address& data_addr, const Address& pc_addr, CacheRequestType type, Time time);
+ void traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time);
void print(ostream& out) const;
// Public Class Methods
- static int playbackTrace(string filename);
+ int playbackTrace(string filename);
+ void init(const vector<string> & argv);
private:
// Private Methods
@@ -75,6 +79,10 @@ private:
// Data Members (m_ prefix)
ogzstream m_trace_file;
bool m_enabled;
+
+ //added by SS
+ int m_warmup_length;
+ string m_name;
};
// Output operator declaration