diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2013-09-06 16:21:35 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2013-09-06 16:21:35 -0500 |
commit | 90bfbd9793e64b29d09f4ca4ee610ee08f82ea75 (patch) | |
tree | e14b49f9632b25cde8a32b5e5787a36a376e6dff /src/mem/ruby/network/simple/SimpleNetwork.cc | |
parent | e9ae8b7d29e83fa2cad55006d2c6dc58115965cc (diff) | |
download | gem5-90bfbd9793e64b29d09f4ca4ee610ee08f82ea75.tar.xz |
ruby: network: convert to gem5 style stats
Diffstat (limited to 'src/mem/ruby/network/simple/SimpleNetwork.cc')
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.cc | 87 |
1 files changed, 25 insertions, 62 deletions
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index b71631d26..41f587d47 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -206,76 +206,39 @@ SimpleNetwork::getThrottles(NodeID id) const } void -SimpleNetwork::printStats(ostream& out) const +SimpleNetwork::regStats() { - out << endl; - out << "Network Stats" << endl; - out << "-------------" << endl; - out << endl; - - // - // Determine total counts before printing out each switch's stats - // - std::vector<uint64> total_msg_counts; - total_msg_counts.resize(MessageSizeType_NUM); - for (MessageSizeType type = MessageSizeType_FIRST; - type < MessageSizeType_NUM; - ++type) { - total_msg_counts[type] = 0; - } - - for (int i = 0; i < m_switches.size(); i++) { - const std::vector<Throttle*>* throttles = - m_switches[i]->getThrottles(); - - for (int p = 0; p < throttles->size(); p++) { - - const std::vector<std::vector<int> >& message_counts = - ((*throttles)[p])->getCounters(); - - for (MessageSizeType type = MessageSizeType_FIRST; - type < MessageSizeType_NUM; - ++type) { - - const std::vector<int> &mct = message_counts[type]; - int sum = accumulate(mct.begin(), mct.end(), 0); - total_msg_counts[type] += uint64(sum); - } - } - } - uint64 total_msgs = 0; - uint64 total_bytes = 0; - for (MessageSizeType type = MessageSizeType_FIRST; - type < MessageSizeType_NUM; - ++type) { - - if (total_msg_counts[type] > 0) { - out << "total_msg_count_" << type << ": " << total_msg_counts[type] - << " " << total_msg_counts[type] * - uint64(MessageSizeType_to_int(type)) - << endl; - - total_msgs += total_msg_counts[type]; - - total_bytes += total_msg_counts[type] * - uint64(MessageSizeType_to_int(type)); + m_msg_counts.resize(MessageSizeType_NUM); + m_msg_bytes.resize(MessageSizeType_NUM); + + for (MessageSizeType type = MessageSizeType_FIRST; + type < MessageSizeType_NUM; ++type) { + m_msg_counts[(unsigned int) type] + .name(name() + ".msg_count." + MessageSizeType_to_string(type)) + .flags(Stats::nozero) + ; + m_msg_bytes[(unsigned int) type] + .name(name() + ".msg_byte." + MessageSizeType_to_string(type)) + .flags(Stats::nozero) + ; + + // Now state what the formula is. + for (int i = 0; i < m_switches.size(); i++) { + m_msg_counts[(unsigned int) type] += + sum(m_switches[i]->getMsgCount(type)); } - } - - out << "total_msgs: " << total_msgs - << " total_bytes: " << total_bytes << endl; - - out << endl; - for (int i = 0; i < m_switches.size(); i++) { - m_switches[i]->printStats(out); + + m_msg_bytes[(unsigned int) type] = + m_msg_counts[(unsigned int) type] * Stats::constant( + Network::MessageSizeType_to_int(type)); } } void -SimpleNetwork::clearStats() +SimpleNetwork::collateStats() { for (int i = 0; i < m_switches.size(); i++) { - m_switches[i]->clearStats(); + m_switches[i]->collateStats(); } } |