#include <cassert>
-#include "base/cprintf.hh"
#include "base/stl_helpers.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
#include "mem/protocol/MachineType.hh"
: BaseGarnetNetwork(p)
{
m_ruby_start = 0;
+ m_flits_received = 0;
+ m_flits_injected = 0;
+ m_network_latency = 0.0;
+ m_queueing_latency = 0.0;
// Allocate to and from queues
GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered,
int network_num)
{
- cprintf ("id = %i, m_nodes = %i \n", id, m_nodes);
assert(id < m_nodes);
assert(network_num < m_virtual_networks);
" flits/cycle" << endl;
}
out << "-------------" << endl;
+
+ out << "Total flits injected = " << m_flits_injected << endl;
+ out << "Total flits received = " << m_flits_received << endl;
+ out << "Average network latency = "
+ << ((double) m_network_latency/ (double) m_flits_received)<< endl;
+ out << "Average queueing (at source NI) latency = "
+ << ((double) m_queueing_latency/ (double) m_flits_received)<< endl;
+ out << "Average latency = "
+ << ((double) (m_queueing_latency + m_network_latency) /
+ (double) m_flits_received)<< endl;
+ out << "-------------" << endl;
+
m_topology_ptr->printStats(out);
}
void printConfig(std::ostream& out) const;
void print(std::ostream& out) const;
+ inline void increment_injected_flits() { m_flits_injected++; }
+ inline void increment_received_flits() { m_flits_received++; }
+
+ inline void
+ increment_network_latency(Time latency)
+ {
+ m_network_latency += latency;
+ }
+
+ inline void
+ increment_queueing_latency(Time latency)
+ {
+ m_queueing_latency += latency;
+ }
+
bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
// int m_virtual_networks;
// int m_nodes;
+ int m_flits_received, m_flits_injected;
+ double m_network_latency, m_queueing_latency;
std::vector<bool> m_in_use;
std::vector<bool> m_ordered;
net_msg_ptr->getInternalDestination().removeNetDest(personal_dest);
}
for (int i = 0; i < num_flits; i++) {
+ m_net_ptr->increment_injected_flits();
flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr);
+ fl->set_delay(g_eventQueue_ptr->getTime() - msg_ptr->getTime());
m_ni_buffers[vc]->insert(fl);
}
inNetLink->release_vc_link(t_flit->get_vc(),
g_eventQueue_ptr->getTime() + 1);
}
+ m_net_ptr->increment_received_flits();
+ int network_delay = g_eventQueue_ptr->getTime() -
+ t_flit->get_enqueue_time();
+ int queueing_delay = t_flit->get_delay();
+ m_net_ptr->increment_network_latency(network_delay);
+ m_net_ptr->increment_queueing_latency(queueing_delay);
delete t_flit;
}
}
vector<flitBuffer *> intermediateQueues;
for (int i = 0; i < m_num_vcs; i++) {
- intermediateQueues.push_back(new flitBuffer(
- m_net_ptr->getBufferSize()));
+ int buffer_size = m_net_ptr->getBufferSize();
+ if (buffer_size > 0) // finite size
+ intermediateQueues.push_back(new flitBuffer(buffer_size));
+ else // infinite size
+ intermediateQueues.push_back(new flitBuffer());
}
m_router_buffers.push_back(intermediateQueues);
return m_type;
}
+void
+flit::set_delay(int delay)
+{
+ src_delay = delay;
+}
+
+int
+flit::get_delay()
+{
+ return src_delay;
+}
+
void
flit::print(std::ostream& out) const
{
void set_vc(int vc);
MsgPtr& get_msg_ptr();
flit_type get_type();
+ void set_delay(int delay);
+ int get_delay();
void print(std::ostream& out) const;
static bool
Time m_enqueue_time, m_time;
flit_type m_type;
MsgPtr m_msg_ptr;
-
+ int src_delay;
};
inline std::ostream&