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.
This commit is contained in:
Nilay Vaish 2014-10-11 15:02:23 -05:00
parent 25bb18f12b
commit a098fad174
4 changed files with 80 additions and 28 deletions

View file

@ -105,3 +105,12 @@ InputUnit_d::functionalWrite(Packet *pkt)
return num_functional_writes; 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;
}
}

View file

@ -159,6 +159,7 @@ class InputUnit_d : public Consumer
{ return m_num_buffer_writes[vnet]; } { return m_num_buffer_writes[vnet]; }
uint32_t functionalWrite(Packet *pkt); uint32_t functionalWrite(Packet *pkt);
void resetStats();
private: private:
int m_id; int m_id;

View file

@ -57,20 +57,6 @@ Router_d::Router_d(const Params *p)
m_input_unit.clear(); m_input_unit.clear();
m_output_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() Router_d::~Router_d()
@ -157,22 +143,71 @@ Router_d::update_sw_winner(int inport, flit_d *t_flit)
m_switch->scheduleEventAbsolute(clockEdge(Cycles(1))); m_switch->scheduleEventAbsolute(clockEdge(Cycles(1)));
} }
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 void
Router_d::collateStats() Router_d::collateStats()
{ {
for (int j = 0; j < m_virtual_networks; j++) { for (int j = 0; j < m_virtual_networks; j++) {
for (int i = 0; i < m_input_unit.size(); i++) { for (int i = 0; i < m_input_unit.size(); i++) {
buf_read_count[j] += m_input_unit[i]->get_buf_read_count(j); m_buffer_reads += m_input_unit[i]->get_buf_read_count(j);
buf_write_count[j] += m_input_unit[i]->get_buf_write_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); m_vc_local_arbiter_activity += m_vc_alloc->get_local_arbit_count(j);
vc_global_arbit_count[j] = m_vc_alloc->get_global_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(); m_sw_local_arbiter_activity = m_sw_alloc->get_local_arbit_count();
sw_global_arbit_count = m_sw_alloc->get_global_arbit_count(); m_sw_global_arbiter_activity = m_sw_alloc->get_global_arbit_count();
crossbar_count = m_switch->get_crossbar_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 void

View file

@ -88,7 +88,10 @@ class Router_d : public BasicRouter
void printFaultVector(std::ostream& out); void printFaultVector(std::ostream& out);
void printAggregateFaultProbability(std::ostream& out); void printAggregateFaultProbability(std::ostream& out);
void regStats();
void collateStats(); void collateStats();
void resetStats();
bool get_fault_vector(int temperature, float fault_vector[]){ bool get_fault_vector(int temperature, float fault_vector[]){
return m_network_ptr->fault_model->fault_vector(m_id, temperature, return m_network_ptr->fault_model->fault_vector(m_id, temperature,
@ -105,8 +108,6 @@ class Router_d : public BasicRouter
private: private:
int m_virtual_networks, m_num_vcs, m_vc_per_vnet; int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
GarnetNetwork_d *m_network_ptr; 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<InputUnit_d *> m_input_unit;
std::vector<OutputUnit_d *> m_output_unit; std::vector<OutputUnit_d *> m_output_unit;
@ -115,11 +116,17 @@ class Router_d : public BasicRouter
SWallocator_d *m_sw_alloc; SWallocator_d *m_sw_alloc;
Switch_d *m_switch; Switch_d *m_switch;
// Statistical variables for performance // Statistical variables required for power computations
std::vector<double> buf_read_count; Stats::Scalar m_buffer_reads;
std::vector<double> buf_write_count; Stats::Scalar m_buffer_writes;
std::vector<double> vc_local_arbit_count;
std::vector<double> vc_global_arbit_count; 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__ #endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__