summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system/System.cc
diff options
context:
space:
mode:
authorJoel Hestness <jthestness@gmail.com>2015-05-19 10:56:51 -0500
committerJoel Hestness <jthestness@gmail.com>2015-05-19 10:56:51 -0500
commit0479569f6748202f1704d70aad3b03b3d17f6092 (patch)
tree12ed286bef31c4eb74d9ff7ae8e2f4613fafda10 /src/mem/ruby/system/System.cc
parent99d3fa594565660d8d51fbda005e3c2213723fef (diff)
downloadgem5-0479569f6748202f1704d70aad3b03b3d17f6092.tar.xz
ruby: Fix RubySystem warm-up and cool-down scope
The processes of warming up and cooling down Ruby caches are simulation-wide processes, not just RubySystem instance-specific processes. Thus, the warm-up and cool-down variables should be globally visible to any Ruby components participating in either process. Make these variables static members and track the warm-up and cool-down processes as appropriate. This patch also has two side benefits: 1) It removes references to the RubySystem g_system_ptr, which are problematic for allowing multiple RubySystem instances in a single simulation. Warmup and cooldown variables being static (global) reduces the need for instance-specific dereferences through the RubySystem. 2) From the AbstractController, it removes local RubySystem pointers, which are used inconsistently with other uses of the RubySystem: 11 other uses reference the RubySystem with the g_system_ptr. Only sequencers have local pointers.
Diffstat (limited to 'src/mem/ruby/system/System.cc')
-rw-r--r--src/mem/ruby/system/System.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index b93dacdfc..75ebc8caf 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -49,6 +49,11 @@ bool RubySystem::m_randomization;
uint32_t RubySystem::m_block_size_bytes;
uint32_t RubySystem::m_block_size_bits;
uint32_t RubySystem::m_memory_size_bits;
+bool RubySystem::m_warmup_enabled = false;
+// To look forward to allowing multiple RubySystem instances, track the number
+// of RubySystems that need to be warmed up on checkpoint restore.
+unsigned RubySystem::m_systems_to_warmup = 0;
+bool RubySystem::m_cooldown_enabled = false;
RubySystem::RubySystem(const Params *p)
: ClockedObject(p), m_access_backing_store(p->access_backing_store)
@@ -65,9 +70,6 @@ RubySystem::RubySystem(const Params *p)
m_block_size_bits = floorLog2(m_block_size_bytes);
m_memory_size_bits = p->memory_size_bits;
- m_warmup_enabled = false;
- m_cooldown_enabled = false;
-
// Setup the global variables used in Ruby
g_system_ptr = this;
@@ -252,6 +254,7 @@ RubySystem::unserialize(Checkpoint *cp, const string &section)
readCompressedTrace(cache_trace_file, uncompressed_trace,
cache_trace_size);
m_warmup_enabled = true;
+ m_systems_to_warmup++;
vector<Sequencer*> sequencer_map;
Sequencer* t = NULL;
@@ -307,7 +310,10 @@ RubySystem::startup()
delete m_cache_recorder;
m_cache_recorder = NULL;
- m_warmup_enabled = false;
+ m_systems_to_warmup--;
+ if (m_systems_to_warmup == 0) {
+ m_warmup_enabled = false;
+ }
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
@@ -322,9 +328,9 @@ RubySystem::startup()
void
RubySystem::RubyEvent::process()
{
- if (ruby_system->m_warmup_enabled) {
+ if (RubySystem::getWarmupEnabled()) {
ruby_system->m_cache_recorder->enqueueNextFetchRequest();
- } else if (ruby_system->m_cooldown_enabled) {
+ } else if (RubySystem::getCooldownEnabled()) {
ruby_system->m_cache_recorder->enqueueNextFlushRequest();
}
}