diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-10-11 15:02:23 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-10-11 15:02:23 -0500 |
commit | a098fad174d8559037602b248b8e6f7f46bfebbb (patch) | |
tree | 0f8891b3c884b6bb167f7cf92205ffad5e583cd1 /src/mem/ruby | |
parent | 25bb18f12b7983e46e5b0544de18445d3b60d41a (diff) | |
download | gem5-a098fad174d8559037602b248b8e6f7f46bfebbb.tar.xz |
ruby: network: garnet: add statistics for different activities
This patch adds some statistics to garnet that record the activity
of certain structures in the on-chip network. These statistics, in a later
patch, will be used for computing the energy consumed by the on-chip network.
Diffstat (limited to 'src/mem/ruby')
4 files changed, 80 insertions, 28 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc index 82d89912e..6cb60032a 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc @@ -105,3 +105,12 @@ InputUnit_d::functionalWrite(Packet *pkt) return num_functional_writes; } + +void +InputUnit_d::resetStats() +{ + for (int j = 0; j < m_num_buffer_reads.size(); j++) { + m_num_buffer_reads[j] = 0; + m_num_buffer_writes[j] = 0; + } +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh index c3dc5e69d..c9437a774 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh @@ -159,6 +159,7 @@ class InputUnit_d : public Consumer { return m_num_buffer_writes[vnet]; } uint32_t functionalWrite(Packet *pkt); + void resetStats(); private: int m_id; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc index 9f0b6c33f..126cf79e6 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc @@ -57,20 +57,6 @@ Router_d::Router_d(const Params *p) m_input_unit.clear(); m_output_unit.clear(); - - crossbar_count = 0; - sw_local_arbit_count = 0; - sw_global_arbit_count = 0; - buf_read_count.resize(m_virtual_networks); - buf_write_count.resize(m_virtual_networks); - vc_local_arbit_count.resize(m_virtual_networks); - vc_global_arbit_count.resize(m_virtual_networks); - for (int i = 0; i < m_virtual_networks; i++) { - buf_read_count[i] = 0; - buf_write_count[i] = 0; - vc_local_arbit_count[i] = 0; - vc_global_arbit_count[i] = 0; - } } Router_d::~Router_d() @@ -158,21 +144,70 @@ Router_d::update_sw_winner(int inport, flit_d *t_flit) } void +Router_d::regStats() +{ + m_buffer_reads + .name(name() + ".buffer_reads") + .flags(Stats::nozero) + ; + + m_buffer_writes + .name(name() + ".buffer_writes") + .flags(Stats::nozero) + ; + + m_crossbar_activity + .name(name() + ".crossbar_activity") + .flags(Stats::nozero) + ; + + m_sw_local_arbiter_activity + .name(name() + ".sw_local_arbiter_activity") + .flags(Stats::nozero) + ; + + m_sw_global_arbiter_activity + .name(name() + ".sw_global_arbiter_activity") + .flags(Stats::nozero) + ; + + m_vc_local_arbiter_activity + .name(name() + ".vc_local_arbiter_activity") + .flags(Stats::nozero) + ; + + m_vc_global_arbiter_activity + .name(name() + ".vc_global_arbiter_activity") + .flags(Stats::nozero) + ; +} + +void Router_d::collateStats() { for (int j = 0; j < m_virtual_networks; j++) { for (int i = 0; i < m_input_unit.size(); i++) { - buf_read_count[j] += m_input_unit[i]->get_buf_read_count(j); - buf_write_count[j] += m_input_unit[i]->get_buf_write_count(j); + m_buffer_reads += m_input_unit[i]->get_buf_read_count(j); + m_buffer_writes += m_input_unit[i]->get_buf_write_count(j); } - vc_local_arbit_count[j] = m_vc_alloc->get_local_arbit_count(j); - vc_global_arbit_count[j] = m_vc_alloc->get_global_arbit_count(j); + m_vc_local_arbiter_activity += m_vc_alloc->get_local_arbit_count(j); + m_vc_global_arbiter_activity += m_vc_alloc->get_global_arbit_count(j); } - sw_local_arbit_count = m_sw_alloc->get_local_arbit_count(); - sw_global_arbit_count = m_sw_alloc->get_global_arbit_count(); - crossbar_count = m_switch->get_crossbar_count(); + m_sw_local_arbiter_activity = m_sw_alloc->get_local_arbit_count(); + m_sw_global_arbiter_activity = m_sw_alloc->get_global_arbit_count(); + m_crossbar_activity = m_switch->get_crossbar_count(); +} + +void +Router_d::resetStats() +{ + for (int j = 0; j < m_virtual_networks; j++) { + for (int i = 0; i < m_input_unit.size(); i++) { + m_input_unit[i]->resetStats(); + } + } } void diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh index 931455e43..5d09fb045 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh @@ -88,7 +88,10 @@ class Router_d : public BasicRouter void printFaultVector(std::ostream& out); void printAggregateFaultProbability(std::ostream& out); + + void regStats(); void collateStats(); + void resetStats(); bool get_fault_vector(int temperature, float fault_vector[]){ return m_network_ptr->fault_model->fault_vector(m_id, temperature, @@ -105,8 +108,6 @@ class Router_d : public BasicRouter private: int m_virtual_networks, m_num_vcs, m_vc_per_vnet; GarnetNetwork_d *m_network_ptr; - double sw_local_arbit_count, sw_global_arbit_count; - double crossbar_count; std::vector<InputUnit_d *> m_input_unit; std::vector<OutputUnit_d *> m_output_unit; @@ -115,11 +116,17 @@ class Router_d : public BasicRouter SWallocator_d *m_sw_alloc; Switch_d *m_switch; - // Statistical variables for performance - std::vector<double> buf_read_count; - std::vector<double> buf_write_count; - std::vector<double> vc_local_arbit_count; - std::vector<double> vc_global_arbit_count; + // Statistical variables required for power computations + Stats::Scalar m_buffer_reads; + Stats::Scalar m_buffer_writes; + + Stats::Scalar m_sw_local_arbiter_activity; + Stats::Scalar m_sw_global_arbiter_activity; + + Stats::Scalar m_vc_local_arbiter_activity; + Stats::Scalar m_vc_global_arbiter_activity; + + Stats::Scalar m_crossbar_activity; }; #endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__ |