Throttle.cc (9117:49116b947194) | Throttle.cc (9171:ae88ecf37145) |
---|---|
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; --- 153 unchanged lines hidden (view full) --- 162 NetworkMessage* net_msg_ptr = 163 safe_cast<NetworkMessage*>(msg_ptr.get()); 164 m_units_remaining[vnet] += 165 network_message_to_size(net_msg_ptr); 166 167 DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent " 168 "enqueueing net msg %d time: %lld.\n", 169 m_node, getLinkBandwidth(), m_units_remaining[vnet], | 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; --- 153 unchanged lines hidden (view full) --- 162 NetworkMessage* net_msg_ptr = 163 safe_cast<NetworkMessage*>(msg_ptr.get()); 164 m_units_remaining[vnet] += 165 network_message_to_size(net_msg_ptr); 166 167 DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent " 168 "enqueueing net msg %d time: %lld.\n", 169 m_node, getLinkBandwidth(), m_units_remaining[vnet], |
170 g_eventQueue_ptr->getTime()); | 170 g_system_ptr->getTime()); |
171 172 // Move the message 173 m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency); 174 m_in[vnet]->pop(); 175 176 // Count the message 177 m_message_counters[net_msg_ptr->getMessageSize()][vnet]++; 178 --- 31 unchanged lines hidden (view full) --- 210 // available, so we must not have anything else to do until 211 // another message arrives. 212 DPRINTF(RubyNetwork, "%s not scheduled again\n", *this); 213 } else { 214 DPRINTF(RubyNetwork, "%s scheduled again\n", *this); 215 216 // We are out of bandwidth for this cycle, so wakeup next 217 // cycle and continue | 171 172 // Move the message 173 m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency); 174 m_in[vnet]->pop(); 175 176 // Count the message 177 m_message_counters[net_msg_ptr->getMessageSize()][vnet]++; 178 --- 31 unchanged lines hidden (view full) --- 210 // available, so we must not have anything else to do until 211 // another message arrives. 212 DPRINTF(RubyNetwork, "%s not scheduled again\n", *this); 213 } else { 214 DPRINTF(RubyNetwork, "%s scheduled again\n", *this); 215 216 // We are out of bandwidth for this cycle, so wakeup next 217 // cycle and continue |
218 g_eventQueue_ptr->scheduleEvent(this, 1); | 218 scheduleEvent(1); |
219 } 220} 221 222void 223Throttle::printStats(ostream& out) const 224{ 225 out << "utilized_percent: " << getUtilization() << endl; 226} 227 228void 229Throttle::clearStats() 230{ | 219 } 220} 221 222void 223Throttle::printStats(ostream& out) const 224{ 225 out << "utilized_percent: " << getUtilization() << endl; 226} 227 228void 229Throttle::clearStats() 230{ |
231 m_ruby_start = g_eventQueue_ptr->getTime(); | 231 m_ruby_start = g_system_ptr->getTime(); |
232 m_links_utilized = 0.0; 233 234 for (int i = 0; i < m_message_counters.size(); i++) { 235 for (int j = 0; j < m_message_counters[i].size(); j++) { 236 m_message_counters[i][j] = 0; 237 } 238 } 239} 240 241double 242Throttle::getUtilization() const 243{ 244 return 100.0 * double(m_links_utilized) / | 232 m_links_utilized = 0.0; 233 234 for (int i = 0; i < m_message_counters.size(); i++) { 235 for (int j = 0; j < m_message_counters[i].size(); j++) { 236 m_message_counters[i][j] = 0; 237 } 238 } 239} 240 241double 242Throttle::getUtilization() const 243{ 244 return 100.0 * double(m_links_utilized) / |
245 double(g_eventQueue_ptr->getTime()-m_ruby_start); | 245 double(g_system_ptr->getTime()-m_ruby_start); |
246} 247 248void 249Throttle::print(ostream& out) const 250{ 251 ccprintf(out, "[%i bw: %i]", m_node, getLinkBandwidth()); 252} 253 --- 15 unchanged lines hidden --- | 246} 247 248void 249Throttle::print(ostream& out) const 250{ 251 ccprintf(out, "[%i bw: %i]", m_node, getLinkBandwidth()); 252} 253 --- 15 unchanged lines hidden --- |