Throttle.cc (9275:ef43e69c837a) Throttle.cc (9465:4ae4f3f4b870)
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;

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

45//const int BROADCAST_SCALING = 4; // Have a 16p system act like a 64p systems
46const int BROADCAST_SCALING = 1;
47const int PRIORITY_SWITCH_LIMIT = 128;
48
49static int network_message_to_size(NetworkMessage* net_msg_ptr);
50
51Throttle::Throttle(int sID, NodeID node, int link_latency,
52 int link_bandwidth_multiplier, int endpoint_bandwidth,
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;

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

45//const int BROADCAST_SCALING = 4; // Have a 16p system act like a 64p systems
46const int BROADCAST_SCALING = 1;
47const int PRIORITY_SWITCH_LIMIT = 128;
48
49static int network_message_to_size(NetworkMessage* net_msg_ptr);
50
51Throttle::Throttle(int sID, NodeID node, int link_latency,
52 int link_bandwidth_multiplier, int endpoint_bandwidth,
53 EventManager *em)
53 ClockedObject *em)
54 : Consumer(em)
55{
56 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
57 m_sID = sID;
58}
59
60Throttle::Throttle(NodeID node, int link_latency,
61 int link_bandwidth_multiplier, int endpoint_bandwidth,
54 : Consumer(em)
55{
56 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
57 m_sID = sID;
58}
59
60Throttle::Throttle(NodeID node, int link_latency,
61 int link_bandwidth_multiplier, int endpoint_bandwidth,
62 EventManager *em)
62 ClockedObject *em)
63 : Consumer(em)
64{
65 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
66 m_sID = 0;
67}
68
69void
70Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier,

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

88 for (int counter = 0; counter < m_vnets; counter++) {
89 m_in[counter]->clear();
90 m_out[counter]->clear();
91 }
92}
93
94void
95Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
63 : Consumer(em)
64{
65 init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
66 m_sID = 0;
67}
68
69void
70Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier,

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

88 for (int counter = 0; counter < m_vnets; counter++) {
89 m_in[counter]->clear();
90 m_out[counter]->clear();
91 }
92}
93
94void
95Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
96 const std::vector& out_vec)
96 const std::vector<MessageBuffer*>& out_vec, ClockedObject *em)
97{
98 assert(in_vec.size() == out_vec.size());
99 for (int i=0; i<in_vec.size(); i++) {
97{
98 assert(in_vec.size() == out_vec.size());
99 for (int i=0; i<in_vec.size(); i++) {
100 addVirtualNetwork(in_vec[i], out_vec[i]);
100 addVirtualNetwork(in_vec[i], out_vec[i], em);
101 }
102
103 m_message_counters.resize(MessageSizeType_NUM);
104 for (int i = 0; i < MessageSizeType_NUM; i++) {
105 m_message_counters[i].resize(in_vec.size());
106 for (int j = 0; j<m_message_counters[i].size(); j++) {
107 m_message_counters[i][j] = 0;
108 }
109 }
110}
111
112void
101 }
102
103 m_message_counters.resize(MessageSizeType_NUM);
104 for (int i = 0; i < MessageSizeType_NUM; i++) {
105 m_message_counters[i].resize(in_vec.size());
106 for (int j = 0; j<m_message_counters[i].size(); j++) {
107 m_message_counters[i][j] = 0;
108 }
109 }
110}
111
112void
113Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
113Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr,
114 ClockedObject *em)
114{
115 m_units_remaining.push_back(0);
116 m_in.push_back(in_ptr);
117 m_out.push_back(out_ptr);
118
119 // Set consumer and description
120 m_in[m_vnets]->setConsumer(this);
115{
116 m_units_remaining.push_back(0);
117 m_in.push_back(in_ptr);
118 m_out.push_back(out_ptr);
119
120 // Set consumer and description
121 m_in[m_vnets]->setConsumer(this);
122 m_in[m_vnets]->setClockObj(em);
123
121 string desc = "[Queue to Throttle " + to_string(m_sID) + " " +
122 to_string(m_node) + "]";
123 m_in[m_vnets]->setDescription(desc);
124 m_vnets++;
125}
126
127void
128Throttle::wakeup()

--- 143 unchanged lines hidden ---
124 string desc = "[Queue to Throttle " + to_string(m_sID) + " " +
125 to_string(m_node) + "]";
126 m_in[m_vnets]->setDescription(desc);
127 m_vnets++;
128}
129
130void
131Throttle::wakeup()

--- 143 unchanged lines hidden ---