ruby: replaces Time with Cycles in many places

The patch started of with replacing Time with Cycles in the Consumer class.
But to get ruby to compile, the rest of the changes had to be carried out.
Subsequent patches will further this process, till we completely replace
Time with Cycles.
This commit is contained in:
Nilay Vaish
2013-02-10 21:26:24 -06:00
parent affd77ea77
commit d3aebe1f91
67 changed files with 218 additions and 199 deletions

View File

@@ -267,7 +267,7 @@ PerfectSwitch::wakeup()
// There were not enough resources
if (!enough) {
scheduleEvent(1);
scheduleEvent(Cycles(1));
DPRINTF(RubyNetwork, "Can't deliver message since a node "
"is blocked\n");
DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr));

View File

@@ -72,12 +72,12 @@ Switch::addInPort(const vector<MessageBuffer*>& in)
void
Switch::addOutPort(const vector<MessageBuffer*>& out,
const NetDest& routing_table_entry, int link_latency, int bw_multiplier)
const NetDest& routing_table_entry, Cycles link_latency, int bw_multiplier)
{
// Create a throttle
Throttle* throttle_ptr = new Throttle(m_id, m_throttles.size(),
link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(),
this);
link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(),
this);
m_throttles.push_back(throttle_ptr);
// Create one buffer per vnet (these are intermediaryQueues)

View File

@@ -63,7 +63,7 @@ class Switch : public BasicRouter
void init();
void addInPort(const std::vector<MessageBuffer*>& in);
void addOutPort(const std::vector<MessageBuffer*>& out,
const NetDest& routing_table_entry, int link_latency,
const NetDest& routing_table_entry, Cycles link_latency,
int bw_multiplier);
const Throttle* getThrottle(LinkID link_number) const;
const std::vector<Throttle*>* getThrottles() const;

View File

@@ -48,7 +48,7 @@ const int PRIORITY_SWITCH_LIMIT = 128;
static int network_message_to_size(NetworkMessage* net_msg_ptr);
Throttle::Throttle(int sID, NodeID node, int link_latency,
Throttle::Throttle(int sID, NodeID node, Cycles link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
ClockedObject *em)
: Consumer(em)
@@ -57,7 +57,7 @@ Throttle::Throttle(int sID, NodeID node, int link_latency,
m_sID = sID;
}
Throttle::Throttle(NodeID node, int link_latency,
Throttle::Throttle(NodeID node, Cycles link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
ClockedObject *em)
: Consumer(em)
@@ -67,8 +67,8 @@ Throttle::Throttle(NodeID node, int link_latency,
}
void
Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier,
int endpoint_bandwidth)
Throttle::init(NodeID node, Cycles link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth)
{
m_node = node;
m_vnets = 0;
@@ -222,7 +222,7 @@ Throttle::wakeup()
// We are out of bandwidth for this cycle, so wakeup next
// cycle and continue
scheduleEvent(1);
scheduleEvent(Cycles(1));
}
}

View File

@@ -52,10 +52,10 @@ class MessageBuffer;
class Throttle : public Consumer
{
public:
Throttle(int sID, NodeID node, int link_latency,
Throttle(int sID, NodeID node, Cycles link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
ClockedObject *em);
Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier,
Throttle(NodeID node, Cycles link_latency, int link_bandwidth_multiplier,
int endpoint_bandwidth, ClockedObject *em);
~Throttle() {}
@@ -70,13 +70,10 @@ class Throttle : public Consumer
void clearStats();
// The average utilization (a percent) since last clearStats()
double getUtilization() const;
int
getLinkBandwidth() const
{
return m_endpoint_bandwidth * m_link_bandwidth_multiplier;
}
int getLatency() const { return m_link_latency; }
int getLinkBandwidth() const
{ return m_endpoint_bandwidth * m_link_bandwidth_multiplier; }
Cycles getLatency() const { return m_link_latency; }
const std::vector<std::vector<int> >&
getCounters() const
{
@@ -88,7 +85,7 @@ class Throttle : public Consumer
void print(std::ostream& out) const;
private:
void init(NodeID node, int link_latency, int link_bandwidth_multiplier,
void init(NodeID node, Cycles link_latency, int link_bandwidth_multiplier,
int endpoint_bandwidth);
void addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr,
ClockedObject *em);
@@ -106,7 +103,7 @@ class Throttle : public Consumer
int m_sID;
NodeID m_node;
int m_link_bandwidth_multiplier;
int m_link_latency;
Cycles m_link_latency;
int m_wakeups_wo_switch;
int m_endpoint_bandwidth;