Throttle.cc (7454:3a3e8e8cce1b) | Throttle.cc (7780:42da07116e12) |
---|---|
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; --- 147 unchanged lines hidden (view full) --- 156 if (m_units_remaining[vnet] == 0 && m_in[vnet]->isReady()) { 157 // Find the size of the message we are moving 158 MsgPtr msg_ptr = m_in[vnet]->peekMsgPtr(); 159 NetworkMessage* net_msg_ptr = 160 safe_cast<NetworkMessage*>(msg_ptr.get()); 161 m_units_remaining[vnet] += 162 network_message_to_size(net_msg_ptr); 163 | 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; --- 147 unchanged lines hidden (view full) --- 156 if (m_units_remaining[vnet] == 0 && m_in[vnet]->isReady()) { 157 // Find the size of the message we are moving 158 MsgPtr msg_ptr = m_in[vnet]->peekMsgPtr(); 159 NetworkMessage* net_msg_ptr = 160 safe_cast<NetworkMessage*>(msg_ptr.get()); 161 m_units_remaining[vnet] += 162 network_message_to_size(net_msg_ptr); 163 |
164 DEBUG_NEWLINE(NETWORK_COMP,HighPrio); 165 DEBUG_MSG(NETWORK_COMP, HighPrio, 166 csprintf("throttle: %d my bw %d bw spent enqueueing " 167 "net msg %d time: %d.", | 164 DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent " 165 "enqueueing net msg %d time: %lld.\n", |
168 m_node, getLinkBandwidth(), m_units_remaining[vnet], | 166 m_node, getLinkBandwidth(), m_units_remaining[vnet], |
169 g_eventQueue_ptr->getTime())); | 167 g_eventQueue_ptr->getTime()); |
170 171 // Move the message 172 m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency); 173 m_in[vnet]->pop(); 174 175 // Count the message 176 m_message_counters[net_msg_ptr->getMessageSize()][vnet]++; 177 | 168 169 // Move the message 170 m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency); 171 m_in[vnet]->pop(); 172 173 // Count the message 174 m_message_counters[net_msg_ptr->getMessageSize()][vnet]++; 175 |
178 DEBUG_MSG(NETWORK_COMP,LowPrio,*m_out[vnet]); 179 DEBUG_NEWLINE(NETWORK_COMP,HighPrio); | 176 DPRINTF(RubyNetwork, "%s\n", *m_out[vnet]); |
180 } 181 182 // Calculate the amount of bandwidth we spent on this message 183 int diff = m_units_remaining[vnet] - bw_remaining; 184 m_units_remaining[vnet] = max(0, diff); 185 bw_remaining = max(0, -diff); 186 } 187 188 if (bw_remaining > 0 && 189 (m_in[vnet]->isReady() || m_units_remaining[vnet] > 0) && 190 !m_out[vnet]->areNSlotsAvailable(1)) { | 177 } 178 179 // Calculate the amount of bandwidth we spent on this message 180 int diff = m_units_remaining[vnet] - bw_remaining; 181 m_units_remaining[vnet] = max(0, diff); 182 bw_remaining = max(0, -diff); 183 } 184 185 if (bw_remaining > 0 && 186 (m_in[vnet]->isReady() || m_units_remaining[vnet] > 0) && 187 !m_out[vnet]->areNSlotsAvailable(1)) { |
191 DEBUG_MSG(NETWORK_COMP,LowPrio,vnet); | 188 DPRINTF(RubyNetwork, "vnet: %d", vnet); |
192 // schedule me to wakeup again because I'm waiting for my 193 // output queue to become available 194 schedule_wakeup = true; 195 } 196 } 197 198 // We should only wake up when we use the bandwidth 199 // This is only mostly true --- 4 unchanged lines hidden (view full) --- 204 205 // If ratio = 0, we used no bandwidth, if ratio = 1, we used all 206 linkUtilized(ratio); 207 208 if (bw_remaining > 0 && !schedule_wakeup) { 209 // We have extra bandwidth and our output buffer was 210 // available, so we must not have anything else to do until 211 // another message arrives. | 189 // schedule me to wakeup again because I'm waiting for my 190 // output queue to become available 191 schedule_wakeup = true; 192 } 193 } 194 195 // We should only wake up when we use the bandwidth 196 // This is only mostly true --- 4 unchanged lines hidden (view full) --- 201 202 // If ratio = 0, we used no bandwidth, if ratio = 1, we used all 203 linkUtilized(ratio); 204 205 if (bw_remaining > 0 && !schedule_wakeup) { 206 // We have extra bandwidth and our output buffer was 207 // available, so we must not have anything else to do until 208 // another message arrives. |
212 DEBUG_MSG(NETWORK_COMP, LowPrio, *this); 213 DEBUG_MSG(NETWORK_COMP, LowPrio, "not scheduled again"); | 209 DPRINTF(RubyNetwork, "%s not scheduled again\n", *this); |
214 } else { | 210 } else { |
215 DEBUG_MSG(NETWORK_COMP, LowPrio, *this); 216 DEBUG_MSG(NETWORK_COMP, LowPrio, "scheduled again"); | 211 DPRINTF(RubyNetwork, "%s scheduled again\n", *this); |
217 218 // We are out of bandwidth for this cycle, so wakeup next 219 // cycle and continue 220 g_eventQueue_ptr->scheduleEvent(this, 1); 221 } 222} 223 224void --- 52 unchanged lines hidden --- | 212 213 // We are out of bandwidth for this cycle, so wakeup next 214 // cycle and continue 215 g_eventQueue_ptr->scheduleEvent(this, 1); 216 } 217} 218 219void --- 52 unchanged lines hidden --- |