diff options
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline')
4 files changed, 38 insertions, 69 deletions
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__ |