summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-10-02 14:35:45 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-10-02 14:35:45 -0500
commit88ba1c452b25de7f11dcb4a14bbeb8f540809918 (patch)
tree03dab82a1b7e2d7de285ec1b19c0980a9310dd8f /src/mem/ruby
parent4488379244cdf3c211e76dbf3b4278347f639039 (diff)
downloadgem5-88ba1c452b25de7f11dcb4a14bbeb8f540809918.tar.xz
ruby: makes some members non-static
This patch makes some of the members (profiler, network, memory vector) of ruby system non-static.
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/network/Network.cc6
-rw-r--r--src/mem/ruby/network/Network.hh10
-rw-r--r--src/mem/ruby/network/simple/Throttle.cc3
-rw-r--r--src/mem/ruby/profiler/Profiler.cc2
-rw-r--r--src/mem/ruby/system/System.cc12
-rw-r--r--src/mem/ruby/system/System.hh18
6 files changed, 25 insertions, 26 deletions
diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc
index 2aa120cdf..5c025db2a 100644
--- a/src/mem/ruby/network/Network.cc
+++ b/src/mem/ruby/network/Network.cc
@@ -32,6 +32,10 @@
#include "mem/ruby/network/Topology.hh"
#include "mem/ruby/system/System.hh"
+uint32_t Network::m_virtual_networks;
+uint32_t Network::m_control_msg_size;
+uint32_t Network::m_data_msg_size;
+
Network::Network(const Params *p)
: SimObject(p)
{
@@ -58,7 +62,7 @@ Network::init()
m_data_msg_size = RubySystem::getBlockSizeBytes() + m_control_msg_size;
}
-int
+uint32_t
Network::MessageSizeType_to_int(MessageSizeType size_type)
{
switch(size_type) {
diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh
index 8640ba9b1..e9c5a98b7 100644
--- a/src/mem/ruby/network/Network.hh
+++ b/src/mem/ruby/network/Network.hh
@@ -64,8 +64,8 @@ class Network : public SimObject
virtual void init();
- int getNumberOfVirtualNetworks() { return m_virtual_networks; }
- int MessageSizeType_to_int(MessageSizeType size_type);
+ static int getNumberOfVirtualNetworks() { return m_virtual_networks; }
+ static uint32_t MessageSizeType_to_int(MessageSizeType size_type);
// returns the queue requested for the given component
virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered,
@@ -102,10 +102,10 @@ class Network : public SimObject
protected:
const std::string m_name;
int m_nodes;
- int m_virtual_networks;
+ static uint32_t m_virtual_networks;
Topology* m_topology_ptr;
- int m_control_msg_size;
- int m_data_msg_size;
+ static uint32_t m_control_msg_size;
+ static uint32_t m_data_msg_size;
};
inline std::ostream&
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index e4dc71527..653791c29 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -260,8 +260,7 @@ network_message_to_size(NetworkMessage* net_msg_ptr)
{
assert(net_msg_ptr != NULL);
- int size = RubySystem::getNetwork()->
- MessageSizeType_to_int(net_msg_ptr->getMessageSize());
+ int size = Network::MessageSizeType_to_int(net_msg_ptr->getMessageSize());
size *= MESSAGE_SIZE_MULTIPLIER;
// Artificially increase the size of broadcast messages
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc
index e84eea727..c4be8884c 100644
--- a/src/mem/ruby/profiler/Profiler.cc
+++ b/src/mem/ruby/profiler/Profiler.cc
@@ -460,7 +460,7 @@ Profiler::clearStats()
m_delayedCyclesHistogram.clear();
m_delayedCyclesNonPFHistogram.clear();
- int size = RubySystem::getNetwork()->getNumberOfVirtualNetworks();
+ int size = Network::getNumberOfVirtualNetworks();
m_delayedCyclesVCHistograms.resize(size);
for (int i = 0; i < size; i++) {
m_delayedCyclesVCHistograms[i].clear();
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index 25857464d..8c267654f 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -51,10 +51,6 @@ int RubySystem::m_block_size_bits;
uint64 RubySystem::m_memory_size_bytes;
int RubySystem::m_memory_size_bits;
-Network* RubySystem::m_network_ptr;
-Profiler* RubySystem::m_profiler_ptr;
-MemoryVector* RubySystem::m_mem_vec_ptr;
-
RubySystem::RubySystem(const Params *p)
: ClockedObject(p)
{
@@ -84,11 +80,9 @@ RubySystem::RubySystem(const Params *p)
m_mem_vec_ptr->resize(m_memory_size_bytes);
}
- //
// Print ruby configuration and stats at exit
- //
- RubyExitCallback* rubyExitCB = new RubyExitCallback(p->stats_filename);
- registerExitCallback(rubyExitCB);
+ registerExitCallback(new RubyExitCallback(p->stats_filename, this));
+
m_warmup_enabled = false;
m_cooldown_enabled = false;
}
@@ -636,5 +630,5 @@ void
RubyExitCallback::process()
{
std::ostream *os = simout.create(stats_filename);
- RubySystem::printStats(*os);
+ ruby_system->printStats(*os);
}
diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh
index c0614cb1a..e9e46fedf 100644
--- a/src/mem/ruby/system/System.hh
+++ b/src/mem/ruby/system/System.hh
@@ -81,7 +81,7 @@ class RubySystem : public ClockedObject
Cycles getTime() const { return curCycle(); }
// Public Methods
- static Network*
+ Network*
getNetwork()
{
assert(m_network_ptr != NULL);
@@ -95,14 +95,14 @@ class RubySystem : public ClockedObject
return m_profiler_ptr;
}
- static MemoryVector*
+ MemoryVector*
getMemoryVector()
{
assert(m_mem_vec_ptr != NULL);
return m_mem_vec_ptr;
}
- static void printStats(std::ostream& out);
+ void printStats(std::ostream& out);
void clearStats() const;
uint64 getInstructionCount(int thread) { return 1; }
@@ -150,13 +150,13 @@ class RubySystem : public ClockedObject
static int m_block_size_bits;
static uint64 m_memory_size_bytes;
static int m_memory_size_bits;
- static Network* m_network_ptr;
+ Network* m_network_ptr;
MemoryControl *m_memory_controller;
public:
- static Profiler* m_profiler_ptr;
- static MemoryVector* m_mem_vec_ptr;
+ Profiler* m_profiler_ptr;
+ MemoryVector* m_mem_vec_ptr;
std::vector<AbstractController*> m_abs_cntrl_vec;
bool m_warmup_enabled;
bool m_cooldown_enabled;
@@ -176,16 +176,18 @@ class RubyExitCallback : public Callback
{
private:
std::string stats_filename;
+ RubySystem *ruby_system;
public:
virtual ~RubyExitCallback() {}
- RubyExitCallback(const std::string& _stats_filename)
+ RubyExitCallback(const std::string& _stats_filename, RubySystem *system)
{
stats_filename = _stats_filename;
+ ruby_system = system;
}
- virtual void process();
+ void process();
};
#endif // __MEM_RUBY_SYSTEM_SYSTEM_HH__