Throttle.cc (11049:dfb0aa3f0649) Throttle.cc (11092:a51ef09e3a78)
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;

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

26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <cassert>
30
31#include "base/cast.hh"
32#include "base/cprintf.hh"
33#include "debug/RubyNetwork.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;

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

26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
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/Switch.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/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
47static int network_message_to_size(Message* net_msg_ptr);
48
49Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
50 int link_bandwidth_multiplier, int endpoint_bandwidth,
35#include "mem/ruby/network/simple/Throttle.hh"
36#include "mem/ruby/network/MessageBuffer.hh"
37#include "mem/ruby/network/Network.hh"
38#include "mem/ruby/slicc_interface/Message.hh"
39#include "mem/ruby/system/System.hh"
40
41using namespace std;
42
43const int MESSAGE_SIZE_MULTIPLIER = 1000;
44//const int BROADCAST_SCALING = 4; // Have a 16p system act like a 64p systems
45const int BROADCAST_SCALING = 1;
46const int PRIORITY_SWITCH_LIMIT = 128;
47
48static int network_message_to_size(Message* net_msg_ptr);
49
50Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
51 int link_bandwidth_multiplier, int endpoint_bandwidth,
51 ClockedObject *em)
52 : Consumer(em), m_ruby_system(rs)
52 Switch *em)
53 : Consumer(em), m_switch_id(sID), m_switch(em), m_node(node),
54 m_ruby_system(rs)
53{
55{
54 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
55 m_sID = sID;
56}
57
58Throttle::Throttle(RubySystem *rs, NodeID node, Cycles link_latency,
59 int link_bandwidth_multiplier, int endpoint_bandwidth,
60 ClockedObject *em)
61 : Consumer(em), m_ruby_system(rs)
62{
63 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
64 m_sID = 0;
65}
66
67void
68Throttle::init(NodeID node, Cycles link_latency,
69 int link_bandwidth_multiplier, int endpoint_bandwidth)
70{
71 m_node = node;
72 m_vnets = 0;
73
74 assert(link_bandwidth_multiplier > 0);
75 m_link_bandwidth_multiplier = link_bandwidth_multiplier;
76
77 m_link_latency = link_latency;
78 m_endpoint_bandwidth = endpoint_bandwidth;
79

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

93
94 m_vnets++;
95 m_units_remaining.push_back(0);
96 m_in.push_back(in_ptr);
97 m_out.push_back(out_ptr);
98
99 // Set consumer and description
100 in_ptr->setConsumer(this);
56 m_vnets = 0;
57
58 assert(link_bandwidth_multiplier > 0);
59 m_link_bandwidth_multiplier = link_bandwidth_multiplier;
60
61 m_link_latency = link_latency;
62 m_endpoint_bandwidth = endpoint_bandwidth;
63

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

77
78 m_vnets++;
79 m_units_remaining.push_back(0);
80 m_in.push_back(in_ptr);
81 m_out.push_back(out_ptr);
82
83 // Set consumer and description
84 in_ptr->setConsumer(this);
101 string desc = "[Queue to Throttle " + to_string(m_sID) + " " +
85 string desc = "[Queue to Throttle " + to_string(m_switch_id) + " " +
102 to_string(m_node) + "]";
103 }
104}
105
106void
107Throttle::operateVnet(int vnet, int &bw_remaining, bool &schedule_wakeup,
108 MessageBuffer *in, MessageBuffer *out)
109{

--- 163 unchanged lines hidden ---
86 to_string(m_node) + "]";
87 }
88}
89
90void
91Throttle::operateVnet(int vnet, int &bw_remaining, bool &schedule_wakeup,
92 MessageBuffer *in, MessageBuffer *out)
93{

--- 163 unchanged lines hidden ---