ruby: Statically allocate stats in SimpleNetwork, Switch, Throttle
The previous changeset (9863:9483739f83ee) used STL vector containers to dynamically allocate stats in the Ruby SimpleNetwork, Switch and Throttle. For gcc versions before at least 4.6.3, this causes the standard vector allocator to call Stats copy constructors (a no-no, since stats should be allocated in the body of each SimObject instance). Since the size of these stats arrays is known at compile time (NOTE: after code generation), this patch changes their allocation to be static rather than using an STL vector.
This commit is contained in:
parent
e391fd151b
commit
c1cf55c738
|
@ -208,9 +208,6 @@ SimpleNetwork::getThrottles(NodeID id) const
|
||||||
void
|
void
|
||||||
SimpleNetwork::regStats()
|
SimpleNetwork::regStats()
|
||||||
{
|
{
|
||||||
m_msg_counts.resize(MessageSizeType_NUM);
|
|
||||||
m_msg_bytes.resize(MessageSizeType_NUM);
|
|
||||||
|
|
||||||
for (MessageSizeType type = MessageSizeType_FIRST;
|
for (MessageSizeType type = MessageSizeType_FIRST;
|
||||||
type < MessageSizeType_NUM; ++type) {
|
type < MessageSizeType_NUM; ++type) {
|
||||||
m_msg_counts[(unsigned int) type]
|
m_msg_counts[(unsigned int) type]
|
||||||
|
|
|
@ -111,8 +111,8 @@ class SimpleNetwork : public Network
|
||||||
bool m_adaptive_routing;
|
bool m_adaptive_routing;
|
||||||
|
|
||||||
//Statistical variables
|
//Statistical variables
|
||||||
std::vector<Stats::Formula> m_msg_counts;
|
Stats::Formula m_msg_counts[MessageSizeType_NUM];
|
||||||
std::vector<Stats::Formula> m_msg_bytes;
|
Stats::Formula m_msg_bytes[MessageSizeType_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream&
|
inline std::ostream&
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include "base/cast.hh"
|
#include "base/cast.hh"
|
||||||
#include "base/stl_helpers.hh"
|
#include "base/stl_helpers.hh"
|
||||||
#include "mem/protocol/MessageSizeType.hh"
|
|
||||||
#include "mem/ruby/buffers/MessageBuffer.hh"
|
#include "mem/ruby/buffers/MessageBuffer.hh"
|
||||||
#include "mem/ruby/network/simple/PerfectSwitch.hh"
|
#include "mem/ruby/network/simple/PerfectSwitch.hh"
|
||||||
#include "mem/ruby/network/simple/SimpleNetwork.hh"
|
#include "mem/ruby/network/simple/SimpleNetwork.hh"
|
||||||
|
@ -44,8 +43,6 @@ using m5::stl_helpers::operator<<;
|
||||||
Switch::Switch(const Params *p) : BasicRouter(p)
|
Switch::Switch(const Params *p) : BasicRouter(p)
|
||||||
{
|
{
|
||||||
m_perfect_switch = new PerfectSwitch(m_id, this, p->virt_nets);
|
m_perfect_switch = new PerfectSwitch(m_id, this, p->virt_nets);
|
||||||
m_msg_counts.resize(MessageSizeType_NUM);
|
|
||||||
m_msg_bytes.resize(MessageSizeType_NUM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Switch::~Switch()
|
Switch::~Switch()
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "mem/packet.hh"
|
#include "mem/packet.hh"
|
||||||
|
#include "mem/protocol/MessageSizeType.hh"
|
||||||
#include "mem/ruby/common/TypeDefines.hh"
|
#include "mem/ruby/common/TypeDefines.hh"
|
||||||
#include "mem/ruby/network/BasicRouter.hh"
|
#include "mem/ruby/network/BasicRouter.hh"
|
||||||
#include "params/Switch.hh"
|
#include "params/Switch.hh"
|
||||||
|
@ -92,8 +93,8 @@ class Switch : public BasicRouter
|
||||||
|
|
||||||
// Statistical variables
|
// Statistical variables
|
||||||
Stats::Formula m_avg_utilization;
|
Stats::Formula m_avg_utilization;
|
||||||
std::vector<Stats::Formula> m_msg_counts;
|
Stats::Formula m_msg_counts[MessageSizeType_NUM];
|
||||||
std::vector<Stats::Formula> m_msg_bytes;
|
Stats::Formula m_msg_bytes[MessageSizeType_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream&
|
inline std::ostream&
|
||||||
|
|
|
@ -80,9 +80,6 @@ Throttle::init(NodeID node, Cycles link_latency,
|
||||||
|
|
||||||
m_wakeups_wo_switch = 0;
|
m_wakeups_wo_switch = 0;
|
||||||
|
|
||||||
m_msg_counts.resize(MessageSizeType_NUM);
|
|
||||||
m_msg_bytes.resize(MessageSizeType_NUM);
|
|
||||||
|
|
||||||
m_link_utilization_proxy = 0;
|
m_link_utilization_proxy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ class Throttle : public Consumer
|
||||||
|
|
||||||
// Statistical variables
|
// Statistical variables
|
||||||
Stats::Scalar m_link_utilization;
|
Stats::Scalar m_link_utilization;
|
||||||
std::vector<Stats::Vector> m_msg_counts;
|
Stats::Vector m_msg_counts[MessageSizeType_NUM];
|
||||||
std::vector<Stats::Formula> m_msg_bytes;
|
Stats::Formula m_msg_bytes[MessageSizeType_NUM];
|
||||||
|
|
||||||
double m_link_utilization_proxy;
|
double m_link_utilization_proxy;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue