diff --git a/src/mem/ruby/common/Global.hh b/src/mem/ruby/common/Global.hh --- a/src/mem/ruby/common/Global.hh +++ b/src/mem/ruby/common/Global.hh @@ -41,8 +41,4 @@ class AbstractController; extern std::vector > g_abs_controls; -// A globally visible time at which the actual execution started. Meant only -// for components with in Ruby. Initialized in RubySystem::startup(). -extern Cycles g_ruby_start; - #endif // __MEM_RUBY_COMMON_GLOBAL_HH__ # Node ID 80cb452d023e342a3d99adfe09031a16dec7cea1 # Parent 847360818c849b760cd6e6263a2939020a169bbd diff --git a/src/mem/ruby/common/Global.cc b/src/mem/ruby/common/Global.cc --- a/src/mem/ruby/common/Global.cc +++ b/src/mem/ruby/common/Global.cc @@ -32,4 +32,3 @@ RubySystem* g_system_ptr = 0; vector > g_abs_controls; -Cycles g_ruby_start; diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc --- a/src/mem/ruby/network/Network.cc +++ b/src/mem/ruby/network/Network.cc @@ -65,7 +65,7 @@ m_ordered[i] = false; } - p->ruby_system->registerNetwork(this); + params()->ruby_system->registerNetwork(this); // Initialize the controller's network pointers for (std::vector::const_iterator i = p->ext_links.begin(); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -40,6 +40,7 @@ #include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" +#include "mem/ruby/system/System.hh" using namespace std; using m5::stl_helpers::deletePointers; @@ -223,15 +224,15 @@ void GarnetNetwork_d::collateStats() { + double time_delta = double(curCycle() - RubySystem::getStartCycle()); + for (int i = 0; i < m_links.size(); i++) { m_average_link_utilization += - (double(m_links[i]->getLinkUtilization())) / - (double(curCycle() - g_ruby_start)); + (double(m_links[i]->getLinkUtilization())) / time_delta; vector vc_load = m_links[i]->getVcLoad(); for (int j = 0; j < vc_load.size(); j++) { - m_average_vc_load[j] += - ((double)vc_load[j] / (double)(curCycle() - g_ruby_start)); + m_average_vc_load[j] += ((double)vc_load[j] / time_delta); } } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -40,6 +40,7 @@ #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh" #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" #include "mem/ruby/network/garnet/flexible-pipeline/Router.hh" +#include "mem/ruby/system/System.hh" using namespace std; using m5::stl_helpers::deletePointers; @@ -227,10 +228,11 @@ void GarnetNetwork::collateStats() { + double time_delta = double(curCycle() - RubySystem::getStartCycle()); + for (int i = 0; i < m_links.size(); i++) { m_average_link_utilization += - (double(m_links[i]->getLinkUtilization())) / - (double(curCycle() - g_ruby_start)); + (double(m_links[i]->getLinkUtilization())) / time_delta; vector vc_load = m_links[i]->getVcLoad(); for (int j = 0; j < vc_load.size(); j++) { diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc --- a/src/mem/ruby/network/simple/Switch.cc +++ b/src/mem/ruby/network/simple/Switch.cc @@ -81,7 +81,8 @@ Cycles link_latency, int bw_multiplier) { // Create a throttle - Throttle* throttle_ptr = new Throttle(m_id, m_throttles.size(), + RubySystem *rs = m_network_ptr->params()->ruby_system; + Throttle* throttle_ptr = new Throttle(m_id, rs, m_throttles.size(), link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(), this); diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh --- a/src/mem/ruby/network/simple/Throttle.hh +++ b/src/mem/ruby/network/simple/Throttle.hh @@ -52,11 +52,12 @@ class Throttle : public Consumer { public: - Throttle(int sID, NodeID node, Cycles link_latency, + Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency, int link_bandwidth_multiplier, int endpoint_bandwidth, ClockedObject *em); - Throttle(NodeID node, Cycles link_latency, int link_bandwidth_multiplier, - int endpoint_bandwidth, ClockedObject *em); + Throttle(RubySystem *rs, NodeID node, Cycles link_latency, + int link_bandwidth_multiplier, int endpoint_bandwidth, + ClockedObject *em); ~Throttle() {} std::string name() @@ -103,6 +104,7 @@ Cycles m_link_latency; int m_wakeups_wo_switch; int m_endpoint_bandwidth; + RubySystem *m_ruby_system; // Statistical variables Stats::Scalar m_link_utilization; diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc --- a/src/mem/ruby/network/simple/Throttle.cc +++ b/src/mem/ruby/network/simple/Throttle.cc @@ -46,19 +46,19 @@ static int network_message_to_size(NetworkMessage* net_msg_ptr); -Throttle::Throttle(int sID, NodeID node, Cycles link_latency, +Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency, int link_bandwidth_multiplier, int endpoint_bandwidth, ClockedObject *em) - : Consumer(em) + : Consumer(em), m_ruby_system(rs) { init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth); m_sID = sID; } -Throttle::Throttle(NodeID node, Cycles link_latency, +Throttle::Throttle(RubySystem *rs, NodeID node, Cycles link_latency, int link_bandwidth_multiplier, int endpoint_bandwidth, ClockedObject *em) - : Consumer(em) + : Consumer(em), m_ruby_system(rs) { init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth); m_sID = 0; @@ -246,8 +246,10 @@ void Throttle::collateStats() { - m_link_utilization = 100.0 * m_link_utilization_proxy - / (double(g_system_ptr->curCycle() - g_ruby_start)); + double time_delta = double(m_ruby_system->curCycle() - + RubySystem::getStartCycle()); + + m_link_utilization = 100.0 * m_link_utilization_proxy / time_delta; } void diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh --- a/src/mem/ruby/system/System.hh +++ b/src/mem/ruby/system/System.hh @@ -78,6 +78,7 @@ static bool getCooldownEnabled() { return m_cooldown_enabled; } SimpleMemory *getPhysMem() { return m_phys_mem; } + static Cycles getStartCycle() { return m_start_cycle; } const bool getAccessBackingStore() { return m_access_backing_store; } // Public Methods @@ -130,6 +131,7 @@ static bool m_warmup_enabled; static unsigned m_systems_to_warmup; static bool m_cooldown_enabled; + static Cycles m_start_cycle; SimpleMemory *m_phys_mem; const bool m_access_backing_store; diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -54,6 +54,7 @@ // of RubySystems that need to be warmed up on checkpoint restore. unsigned RubySystem::m_systems_to_warmup = 0; bool RubySystem::m_cooldown_enabled = false; +Cycles RubySystem::m_start_cycle = Cycles(0); RubySystem::RubySystem(const Params *p) : ClockedObject(p), m_access_backing_store(p->access_backing_store) @@ -338,7 +339,7 @@ void RubySystem::resetStats() { - g_ruby_start = curCycle(); + m_start_cycle = curCycle(); } bool