SimpleNetwork::SimpleNetwork(const Params &p)
: Network(p), m_buffer_size(p.buffer_size),
m_endpoint_bandwidth(p.endpoint_bandwidth),
- m_adaptive_routing(p.adaptive_routing)
+ m_adaptive_routing(p.adaptive_routing),
+ networkStats(this)
{
// record the routers
for (vector<BasicRouter*>::const_iterator i = p.routers.begin();
for (MessageSizeType type = MessageSizeType_FIRST;
type < MessageSizeType_NUM; ++type) {
- m_msg_counts[(unsigned int) type]
- .name(name() + ".msg_count." + MessageSizeType_to_string(type))
- .flags(Stats::nozero)
+ networkStats.m_msg_counts[(unsigned int) type] =
+ new Stats::Formula(&networkStats,
+ csprintf("msg_count.%s", MessageSizeType_to_string(type)).c_str());
+ networkStats.m_msg_counts[(unsigned int) type]
+ ->flags(Stats::nozero)
;
- m_msg_bytes[(unsigned int) type]
- .name(name() + ".msg_byte." + MessageSizeType_to_string(type))
- .flags(Stats::nozero)
+
+ networkStats.m_msg_bytes[(unsigned int) type] =
+ new Stats::Formula(&networkStats,
+ csprintf("msg_byte.%s", MessageSizeType_to_string(type)).c_str());
+ networkStats.m_msg_bytes[(unsigned int) type]
+ ->flags(Stats::nozero)
;
// Now state what the formula is.
for (int i = 0; i < m_switches.size(); i++) {
- m_msg_counts[(unsigned int) type] +=
+ *(networkStats.m_msg_counts[(unsigned int) type]) +=
sum(m_switches[i]->getMsgCount(type));
}
- m_msg_bytes[(unsigned int) type] =
- m_msg_counts[(unsigned int) type] * Stats::constant(
- Network::MessageSizeType_to_int(type));
+ *(networkStats.m_msg_bytes[(unsigned int) type]) =
+ *(networkStats.m_msg_counts[(unsigned int) type]) *
+ Stats::constant(Network::MessageSizeType_to_int(type));
}
}
}
return num_functional_writes;
}
+
+SimpleNetwork::
+NetworkStats::NetworkStats(Stats::Group *parent)
+ : Stats::Group(parent)
+{
+
+}
\ No newline at end of file
const int m_endpoint_bandwidth;
const bool m_adaptive_routing;
- //Statistical variables
- Stats::Formula m_msg_counts[MessageSizeType_NUM];
- Stats::Formula m_msg_bytes[MessageSizeType_NUM];
+
+ struct NetworkStats : public Stats::Group
+ {
+ NetworkStats(Stats::Group *parent);
+
+ //Statistical variables
+ Stats::Formula* m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula* m_msg_bytes[MessageSizeType_NUM];
+ } networkStats;
};
inline std::ostream&
using m5::stl_helpers::operator<<;
Switch::Switch(const Params &p)
- : BasicRouter(p), perfectSwitch(m_id, this, p.virt_nets),
- m_num_connected_buffers(0)
+ : BasicRouter(p),
+ perfectSwitch(m_id, this, p.virt_nets), m_num_connected_buffers(0),
+ switchStats(this)
{
m_port_buffers.reserve(p.port_buffers.size());
for (auto& buffer : p.port_buffers) {
BasicRouter::regStats();
for (auto& throttle : throttles) {
- throttle.regStats(name());
+ throttle.regStats();
}
- m_avg_utilization.name(name() + ".percent_links_utilized");
for (const auto& throttle : throttles) {
- m_avg_utilization += throttle.getUtilization();
+ switchStats.m_avg_utilization += throttle.getUtilization();
}
- m_avg_utilization /= Stats::constant(throttles.size());
+ switchStats.m_avg_utilization /= Stats::constant(throttles.size());
for (unsigned int type = MessageSizeType_FIRST;
type < MessageSizeType_NUM; ++type) {
- m_msg_counts[type]
- .name(name() + ".msg_count." +
- MessageSizeType_to_string(MessageSizeType(type)))
- .flags(Stats::nozero)
+ switchStats.m_msg_counts[type] = new Stats::Formula(&switchStats,
+ csprintf("msg_count.%s",
+ MessageSizeType_to_string(MessageSizeType(type))).c_str());
+ switchStats.m_msg_counts[type]
+ ->flags(Stats::nozero)
;
- m_msg_bytes[type]
- .name(name() + ".msg_bytes." +
- MessageSizeType_to_string(MessageSizeType(type)))
- .flags(Stats::nozero)
+
+ switchStats.m_msg_bytes[type] = new Stats::Formula(&switchStats,
+ csprintf("msg_bytes.%s",
+ MessageSizeType_to_string(MessageSizeType(type))).c_str());
+ switchStats.m_msg_bytes[type]
+ ->flags(Stats::nozero)
;
for (const auto& throttle : throttles) {
- m_msg_counts[type] += throttle.getMsgCount(type);
+ *(switchStats.m_msg_counts[type]) += throttle.getMsgCount(type);
}
- m_msg_bytes[type] = m_msg_counts[type] * Stats::constant(
+ *(switchStats.m_msg_bytes[type]) =
+ *(switchStats.m_msg_counts[type]) * Stats::constant(
Network::MessageSizeType_to_int(MessageSizeType(type)));
}
}
}
return num_functional_writes;
}
+
+Switch::
+SwitchStats::SwitchStats(Stats::Group *parent)
+ : Stats::Group(parent),
+ m_avg_utilization(this, "percent_links_utilized")
+{
+
+}
void collateStats();
void regStats();
const Stats::Formula & getMsgCount(unsigned int type) const
- { return m_msg_counts[type]; }
+ { return *(switchStats.m_msg_counts[type]); }
void print(std::ostream& out) const;
void init_net_ptr(SimpleNetwork* net_ptr) { m_network_ptr = net_ptr; }
unsigned m_num_connected_buffers;
std::vector<MessageBuffer*> m_port_buffers;
- // Statistical variables
- Stats::Formula m_avg_utilization;
- Stats::Formula m_msg_counts[MessageSizeType_NUM];
- Stats::Formula m_msg_bytes[MessageSizeType_NUM];
+
+ public:
+ struct SwitchStats : public Stats::Group
+ {
+ SwitchStats(Stats::Group *parent);
+
+ // Statistical variables
+ Stats::Formula m_avg_utilization;
+ Stats::Formula* m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula* m_msg_bytes[MessageSizeType_NUM];
+ } switchStats;
};
inline std::ostream&
Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
Switch *em)
- : Consumer(em), m_switch_id(sID), m_switch(em), m_node(node),
- m_ruby_system(rs)
+ : Consumer(em),
+ m_switch_id(sID), m_switch(em), m_node(node),
+ m_ruby_system(rs),
+ throttleStats(em, node)
{
m_vnets = 0;
m_switch->cyclesToTicks(m_link_latency));
// Count the message
- m_msg_counts[net_msg_ptr->getMessageSize()][vnet]++;
+ (*(throttleStats.
+ m_msg_counts[net_msg_ptr->getMessageSize()]))[vnet]++;
DPRINTF(RubyNetwork, "%s\n", *out);
}
}
void
-Throttle::regStats(string parent)
+Throttle::regStats()
{
- m_link_utilization
- .name(parent + csprintf(".throttle%i", m_node) + ".link_utilization");
-
for (MessageSizeType type = MessageSizeType_FIRST;
type < MessageSizeType_NUM; ++type) {
- m_msg_counts[(unsigned int)type]
- .init(Network::getNumberOfVirtualNetworks())
- .name(parent + csprintf(".throttle%i", m_node) + ".msg_count." +
- MessageSizeType_to_string(type))
+ throttleStats.m_msg_counts[(unsigned int)type] =
+ new Stats::Vector(&throttleStats,
+ csprintf("msg_count.%s", MessageSizeType_to_string(type)).c_str());
+ throttleStats.m_msg_counts[(unsigned int)type]
+ ->init(Network::getNumberOfVirtualNetworks())
.flags(Stats::nozero)
;
- m_msg_bytes[(unsigned int) type]
- .name(parent + csprintf(".throttle%i", m_node) + ".msg_bytes." +
- MessageSizeType_to_string(type))
- .flags(Stats::nozero)
+
+ throttleStats.m_msg_bytes[(unsigned int) type] =
+ new Stats::Formula(&throttleStats,
+ csprintf("msg_bytes.%s", MessageSizeType_to_string(type)).c_str());
+ throttleStats.m_msg_bytes[(unsigned int) type]
+ ->flags(Stats::nozero)
;
- m_msg_bytes[(unsigned int) type] = m_msg_counts[type] * Stats::constant(
+ *(throttleStats.m_msg_bytes[(unsigned int) type]) =
+ *(throttleStats.m_msg_counts[type]) * Stats::constant(
Network::MessageSizeType_to_int(type));
}
}
double time_delta = double(m_ruby_system->curCycle() -
m_ruby_system->getStartCycle());
- m_link_utilization = 100.0 * m_link_utilization_proxy / time_delta;
+ throttleStats.m_link_utilization =
+ 100.0 * m_link_utilization_proxy / time_delta;
}
void
return size;
}
+
+Throttle::
+ThrottleStats::ThrottleStats(Stats::Group *parent, const NodeID &nodeID)
+ : Stats::Group(parent, csprintf("throttle%02i", nodeID).c_str()),
+ m_link_utilization(this, "link_utilization")
+{
+
+}
// The average utilization (a fraction) since last clearStats()
const Stats::Scalar & getUtilization() const
- { return m_link_utilization; }
+ { return throttleStats.m_link_utilization; }
const Stats::Vector & getMsgCount(unsigned int type) const
- { return m_msg_counts[type]; }
+ { return *(throttleStats.m_msg_counts[type]); }
int getLinkBandwidth() const
{ return m_endpoint_bandwidth * m_link_bandwidth_multiplier; }
void clearStats();
void collateStats();
- void regStats(std::string name);
+ void regStats();
void print(std::ostream& out) const;
private:
int m_endpoint_bandwidth;
RubySystem *m_ruby_system;
- // Statistical variables
- Stats::Scalar m_link_utilization;
- Stats::Vector m_msg_counts[MessageSizeType_NUM];
- Stats::Formula m_msg_bytes[MessageSizeType_NUM];
-
double m_link_utilization_proxy;
+
+
+ struct ThrottleStats : public Stats::Group
+ {
+ ThrottleStats(Stats::Group *parent, const NodeID &nodeID);
+
+ // Statistical variables
+ Stats::Scalar m_link_utilization;
+ Stats::Vector* m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula* m_msg_bytes[MessageSizeType_NUM];
+ } throttleStats;
};
inline std::ostream&