46a47,48
> m_msg_counts.resize(MessageSizeType_NUM);
> m_msg_bytes.resize(MessageSizeType_NUM);
113,135d114
< void
< Switch::clearRoutingTables()
< {
< m_perfect_switch->clearRoutingTables();
< }
<
< void
< Switch::clearBuffers()
< {
< m_perfect_switch->clearBuffers();
< for (int i = 0; i < m_throttles.size(); i++) {
< if (m_throttles[i] != NULL) {
< m_throttles[i]->clear();
< }
< }
< }
<
< void
< Switch::reconfigureOutPort(const NetDest& routing_table_entry)
< {
< m_perfect_switch->reconfigureOutPort(routing_table_entry);
< }
<
150c129
< Switch::printStats(std::ostream& out) const
---
> Switch::regStats()
152,166c131,132
< ccprintf(out, "switch_%d_inlinks: %d\n", m_id,
< m_perfect_switch->getInLinks());
< ccprintf(out, "switch_%d_outlinks: %d\n", m_id,
< m_perfect_switch->getOutLinks());
<
< // Average link utilizations
< double average_utilization = 0.0;
< int throttle_count = 0;
<
< for (int i = 0; i < m_throttles.size(); i++) {
< Throttle* throttle_ptr = m_throttles[i];
< if (throttle_ptr) {
< average_utilization += throttle_ptr->getUtilization();
< throttle_count++;
< }
---
> for (int link = 0; link < m_throttles.size(); link++) {
> m_throttles[link]->regStats(name());
168,169d133
< average_utilization =
< throttle_count == 0 ? 0 : average_utilization / throttle_count;
171,183c135,137
< // Individual link utilizations
< out << "links_utilized_percent_switch_" << m_id << ": "
< << average_utilization << endl;
<
< for (int link = 0; link < m_throttles.size(); link++) {
< Throttle* throttle_ptr = m_throttles[link];
< if (throttle_ptr != NULL) {
< out << " links_utilized_percent_switch_" << m_id
< << "_link_" << link << ": "
< << throttle_ptr->getUtilization() << " bw: "
< << throttle_ptr->getLinkBandwidth()
< << " base_latency: " << throttle_ptr->getLatency() << endl;
< }
---
> m_avg_utilization.name(name() + ".percent_links_utilized");
> for (unsigned int i = 0; i < m_throttles.size(); i++) {
> m_avg_utilization += m_throttles[i]->getUtilization();
185c139
< out << endl;
---
> m_avg_utilization /= Stats::constant(m_throttles.size());
187,191c141,152
< // Traffic breakdown
< for (int link = 0; link < m_throttles.size(); link++) {
< Throttle* throttle_ptr = m_throttles[link];
< if (!throttle_ptr)
< continue;
---
> for (unsigned int type = MessageSizeType_FIRST;
> type < MessageSizeType_NUM; ++type) {
> m_msg_counts[type]
> .name(name() + ".msg_count." +
> MessageSizeType_to_string(MessageSizeType(type)))
> .flags(Stats::nozero)
> ;
> m_msg_bytes[type]
> .name(name() + ".msg_bytes." +
> MessageSizeType_to_string(MessageSizeType(type)))
> .flags(Stats::nozero)
> ;
193,208c154,155
< const vector<vector<int> >& message_counts =
< throttle_ptr->getCounters();
< for (int int_type = 0; int_type < MessageSizeType_NUM; int_type++) {
< MessageSizeType type = MessageSizeType(int_type);
< const vector<int> &mct = message_counts[type];
< int sum = accumulate(mct.begin(), mct.end(), 0);
< if (sum == 0)
< continue;
<
< out << " outgoing_messages_switch_" << m_id
< << "_link_" << link << "_" << type << ": " << sum << " "
< << sum * m_network_ptr->MessageSizeType_to_int(type)
< << " ";
< out << mct;
< out << " base_latency: "
< << throttle_ptr->getLatency() << endl;
---
> for (unsigned int i = 0; i < m_throttles.size(); i++) {
> m_msg_counts[type] += m_throttles[i]->getMsgCount(type);
209a157,158
> m_msg_bytes[type] = m_msg_counts[type] * Stats::constant(
> Network::MessageSizeType_to_int(MessageSizeType(type)));
211d159
< out << endl;
215c163
< Switch::clearStats()
---
> Switch::resetStats()
219,220c167
< if (m_throttles[i] != NULL)
< m_throttles[i]->clearStats();
---
> m_throttles[i]->clearStats();
224a172,180
> Switch::collateStats()
> {
> m_perfect_switch->collateStats();
> for (int i = 0; i < m_throttles.size(); i++) {
> m_throttles[i]->collateStats();
> }
> }
>
> void