ruby: makes some members non-static
This patch makes some of the members (profiler, network, memory vector) of ruby system non-static.
This commit is contained in:
parent
4488379244
commit
88ba1c452b
|
@ -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) {
|
||||
|
|
|
@ -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&
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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__
|
||||
|
|
Loading…
Reference in a new issue