SimpleNetwork.cc (7455:586f99bf0dc4) | SimpleNetwork.cc (7547:a5ddcb2abfa1) |
---|---|
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; --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 | 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; --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 |
29#include <numeric> 30 |
|
29#include "base/stl_helpers.hh" 30#include "mem/protocol/MachineType.hh" 31#include "mem/protocol/Protocol.hh" 32#include "mem/protocol/TopologyType.hh" 33#include "mem/ruby/buffers/MessageBuffer.hh" 34#include "mem/ruby/common/NetDest.hh" 35#include "mem/ruby/network/simple/SimpleNetwork.hh" 36#include "mem/ruby/network/simple/Switch.hh" | 31#include "base/stl_helpers.hh" 32#include "mem/protocol/MachineType.hh" 33#include "mem/protocol/Protocol.hh" 34#include "mem/protocol/TopologyType.hh" 35#include "mem/ruby/buffers/MessageBuffer.hh" 36#include "mem/ruby/common/NetDest.hh" 37#include "mem/ruby/network/simple/SimpleNetwork.hh" 38#include "mem/ruby/network/simple/Switch.hh" |
39#include "mem/ruby/network/simple/Throttle.hh" |
|
37#include "mem/ruby/network/simple/Topology.hh" 38#include "mem/ruby/profiler/Profiler.hh" 39#include "mem/ruby/system/System.hh" 40 41using namespace std; 42using m5::stl_helpers::deletePointers; 43 44#if 0 --- 184 unchanged lines hidden (view full) --- 229 230void 231SimpleNetwork::printStats(ostream& out) const 232{ 233 out << endl; 234 out << "Network Stats" << endl; 235 out << "-------------" << endl; 236 out << endl; | 40#include "mem/ruby/network/simple/Topology.hh" 41#include "mem/ruby/profiler/Profiler.hh" 42#include "mem/ruby/system/System.hh" 43 44using namespace std; 45using m5::stl_helpers::deletePointers; 46 47#if 0 --- 184 unchanged lines hidden (view full) --- 232 233void 234SimpleNetwork::printStats(ostream& out) const 235{ 236 out << endl; 237 out << "Network Stats" << endl; 238 out << "-------------" << endl; 239 out << endl; |
240 241 // 242 // Determine total counts before printing out each switch's stats 243 // 244 std::vector<uint64> total_msg_counts; 245 total_msg_counts.resize(MessageSizeType_NUM); 246 for (MessageSizeType type = MessageSizeType_FIRST; 247 type < MessageSizeType_NUM; 248 ++type) { 249 total_msg_counts[type] = 0; 250 } 251 |
|
237 for (int i = 0; i < m_switch_ptr_vector.size(); i++) { | 252 for (int i = 0; i < m_switch_ptr_vector.size(); i++) { |
253 const std::vector<Throttle*>* throttles = 254 m_switch_ptr_vector[i]->getThrottles(); 255 256 for (int p = 0; p < throttles->size(); p++) { 257 258 const std::vector<std::vector<int> >& message_counts = 259 ((*throttles)[p])->getCounters(); 260 261 for (MessageSizeType type = MessageSizeType_FIRST; 262 type < MessageSizeType_NUM; 263 ++type) { 264 265 const std::vector<int> &mct = message_counts[type]; 266 int sum = accumulate(mct.begin(), mct.end(), 0); 267 total_msg_counts[type] += uint64(sum); 268 } 269 } 270 } 271 uint64 total_msgs = 0; 272 uint64 total_bytes = 0; 273 for (MessageSizeType type = MessageSizeType_FIRST; 274 type < MessageSizeType_NUM; 275 ++type) { 276 277 if (total_msg_counts[type] > 0) { 278 out << "total_msg_count_" << type << ": " << total_msg_counts[type] 279 << " " << total_msg_counts[type] * 280 uint64(RubySystem::getNetwork()->MessageSizeType_to_int(type)) 281 << endl; 282 283 total_msgs += total_msg_counts[type]; 284 285 total_bytes += total_msg_counts[type] * 286 uint64(RubySystem::getNetwork()->MessageSizeType_to_int(type)); 287 288 } 289 } 290 291 out << "total_msgs: " << total_msgs 292 << " total_bytes: " << total_bytes << endl; 293 294 out << endl; 295 for (int i = 0; i < m_switch_ptr_vector.size(); i++) { |
|
238 m_switch_ptr_vector[i]->printStats(out); 239 } 240 m_topology_ptr->printStats(out); 241} 242 243void 244SimpleNetwork::clearStats() 245{ --- 50 unchanged lines hidden --- | 296 m_switch_ptr_vector[i]->printStats(out); 297 } 298 m_topology_ptr->printStats(out); 299} 300 301void 302SimpleNetwork::clearStats() 303{ --- 50 unchanged lines hidden --- |