summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/garnet')
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.cc107
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.hh24
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc103
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh23
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh21
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc12
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh19
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh20
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh23
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc60
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh9
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc19
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh19
14 files changed, 213 insertions, 250 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
index 3e70900dc..1082a15fb 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
@@ -71,17 +71,9 @@ BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
m_in_use.resize(m_virtual_networks);
m_ordered.resize(m_virtual_networks);
- m_flits_received.resize(m_virtual_networks);
- m_flits_injected.resize(m_virtual_networks);
- m_network_latency.resize(m_virtual_networks);
- m_queueing_latency.resize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++) {
m_in_use[i] = false;
m_ordered[i] = false;
- m_flits_received[i] = 0;
- m_flits_injected[i] = 0;
- m_network_latency[i] = 0.0;
- m_queueing_latency[i] = 0.0;
}
for (int node = 0; node < m_nodes; node++) {
@@ -121,60 +113,55 @@ BaseGarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num,
}
void
-BaseGarnetNetwork::clearStats()
+BaseGarnetNetwork::regStats()
{
-}
-
-void
-BaseGarnetNetwork::printStats(ostream& out) const
-{
- out << endl;
- out << "Network Stats" << endl;
- out << "-------------" << endl;
- out << endl;
- printPerformanceStats(out);
- printLinkStats(out);
- printPowerStats(out);
-}
-
-void
-BaseGarnetNetwork::printPerformanceStats(ostream& out) const
-{
- int total_flits_injected = 0;
- int total_flits_received = 0;
- int total_network_latency = 0.0;
- int total_queueing_latency = 0.0;
+ m_flits_received
+ .init(m_virtual_networks)
+ .name(name() + ".flits_received")
+ .flags(Stats::pdf | Stats::total | Stats::nozero | Stats::oneline)
+ ;
+
+ m_flits_injected
+ .init(m_virtual_networks)
+ .name(name() + ".flits_injected")
+ .flags(Stats::pdf | Stats::total | Stats::nozero | Stats::oneline)
+ ;
+
+ m_network_latency
+ .init(m_virtual_networks)
+ .name(name() + ".network_latency")
+ .flags(Stats::oneline)
+ ;
+
+ m_queueing_latency
+ .init(m_virtual_networks)
+ .name(name() + ".queueing_latency")
+ .flags(Stats::oneline)
+ ;
for (int i = 0; i < m_virtual_networks; i++) {
- if (!m_in_use[i])
- continue;
-
- out << "[Vnet " << i << "]: flits injected = "
- << m_flits_injected[i] << endl;
- out << "[Vnet " << i << "]: flits received = "
- << m_flits_received[i] << endl;
- out << "[Vnet " << i << "]: average network latency = "
- << ((double) m_network_latency[i] / (double) m_flits_received[i])
- << endl;
- out << "[Vnet " << i << "]: average queueing (at source NI) latency = "
- << ((double) m_queueing_latency[i] / (double) m_flits_received[i])
- << endl;
-
- out << endl;
- total_flits_injected += m_flits_injected[i];
- total_flits_received += m_flits_received[i];
- total_network_latency += m_network_latency[i];
- total_queueing_latency += m_queueing_latency[i];
+ m_flits_received.subname(i, csprintf("vnet-%i", i));
+ m_flits_injected.subname(i, csprintf("vnet-%i", i));
+ m_network_latency.subname(i, csprintf("vnet-%i", i));
+ m_queueing_latency.subname(i, csprintf("vnet-%i", i));
}
- out << "Total flits injected = " << total_flits_injected << endl;
- out << "Total flits received = " << total_flits_received << endl;
- out << "Average network latency = "
- << ((double) total_network_latency/ (double) total_flits_received) << endl;
- out << "Average queueing (at source NI) latency = "
- << ((double) total_queueing_latency/ (double) total_flits_received) << endl;
- out << "Average latency = "
- << ((double) (total_queueing_latency + total_network_latency) /
- (double) total_flits_received)<< endl;
- out << "-------------" << endl;
- out << endl;
+
+ m_avg_vnet_latency
+ .name(name() + ".average_vnet_latency")
+ .flags(Stats::oneline);
+ m_avg_vnet_latency = m_network_latency / m_flits_received;
+
+ m_avg_vqueue_latency
+ .name(name() + ".average_vqueue_latency")
+ .flags(Stats::oneline);
+ m_avg_vqueue_latency = m_queueing_latency / m_flits_received;
+
+ m_avg_network_latency.name(name() + ".average_network_latency");
+ m_avg_network_latency = sum(m_network_latency) / sum(m_flits_received);
+
+ m_avg_queueing_latency.name(name() + ".average_queueing_latency");
+ m_avg_queueing_latency = sum(m_queueing_latency) / sum(m_flits_received);
+
+ m_avg_latency.name(name() + ".average_latency");
+ m_avg_latency = m_avg_network_latency + m_avg_queueing_latency;
}
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
index b9f86df59..57d4cc581 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
@@ -80,27 +80,31 @@ class BaseGarnetNetwork : public Network
virtual void checkNetworkAllocation(NodeID id, bool ordered,
int network_num, std::string vnet_type) = 0;
- void clearStats();
- void printStats(std::ostream& out) const;
- void printPerformanceStats(std::ostream& out) const;
- virtual void printLinkStats(std::ostream& out) const = 0;
- virtual void printPowerStats(std::ostream& out) const = 0;
+ virtual void regStats();
+ virtual void collateStats() {}
protected:
int m_ni_flit_size;
int m_vcs_per_vnet;
bool m_enable_fault_model;
- std::vector<int> m_flits_received;
- std::vector<int> m_flits_injected;
- std::vector<double> m_network_latency;
- std::vector<double> m_queueing_latency;
-
std::vector<bool> m_in_use;
std::vector<bool> m_ordered;
std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
+
+ // Statistical variables
+ Stats::Vector m_flits_received;
+ Stats::Vector m_flits_injected;
+ Stats::Vector m_network_latency;
+ Stats::Vector m_queueing_latency;
+
+ Stats::Formula m_avg_vnet_latency;
+ Stats::Formula m_avg_vqueue_latency;
+ Stats::Formula m_avg_network_latency;
+ Stats::Formula m_avg_queueing_latency;
+ Stats::Formula m_avg_latency;
};
#endif // __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
index 238006881..8db57267e 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -221,81 +221,82 @@ GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
}
void
-GarnetNetwork_d::printLinkStats(ostream& out) const
+GarnetNetwork_d::regStats()
{
- double average_link_utilization = 0;
- vector<double> average_vc_load;
- average_vc_load.resize(m_virtual_networks*m_vcs_per_vnet);
+ BaseGarnetNetwork::regStats();
+ regLinkStats();
+ regPowerStats();
+}
- for (int i = 0; i < m_virtual_networks*m_vcs_per_vnet; i++) {
- average_vc_load[i] = 0;
- }
+void
+GarnetNetwork_d::regLinkStats()
+{
+ m_average_link_utilization.name(name() + ".avg_link_utilization");
+
+ m_average_vc_load
+ .init(m_virtual_networks * m_vcs_per_vnet)
+ .name(name() + ".avg_vc_load")
+ .flags(Stats::pdf | Stats::total | Stats::nozero | Stats::oneline)
+ ;
+}
+
+void
+GarnetNetwork_d::regPowerStats()
+{
+ m_dynamic_link_power.name(name() + ".link_dynamic_power");
+ m_static_link_power.name(name() + ".link_static_power");
+
+ m_total_link_power.name(name() + ".link_total_power");
+ m_total_link_power = m_dynamic_link_power + m_static_link_power;
+
+ m_dynamic_router_power.name(name() + ".router_dynamic_power");
+ m_static_router_power.name(name() + ".router_static_power");
+ m_clk_power.name(name() + ".clk_power");
+
+ m_total_router_power.name(name() + ".router_total_power");
+ m_total_router_power = m_dynamic_router_power +
+ m_static_router_power +
+ m_clk_power;
+}
+
+void
+GarnetNetwork_d::collateStats()
+{
+ collateLinkStats();
+ collatePowerStats();
+}
- out << endl;
+void
+GarnetNetwork_d::collateLinkStats()
+{
for (int i = 0; i < m_links.size(); i++) {
- average_link_utilization +=
+ m_average_link_utilization +=
(double(m_links[i]->getLinkUtilization())) /
(double(curCycle() - g_ruby_start));
- vector<int> vc_load = m_links[i]->getVcLoad();
+ vector<unsigned int> vc_load = m_links[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
- assert(vc_load.size() == m_vcs_per_vnet*m_virtual_networks);
- average_vc_load[j] += vc_load[j];
+ m_average_vc_load[j] +=
+ ((double)vc_load[j] / (double)(curCycle() - g_ruby_start));
}
}
- average_link_utilization =
- average_link_utilization/m_links.size();
- out << "Average Link Utilization :: " << average_link_utilization
- << " flits/cycle" << endl;
- out << "-------------" << endl;
-
- for (int i = 0; i < m_vcs_per_vnet*m_virtual_networks; i++) {
- if (!m_in_use[i/m_vcs_per_vnet])
- continue;
-
- average_vc_load[i] = (double(average_vc_load[i])) /
- (double(curCycle() - g_ruby_start));
- out << "Average VC Load [" << i << "] = " << average_vc_load[i]
- << " flits/cycle " << endl;
- }
- out << "-------------" << endl;
- out << endl;
}
void
-GarnetNetwork_d::printPowerStats(ostream& out) const
+GarnetNetwork_d::collatePowerStats()
{
- out << "Network Power" << endl;
- out << "-------------" << endl;
- double m_total_link_power = 0.0;
- double m_dynamic_link_power = 0.0;
- double m_static_link_power = 0.0;
- double m_total_router_power = 0.0;
- double m_dynamic_router_power = 0.0;
- double m_static_router_power = 0.0;
- double m_clk_power = 0.0;
-
for (int i = 0; i < m_links.size(); i++) {
- m_total_link_power += m_links[i]->calculate_power();
+ m_links[i]->calculate_power();
m_dynamic_link_power += m_links[i]->get_dynamic_power();
m_static_link_power += m_links[i]->get_static_power();
}
for (int i = 0; i < m_routers.size(); i++) {
- m_total_router_power += m_routers[i]->calculate_power();
+ m_routers[i]->calculate_power();
m_dynamic_router_power += m_routers[i]->get_dynamic_power();
m_static_router_power += m_routers[i]->get_static_power();
m_clk_power += m_routers[i]->get_clk_power();
}
- out << "Link Dynamic Power = " << m_dynamic_link_power << " W" << endl;
- out << "Link Static Power = " << m_static_link_power << " W" << endl;
- out << "Total Link Power = " << m_total_link_power << " W " << endl;
- out << "Router Dynamic Power = " << m_dynamic_router_power << " W" << endl;
- out << "Router Clock Power = " << m_clk_power << " W" << endl;
- out << "Router Static Power = " << m_static_router_power << " W" << endl;
- out << "Total Router Power = " << m_total_router_power << " W " <<endl;
- out << "-------------" << endl;
- out << endl;
}
void
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
index 919e6703e..53cf595e5 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
@@ -63,8 +63,8 @@ class GarnetNetwork_d : public BaseGarnetNetwork
int getBuffersPerDataVC() {return m_buffers_per_data_vc; }
int getBuffersPerCtrlVC() {return m_buffers_per_ctrl_vc; }
- void printLinkStats(std::ostream& out) const;
- void printPowerStats(std::ostream& out) const;
+ void collateStats();
+ void regStats();
void print(std::ostream& out) const;
VNET_type
@@ -96,6 +96,11 @@ class GarnetNetwork_d : public BaseGarnetNetwork
GarnetNetwork_d(const GarnetNetwork_d& obj);
GarnetNetwork_d& operator=(const GarnetNetwork_d& obj);
+ void collateLinkStats();
+ void collatePowerStats();
+ void regLinkStats();
+ void regPowerStats();
+
std::vector<VNET_type > m_vnet_type;
std::vector<Router_d *> m_routers; // All Routers in Network
@@ -105,6 +110,20 @@ class GarnetNetwork_d : public BaseGarnetNetwork
int m_buffers_per_data_vc;
int m_buffers_per_ctrl_vc;
+
+ // Statistical variables for power
+ Stats::Scalar m_dynamic_link_power;
+ Stats::Scalar m_static_link_power;
+ Stats::Formula m_total_link_power;
+
+ Stats::Scalar m_dynamic_router_power;
+ Stats::Scalar m_static_router_power;
+ Stats::Scalar m_clk_power;
+ Stats::Formula m_total_router_power;
+
+ // Statistical variables for performance
+ Stats::Scalar m_average_link_utilization;
+ Stats::Vector m_average_vc_load;
};
inline std::ostream&
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 6afb4726b..2c37996b3 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
@@ -161,17 +161,10 @@ class InputUnit_d : public Consumer
m_credit_link = credit_link;
}
- inline double
- get_buf_read_count(int vnet)
- {
- return m_num_buffer_reads[vnet];
- }
-
- inline double
- get_buf_write_count(int vnet)
- {
- return m_num_buffer_writes[vnet];
- }
+ double get_buf_read_count(unsigned int vnet) const
+ { return m_num_buffer_reads[vnet]; }
+ double get_buf_write_count(unsigned int vnet) const
+ { return m_num_buffer_writes[vnet]; }
uint32_t functionalWrite(Packet *pkt);
@@ -179,8 +172,6 @@ class InputUnit_d : public Consumer
int m_id;
int m_num_vcs;
int m_vc_per_vnet;
- std::vector<double> m_num_buffer_writes;
- std::vector<double> m_num_buffer_reads;
Router_d *m_router;
NetworkLink_d *m_in_link;
@@ -189,6 +180,10 @@ class InputUnit_d : public Consumer
// Virtual channels
std::vector<VirtualChannel_d *> m_vcs;
+
+ // Statistical variables
+ std::vector<double> m_num_buffer_writes;
+ std::vector<double> m_num_buffer_reads;
};
#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index d84bf8e69..32fce83ce 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -76,18 +76,6 @@ NetworkLink_d::wakeup()
}
}
-std::vector<int>
-NetworkLink_d::getVcLoad()
-{
- return m_vc_load;
-}
-
-int
-NetworkLink_d::getLinkUtilization()
-{
- return m_link_utilized;
-}
-
NetworkLink_d *
NetworkLink_dParams::create()
{
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
index 9e149392e..fcdd28b67 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -53,14 +53,15 @@ class NetworkLink_d : public ClockedObject, public Consumer
void setLinkConsumer(Consumer *consumer);
void setSourceQueue(flitBuffer_d *srcQueue);
void print(std::ostream& out) const{}
- int getLinkUtilization();
- std::vector<int> getVcLoad();
int get_id(){return m_id;}
- double get_dynamic_power(){return m_power_dyn;}
- double get_static_power(){return m_power_sta;}
void wakeup();
- double calculate_power();
+ void calculate_power();
+ double get_dynamic_power() const { return m_power_dyn; }
+ double get_static_power()const { return m_power_sta; }
+
+ unsigned int getLinkUtilization() const { return m_link_utilized; }
+ const std::vector<unsigned int> & getVcLoad() const { return m_vc_load; }
inline bool isReady(Cycles curTime)
{ return linkBuffer->isReady(curTime); }
@@ -71,7 +72,7 @@ class NetworkLink_d : public ClockedObject, public Consumer
void init_net_ptr(GarnetNetwork_d* net_ptr) { m_net_ptr = net_ptr; }
uint32_t functionalWrite(Packet *);
- protected:
+ private:
int m_id;
Cycles m_latency;
int channel_width;
@@ -80,10 +81,12 @@ class NetworkLink_d : public ClockedObject, public Consumer
flitBuffer_d *linkBuffer;
Consumer *link_consumer;
flitBuffer_d *link_srcQueue;
- int m_link_utilized;
- std::vector<int> m_vc_load;
int m_flit_width;
+ // Statistical variables
+ unsigned int m_link_utilized;
+ std::vector<unsigned int> m_vc_load;
+
double m_power_dyn;
double m_power_sta;
};
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 fd4ce5389..3370c356c 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
@@ -186,7 +186,7 @@ Router_d::printFaultVector(ostream& out)
for (int fault_type_index = 0; fault_type_index < num_fault_types;
fault_type_index++){
out << " - probability of (";
- out <<
+ out <<
m_network_ptr->fault_model->fault_type_to_string(fault_type_index);
out << ") = ";
out << fault_vector[fault_type_index] << endl;
@@ -198,7 +198,7 @@ Router_d::printAggregateFaultProbability(std::ostream& out)
{
int temperature_celcius = BASELINE_TEMPERATURE_CELCIUS;
float aggregate_fault_prob;
- get_aggregate_fault_probability(temperature_celcius,
+ get_aggregate_fault_probability(temperature_celcius,
&aggregate_fault_prob);
out << "Router-" << m_id << " fault probability: ";
out << aggregate_fault_prob << endl;
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 4aa437c9c..17ba54fa5 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
@@ -89,12 +89,12 @@ class Router_d : public BasicRouter
void printFaultVector(std::ostream& out);
void printAggregateFaultProbability(std::ostream& out);
- double calculate_power();
+ void calculate_power();
void calculate_performance_numbers();
+ double get_dynamic_power() const { return m_power_dyn; }
+ double get_static_power() const { return m_power_sta; }
+ double get_clk_power() const { return m_clk_power; }
- double get_dynamic_power(){return m_power_dyn;}
- double get_static_power(){return m_power_sta;}
- double get_clk_power(){return m_clk_power;}
bool get_fault_vector(int temperature, float fault_vector[]){
return m_network_ptr->fault_model->fault_vector(m_id, temperature,
fault_vector);
@@ -110,11 +110,6 @@ class Router_d : public BasicRouter
private:
int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
GarnetNetwork_d *m_network_ptr;
-
- 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;
double sw_local_arbit_count, sw_global_arbit_count;
double crossbar_count;
@@ -125,9 +120,16 @@ class Router_d : public BasicRouter
SWallocator_d *m_sw_alloc;
Switch_d *m_switch;
+ // Statistical variables for power
double m_power_dyn;
double m_power_sta;
double m_clk_power;
+
+ // 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;
};
#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
index d28c6f82f..246b7ad2f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
@@ -57,26 +57,17 @@ class VCallocator_d : public Consumer
bool is_invc_candidate(int inport_iter, int invc_iter);
void select_outvc(int inport_iter, int invc_iter);
- inline double
- get_local_arbit_count(int vnet)
- {
- return m_local_arbiter_activity[vnet];
- }
-
- inline double
- get_global_arbit_count(int vnet)
- {
- return m_global_arbiter_activity[vnet];
- }
+ double get_local_arbit_count(unsigned int vnet) const
+ { return m_local_arbiter_activity[vnet]; }
+
+ double get_global_arbit_count(unsigned int vnet) const
+ { return m_global_arbiter_activity[vnet]; }
private:
int m_num_vcs, m_vc_per_vnet;
int m_num_inports;
int m_num_outports;
- std::vector<double > m_local_arbiter_activity;
- std::vector<double > m_global_arbiter_activity;
-
Router_d *m_router;
// First stage of arbitration
@@ -94,6 +85,10 @@ class VCallocator_d : public Consumer
std::vector<InputUnit_d *> m_input_unit;
std::vector<OutputUnit_d *> m_output_unit;
+
+ // Statistical variables
+ std::vector<double> m_local_arbiter_activity;
+ std::vector<double> m_global_arbiter_activity;
};
#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index ea08a054b..1e24cbc69 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -210,54 +210,38 @@ GarnetNetwork::functionalWrite(Packet *pkt)
}
void
-GarnetNetwork::printLinkStats(ostream& out) const
+GarnetNetwork::regStats()
{
- double average_link_utilization = 0;
- vector<double> average_vc_load;
- average_vc_load.resize(m_virtual_networks*m_vcs_per_vnet);
-
- for (int i = 0; i < m_virtual_networks*m_vcs_per_vnet; i++) {
- average_vc_load[i] = 0;
+ BaseGarnetNetwork::regStats();
+
+ m_average_link_utilization.name(name() + ".avg_link_utilization");
+
+ m_average_vc_load
+ .init(m_virtual_networks * m_vcs_per_vnet)
+ .name(name() + ".avg_vc_load")
+ .flags(Stats::pdf | Stats::total | Stats::nozero)
+ ;
+ for (int i = 0; i < m_virtual_networks * m_vcs_per_vnet; i++) {
+ m_average_vc_load
+ .subname(i, csprintf(".%i", i))
+ .flags(Stats::nozero)
+ ;
}
+}
- out << endl;
+void
+GarnetNetwork::collateStats()
+{
for (int i = 0; i < m_links.size(); i++) {
- average_link_utilization +=
+ m_average_link_utilization +=
(double(m_links[i]->getLinkUtilization())) /
(double(curCycle() - g_ruby_start));
- vector<int> vc_load = m_links[i]->getVcLoad();
+ vector<unsigned int> vc_load = m_links[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
- assert(vc_load.size() == m_vcs_per_vnet*m_virtual_networks);
- average_vc_load[j] += vc_load[j];
+ m_average_vc_load[j] += vc_load[j];
}
}
- average_link_utilization =
- average_link_utilization/m_links.size();
- out << "Average Link Utilization :: " << average_link_utilization
- << " flits/cycle" << endl;
- out << "-------------" << endl;
-
- for (int i = 0; i < m_vcs_per_vnet*m_virtual_networks; i++) {
- if (!m_in_use[i/m_vcs_per_vnet])
- continue;
-
- average_vc_load[i] = double(average_vc_load[i]) /
- (double(curCycle() - g_ruby_start));
- out << "Average VC Load [" << i << "] = " << average_vc_load[i]
- << " flits/cycle " << endl;
- }
- out << "-------------" << endl;
- out << endl;
-}
-
-void
-GarnetNetwork::printPowerStats(ostream& out) const
-{
- out << "Network Power" << endl;
- out << "-------------" << endl;
- out << "Orion does not work with flexible pipeline" << endl;
- out << endl;
}
void
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
index fb4f99d19..d468e9614 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
@@ -58,11 +58,10 @@ class GarnetNetwork : public BaseGarnetNetwork
int getBufferSize() { return m_buffer_size; }
int getNumPipeStages() {return m_number_of_pipe_stages; }
-
int getNumNodes(){ return m_nodes; }
- void printLinkStats(std::ostream& out) const;
- void printPowerStats(std::ostream& out) const;
+ void collateStats();
+ void regStats();
void print(std::ostream& out) const;
// Methods used by Topology to setup the network
@@ -97,6 +96,10 @@ class GarnetNetwork : public BaseGarnetNetwork
int m_buffer_size;
int m_number_of_pipe_stages;
+
+ // Statistical variables
+ Stats::Scalar m_average_link_utilization;
+ Stats::Vector m_average_vc_load;
};
inline std::ostream&
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 9881d8063..04e8a9da9 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -40,6 +40,7 @@ NetworkLink::NetworkLink(const Params *p)
m_link_utilized = 0;
m_latency = p->link_latency;
m_id = p->link_id;
+
int num_net = p->virt_nets;
int num_vc = p->vcs_per_vnet;
m_vc_load.resize(num_net * num_vc);
@@ -53,12 +54,6 @@ NetworkLink::~NetworkLink()
delete linkBuffer;
}
-int
-NetworkLink::get_id()
-{
- return m_id;
-}
-
void
NetworkLink::setLinkConsumer(FlexibleConsumer *consumer)
{
@@ -101,18 +96,6 @@ NetworkLink::release_vc_link(int vc, Cycles release_time)
link_source->release_vc(m_out_port, vc, release_time);
}
-std::vector<int>
-NetworkLink::getVcLoad()
-{
- return m_vc_load;
-}
-
-double
-NetworkLink::getLinkUtilization()
-{
- return (double(m_link_utilized));
-}
-
bool
NetworkLink::isReady()
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
index 7003114a1..9b8a9bc47 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
@@ -59,7 +59,7 @@ class NetworkLink : public ClockedObject, public FlexibleConsumer
bool is_vc_ready(flit *t_flit);
- int get_id();
+ int get_id() const { return m_id; }
void setInPort(int port);
void setOutPort(int port);
void wakeup();
@@ -69,29 +69,28 @@ class NetworkLink : public ClockedObject, public FlexibleConsumer
void request_vc_link(int vc, NetDest destination, Cycles request_time);
bool isBufferNotFull_link(int vc);
void setSource(FlexibleConsumer *source);
- double getLinkUtilization();
- std::vector<int> getVcLoad();
+ void init_net_ptr(GarnetNetwork* net_ptr) { m_net_ptr = net_ptr; }
- void init_net_ptr(GarnetNetwork* net_ptr)
- {
- m_net_ptr = net_ptr;
- }
+ unsigned int getLinkUtilization() const { return m_link_utilized; }
+ const std::vector<unsigned int> & getVcLoad() const { return m_vc_load; }
bool functionalRead(Packet *);
uint32_t functionalWrite(Packet *);
- protected:
+ private:
int m_id;
Cycles m_latency;
int m_in_port, m_out_port;
- int m_link_utilized;
- std::vector<int> m_vc_load;
GarnetNetwork *m_net_ptr;
flitBuffer *linkBuffer;
FlexibleConsumer *link_consumer;
FlexibleConsumer *link_source;
flitBuffer *link_srcQueue;
+
+ // Statistical variables
+ unsigned int m_link_utilized;
+ std::vector<unsigned int> m_vc_load;
};
#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__