Throttle.cc (10370:4466307b8a2a) Throttle.cc (10895:287285860dd6)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29#include <cassert>
30
31#include "base/cast.hh"
32#include "base/cprintf.hh"
33#include "debug/RubyNetwork.hh"
34#include "mem/ruby/network/simple/Throttle.hh"
35#include "mem/ruby/network/MessageBuffer.hh"
36#include "mem/ruby/network/Network.hh"
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29#include <cassert>
30
31#include "base/cast.hh"
32#include "base/cprintf.hh"
33#include "debug/RubyNetwork.hh"
34#include "mem/ruby/network/simple/Throttle.hh"
35#include "mem/ruby/network/MessageBuffer.hh"
36#include "mem/ruby/network/Network.hh"
37#include "mem/ruby/slicc_interface/NetworkMessage.hh"
37#include "mem/ruby/slicc_interface/Message.hh"
38#include "mem/ruby/system/System.hh"
39
40using namespace std;
41
42const int MESSAGE_SIZE_MULTIPLIER = 1000;
43//const int BROADCAST_SCALING = 4; // Have a 16p system act like a 64p systems
44const int BROADCAST_SCALING = 1;
45const int PRIORITY_SWITCH_LIMIT = 128;
46
38#include "mem/ruby/system/System.hh"
39
40using namespace std;
41
42const int MESSAGE_SIZE_MULTIPLIER = 1000;
43//const int BROADCAST_SCALING = 4; // Have a 16p system act like a 64p systems
44const int BROADCAST_SCALING = 1;
45const int PRIORITY_SWITCH_LIMIT = 128;
46
47static int network_message_to_size(NetworkMessage* net_msg_ptr);
47static int network_message_to_size(Message* net_msg_ptr);
48
49Throttle::Throttle(int sID, NodeID node, Cycles link_latency,
50 int link_bandwidth_multiplier, int endpoint_bandwidth,
51 ClockedObject *em)
52 : Consumer(em)
53{
54 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
55 m_sID = sID;

--- 60 unchanged lines hidden (view full) ---

116 while (bw_remaining > 0 && (in->isReady() || m_units_remaining[vnet] > 0) &&
117 out->areNSlotsAvailable(1)) {
118
119 // See if we are done transferring the previous message on
120 // this virtual network
121 if (m_units_remaining[vnet] == 0 && in->isReady()) {
122 // Find the size of the message we are moving
123 MsgPtr msg_ptr = in->peekMsgPtr();
48
49Throttle::Throttle(int sID, NodeID node, Cycles link_latency,
50 int link_bandwidth_multiplier, int endpoint_bandwidth,
51 ClockedObject *em)
52 : Consumer(em)
53{
54 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
55 m_sID = sID;

--- 60 unchanged lines hidden (view full) ---

116 while (bw_remaining > 0 && (in->isReady() || m_units_remaining[vnet] > 0) &&
117 out->areNSlotsAvailable(1)) {
118
119 // See if we are done transferring the previous message on
120 // this virtual network
121 if (m_units_remaining[vnet] == 0 && in->isReady()) {
122 // Find the size of the message we are moving
123 MsgPtr msg_ptr = in->peekMsgPtr();
124 NetworkMessage* net_msg_ptr =
125 safe_cast<NetworkMessage*>(msg_ptr.get());
124 Message *net_msg_ptr = msg_ptr.get();
126 m_units_remaining[vnet] +=
127 network_message_to_size(net_msg_ptr);
128
129 DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent "
130 "enqueueing net msg %d time: %lld.\n",
131 m_node, getLinkBandwidth(), m_units_remaining[vnet],
132 g_system_ptr->curCycle());
133

--- 118 unchanged lines hidden (view full) ---

252
253void
254Throttle::print(ostream& out) const
255{
256 ccprintf(out, "[%i bw: %i]", m_node, getLinkBandwidth());
257}
258
259int
125 m_units_remaining[vnet] +=
126 network_message_to_size(net_msg_ptr);
127
128 DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent "
129 "enqueueing net msg %d time: %lld.\n",
130 m_node, getLinkBandwidth(), m_units_remaining[vnet],
131 g_system_ptr->curCycle());
132

--- 118 unchanged lines hidden (view full) ---

251
252void
253Throttle::print(ostream& out) const
254{
255 ccprintf(out, "[%i bw: %i]", m_node, getLinkBandwidth());
256}
257
258int
260network_message_to_size(NetworkMessage* net_msg_ptr)
259network_message_to_size(Message *net_msg_ptr)
261{
262 assert(net_msg_ptr != NULL);
263
264 int size = Network::MessageSizeType_to_int(net_msg_ptr->getMessageSize());
265 size *= MESSAGE_SIZE_MULTIPLIER;
266
267 // Artificially increase the size of broadcast messages
268 if (BROADCAST_SCALING > 1 && net_msg_ptr->getDestination().isBroadcast())
269 size *= BROADCAST_SCALING;
270
271 return size;
272}
260{
261 assert(net_msg_ptr != NULL);
262
263 int size = Network::MessageSizeType_to_int(net_msg_ptr->getMessageSize());
264 size *= MESSAGE_SIZE_MULTIPLIER;
265
266 // Artificially increase the size of broadcast messages
267 if (BROADCAST_SCALING > 1 && net_msg_ptr->getDestination().isBroadcast())
268 size *= BROADCAST_SCALING;
269
270 return size;
271}