From c38f5098b152ea1e1dde96220d3f9e50d3411780 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Fri, 10 Jul 2015 16:05:23 -0500 Subject: ruby: replace g_ruby_start with per-RubySystem m_start_cycle This patch begins the process of removing global variables from the Ruby source with the goal of eventually allowing users to create multiple Ruby instances in a single simulation. Currently, users cannot do so because several global variables and static members are referenced by the RubySystem object in a way that assumes that there will only ever be a single RubySystem. These need to be replaced with per-RubySystem equivalents. This specific patch replaces the global var g_ruby_start, which is used to calculate throughput statistics for Throttles in simple networks and links in Garnet networks, with a RubySystem instance var m_start_cycle. --- src/mem/ruby/network/simple/Throttle.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/mem/ruby/network/simple/Throttle.cc') diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc index d722c91ea..f0cd6bd16 100644 --- a/src/mem/ruby/network/simple/Throttle.cc +++ b/src/mem/ruby/network/simple/Throttle.cc @@ -46,19 +46,19 @@ const int PRIORITY_SWITCH_LIMIT = 128; static int network_message_to_size(Message* 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; @@ -245,8 +245,10 @@ Throttle::clearStats() 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() - + m_ruby_system->getStartCycle()); + + m_link_utilization = 100.0 * m_link_utilization_proxy / time_delta; } void -- cgit v1.2.3