summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system/Sequencer.cc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2014-01-10 16:19:47 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2014-01-10 16:19:47 -0600
commit407f37e15f19a2da350a94272ac7739891e935f4 (patch)
treedb413665cc1d2fc411b960339e1653cce0e182e8 /src/mem/ruby/system/Sequencer.cc
parentcfe912a5127b51273d7e3e78c15095ac832f20bd (diff)
downloadgem5-407f37e15f19a2da350a94272ac7739891e935f4.tar.xz
ruby: move all statistics to stats.txt, eliminate ruby.stats
Diffstat (limited to 'src/mem/ruby/system/Sequencer.cc')
-rw-r--r--src/mem/ruby/system/Sequencer.cc194
1 files changed, 108 insertions, 86 deletions
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index 8e61766b8..be554d5cf 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -55,13 +55,8 @@ RubySequencerParams::create()
}
Sequencer::Sequencer(const Params *p)
- : RubyPort(p), deadlockCheckEvent(this)
+ : RubyPort(p), m_IncompleteTimes(MachineType_NUM), deadlockCheckEvent(this)
{
- m_store_waiting_on_load_cycles = 0;
- m_store_waiting_on_store_cycles = 0;
- m_load_waiting_on_store_cycles = 0;
- m_load_waiting_on_load_cycles = 0;
-
m_outstanding_count = 0;
m_instCache_ptr = p->icache;
@@ -133,81 +128,35 @@ Sequencer::wakeup()
}
}
-void Sequencer::clearStats()
+void Sequencer::resetStats()
{
- m_outstandReqHist.clear();
-
- // Initialize the histograms that track latency of all requests
- m_latencyHist.clear(20);
- m_typeLatencyHist.resize(RubyRequestType_NUM);
- for (int i = 0; i < RubyRequestType_NUM; i++) {
- m_typeLatencyHist[i].clear(20);
- }
-
- // Initialize the histograms that track latency of requests that
- // hit in the cache attached to the sequencer.
- m_hitLatencyHist.clear(20);
- m_hitTypeLatencyHist.resize(RubyRequestType_NUM);
- m_hitTypeMachLatencyHist.resize(RubyRequestType_NUM);
-
+ m_latencyHist.reset();
+ m_hitLatencyHist.reset();
+ m_missLatencyHist.reset();
for (int i = 0; i < RubyRequestType_NUM; i++) {
- m_hitTypeLatencyHist[i].clear(20);
- m_hitTypeMachLatencyHist[i].resize(MachineType_NUM);
+ m_typeLatencyHist[i]->reset();
+ m_hitTypeLatencyHist[i]->reset();
+ m_missTypeLatencyHist[i]->reset();
for (int j = 0; j < MachineType_NUM; j++) {
- m_hitTypeMachLatencyHist[i][j].clear(20);
+ m_hitTypeMachLatencyHist[i][j]->reset();
+ m_missTypeMachLatencyHist[i][j]->reset();
}
}
- // Initialize the histograms that track the latency of requests that
- // missed in the cache attached to the sequencer.
- m_missLatencyHist.clear(20);
- m_missTypeLatencyHist.resize(RubyRequestType_NUM);
- m_missTypeMachLatencyHist.resize(RubyRequestType_NUM);
-
- for (int i = 0; i < RubyRequestType_NUM; i++) {
- m_missTypeLatencyHist[i].clear(20);
- m_missTypeMachLatencyHist[i].resize(MachineType_NUM);
- for (int j = 0; j < MachineType_NUM; j++) {
- m_missTypeMachLatencyHist[i][j].clear(20);
- }
- }
-
- m_hitMachLatencyHist.resize(MachineType_NUM);
- m_missMachLatencyHist.resize(MachineType_NUM);
- m_IssueToInitialDelayHist.resize(MachineType_NUM);
- m_InitialToForwardDelayHist.resize(MachineType_NUM);
- m_ForwardToFirstResponseDelayHist.resize(MachineType_NUM);
- m_FirstResponseToCompletionDelayHist.resize(MachineType_NUM);
- m_IncompleteTimes.resize(MachineType_NUM);
-
for (int i = 0; i < MachineType_NUM; i++) {
- m_missMachLatencyHist[i].clear(20);
- m_hitMachLatencyHist[i].clear(20);
+ m_missMachLatencyHist[i]->reset();
+ m_hitMachLatencyHist[i]->reset();
- m_IssueToInitialDelayHist[i].clear(20);
- m_InitialToForwardDelayHist[i].clear(20);
- m_ForwardToFirstResponseDelayHist[i].clear(20);
- m_FirstResponseToCompletionDelayHist[i].clear(20);
+ m_IssueToInitialDelayHist[i]->reset();
+ m_InitialToForwardDelayHist[i]->reset();
+ m_ForwardToFirstResponseDelayHist[i]->reset();
+ m_FirstResponseToCompletionDelayHist[i]->reset();
m_IncompleteTimes[i] = 0;
}
}
void
-Sequencer::printStats(ostream & out) const
-{
- out << "Sequencer: " << m_name << endl
- << " store_waiting_on_load_cycles: "
- << m_store_waiting_on_load_cycles << endl
- << " store_waiting_on_store_cycles: "
- << m_store_waiting_on_store_cycles << endl
- << " load_waiting_on_load_cycles: "
- << m_load_waiting_on_load_cycles << endl
- << " load_waiting_on_store_cycles: "
- << m_load_waiting_on_store_cycles << endl;
-}
-
-void
Sequencer::printProgress(ostream& out) const
{
#if 0
@@ -291,7 +240,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
// Check if there is any outstanding read request for the same
// cache line.
if (m_readRequestTable.count(line_addr) > 0) {
- m_store_waiting_on_load_cycles++;
+ m_store_waiting_on_load++;
return RequestStatus_Aliased;
}
@@ -303,14 +252,14 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
m_outstanding_count++;
} else {
// There is an outstanding write request for the cache line
- m_store_waiting_on_store_cycles++;
+ m_store_waiting_on_store++;
return RequestStatus_Aliased;
}
} else {
// Check if there is any outstanding write request for the same
// cache line.
if (m_writeRequestTable.count(line_addr) > 0) {
- m_load_waiting_on_store_cycles++;
+ m_load_waiting_on_store++;
return RequestStatus_Aliased;
}
@@ -323,12 +272,12 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
m_outstanding_count++;
} else {
// There is an outstanding read request for the cache line
- m_load_waiting_on_load_cycles++;
+ m_load_waiting_on_load++;
return RequestStatus_Aliased;
}
}
- m_outstandReqHist.add(m_outstanding_count);
+ m_outstandReqHist.sample(m_outstanding_count);
assert(m_outstanding_count ==
(m_writeRequestTable.size() + m_readRequestTable.size()));
@@ -432,41 +381,41 @@ Sequencer::recordMissLatency(const Cycles cycles, const RubyRequestType type,
Cycles forwardRequestTime,
Cycles firstResponseTime, Cycles completionTime)
{
- m_latencyHist.add(cycles);
- m_typeLatencyHist[type].add(cycles);
+ m_latencyHist.sample(cycles);
+ m_typeLatencyHist[type]->sample(cycles);
if (isExternalHit) {
- m_missLatencyHist.add(cycles);
- m_missTypeLatencyHist[type].add(cycles);
+ m_missLatencyHist.sample(cycles);
+ m_missTypeLatencyHist[type]->sample(cycles);
if (respondingMach != MachineType_NUM) {
- m_missMachLatencyHist[respondingMach].add(cycles);
- m_missTypeMachLatencyHist[type][respondingMach].add(cycles);
+ m_missMachLatencyHist[respondingMach]->sample(cycles);
+ m_missTypeMachLatencyHist[type][respondingMach]->sample(cycles);
if ((issuedTime <= initialRequestTime) &&
(initialRequestTime <= forwardRequestTime) &&
(forwardRequestTime <= firstResponseTime) &&
(firstResponseTime <= completionTime)) {
- m_IssueToInitialDelayHist[respondingMach].add(
+ m_IssueToInitialDelayHist[respondingMach]->sample(
initialRequestTime - issuedTime);
- m_InitialToForwardDelayHist[respondingMach].add(
+ m_InitialToForwardDelayHist[respondingMach]->sample(
forwardRequestTime - initialRequestTime);
- m_ForwardToFirstResponseDelayHist[respondingMach].add(
+ m_ForwardToFirstResponseDelayHist[respondingMach]->sample(
firstResponseTime - forwardRequestTime);
- m_FirstResponseToCompletionDelayHist[respondingMach].add(
+ m_FirstResponseToCompletionDelayHist[respondingMach]->sample(
completionTime - firstResponseTime);
} else {
m_IncompleteTimes[respondingMach]++;
}
}
} else {
- m_hitLatencyHist.add(cycles);
- m_hitTypeLatencyHist[type].add(cycles);
+ m_hitLatencyHist.sample(cycles);
+ m_hitTypeLatencyHist[type]->sample(cycles);
if (respondingMach != MachineType_NUM) {
- m_hitMachLatencyHist[respondingMach].add(cycles);
- m_hitTypeMachLatencyHist[type][respondingMach].add(cycles);
+ m_hitMachLatencyHist[respondingMach]->sample(cycles);
+ m_hitTypeMachLatencyHist[type][respondingMach]->sample(cycles);
}
}
}
@@ -810,3 +759,76 @@ Sequencer::evictionCallback(const Address& address)
{
ruby_eviction_callback(address);
}
+
+void
+Sequencer::regStats()
+{
+ m_store_waiting_on_load
+ .name(name() + ".store_waiting_on_load")
+ .desc("Number of times a store aliased with a pending load")
+ .flags(Stats::nozero);
+ m_store_waiting_on_store
+ .name(name() + ".store_waiting_on_store")
+ .desc("Number of times a store aliased with a pending store")
+ .flags(Stats::nozero);
+ m_load_waiting_on_load
+ .name(name() + ".load_waiting_on_load")
+ .desc("Number of times a load aliased with a pending load")
+ .flags(Stats::nozero);
+ m_load_waiting_on_store
+ .name(name() + ".load_waiting_on_store")
+ .desc("Number of times a load aliased with a pending store")
+ .flags(Stats::nozero);
+
+ // These statistical variables are not for display.
+ // The profiler will collate these across different
+ // sequencers and display those collated statistics.
+ m_outstandReqHist.init(10);
+ m_latencyHist.init(10);
+ m_hitLatencyHist.init(10);
+ m_missLatencyHist.init(10);
+
+ for (int i = 0; i < RubyRequestType_NUM; i++) {
+ m_typeLatencyHist.push_back(new Stats::Histogram());
+ m_typeLatencyHist[i]->init(10);
+
+ m_hitTypeLatencyHist.push_back(new Stats::Histogram());
+ m_hitTypeLatencyHist[i]->init(10);
+
+ m_missTypeLatencyHist.push_back(new Stats::Histogram());
+ m_missTypeLatencyHist[i]->init(10);
+ }
+
+ for (int i = 0; i < MachineType_NUM; i++) {
+ m_hitMachLatencyHist.push_back(new Stats::Histogram());
+ m_hitMachLatencyHist[i]->init(10);
+
+ m_missMachLatencyHist.push_back(new Stats::Histogram());
+ m_missMachLatencyHist[i]->init(10);
+
+ m_IssueToInitialDelayHist.push_back(new Stats::Histogram());
+ m_IssueToInitialDelayHist[i]->init(10);
+
+ m_InitialToForwardDelayHist.push_back(new Stats::Histogram());
+ m_InitialToForwardDelayHist[i]->init(10);
+
+ m_ForwardToFirstResponseDelayHist.push_back(new Stats::Histogram());
+ m_ForwardToFirstResponseDelayHist[i]->init(10);
+
+ m_FirstResponseToCompletionDelayHist.push_back(new Stats::Histogram());
+ m_FirstResponseToCompletionDelayHist[i]->init(10);
+ }
+
+ for (int i = 0; i < RubyRequestType_NUM; i++) {
+ m_hitTypeMachLatencyHist.push_back(std::vector<Stats::Histogram *>());
+ m_missTypeMachLatencyHist.push_back(std::vector<Stats::Histogram *>());
+
+ for (int j = 0; j < MachineType_NUM; j++) {
+ m_hitTypeMachLatencyHist[i].push_back(new Stats::Histogram());
+ m_hitTypeMachLatencyHist[i][j]->init(10);
+
+ m_missTypeMachLatencyHist[i].push_back(new Stats::Histogram());
+ m_missTypeMachLatencyHist[i][j]->init(10);
+ }
+ }
+}