changeset 94dac7d7bb88 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=94dac7d7bb88
description:
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.
diffstat:
src/mem/ruby/network/simple/SimpleNetwork.cc | 3 ---
src/mem/ruby/network/simple/SimpleNetwork.hh | 4 ++--
src/mem/ruby/network/simple/Switch.cc | 3 ---
src/mem/ruby/network/simple/Switch.hh | 5 +++--
src/mem/ruby/network/simple/Throttle.cc | 3 ---
src/mem/ruby/network/simple/Throttle.hh | 4 ++--
6 files changed, 7 insertions(+), 15 deletions(-)
diffs (96 lines):
diff -r cc5797147e1c -r 94dac7d7bb88
src/mem/ruby/network/simple/SimpleNetwork.cc
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc Mon Sep 09 18:52:23
2013 -0500
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc Wed Sep 11 15:33:27
2013 -0500
@@ -208,9 +208,6 @@
void
SimpleNetwork::regStats()
{
- m_msg_counts.resize(MessageSizeType_NUM);
- m_msg_bytes.resize(MessageSizeType_NUM);
-
for (MessageSizeType type = MessageSizeType_FIRST;
type < MessageSizeType_NUM; ++type) {
m_msg_counts[(unsigned int) type]
diff -r cc5797147e1c -r 94dac7d7bb88
src/mem/ruby/network/simple/SimpleNetwork.hh
--- a/src/mem/ruby/network/simple/SimpleNetwork.hh Mon Sep 09 18:52:23
2013 -0500
+++ b/src/mem/ruby/network/simple/SimpleNetwork.hh Wed Sep 11 15:33:27
2013 -0500
@@ -111,8 +111,8 @@
bool m_adaptive_routing;
//Statistical variables
- std::vector<Stats::Formula> m_msg_counts;
- std::vector<Stats::Formula> m_msg_bytes;
+ Stats::Formula m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula m_msg_bytes[MessageSizeType_NUM];
};
inline std::ostream&
diff -r cc5797147e1c -r 94dac7d7bb88 src/mem/ruby/network/simple/Switch.cc
--- a/src/mem/ruby/network/simple/Switch.cc Mon Sep 09 18:52:23 2013 -0500
+++ b/src/mem/ruby/network/simple/Switch.cc Wed Sep 11 15:33:27 2013 -0500
@@ -30,7 +30,6 @@
#include "base/cast.hh"
#include "base/stl_helpers.hh"
-#include "mem/protocol/MessageSizeType.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/simple/PerfectSwitch.hh"
#include "mem/ruby/network/simple/SimpleNetwork.hh"
@@ -44,8 +43,6 @@
Switch::Switch(const Params *p) : BasicRouter(p)
{
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()
diff -r cc5797147e1c -r 94dac7d7bb88 src/mem/ruby/network/simple/Switch.hh
--- a/src/mem/ruby/network/simple/Switch.hh Mon Sep 09 18:52:23 2013 -0500
+++ b/src/mem/ruby/network/simple/Switch.hh Wed Sep 11 15:33:27 2013 -0500
@@ -43,6 +43,7 @@
#include <vector>
#include "mem/packet.hh"
+#include "mem/protocol/MessageSizeType.hh"
#include "mem/ruby/common/TypeDefines.hh"
#include "mem/ruby/network/BasicRouter.hh"
#include "params/Switch.hh"
@@ -92,8 +93,8 @@
// Statistical variables
Stats::Formula m_avg_utilization;
- std::vector<Stats::Formula> m_msg_counts;
- std::vector<Stats::Formula> m_msg_bytes;
+ Stats::Formula m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula m_msg_bytes[MessageSizeType_NUM];
};
inline std::ostream&
diff -r cc5797147e1c -r 94dac7d7bb88 src/mem/ruby/network/simple/Throttle.cc
--- a/src/mem/ruby/network/simple/Throttle.cc Mon Sep 09 18:52:23 2013 -0500
+++ b/src/mem/ruby/network/simple/Throttle.cc Wed Sep 11 15:33:27 2013 -0500
@@ -80,9 +80,6 @@
m_wakeups_wo_switch = 0;
- m_msg_counts.resize(MessageSizeType_NUM);
- m_msg_bytes.resize(MessageSizeType_NUM);
-
m_link_utilization_proxy = 0;
}
diff -r cc5797147e1c -r 94dac7d7bb88 src/mem/ruby/network/simple/Throttle.hh
--- a/src/mem/ruby/network/simple/Throttle.hh Mon Sep 09 18:52:23 2013 -0500
+++ b/src/mem/ruby/network/simple/Throttle.hh Wed Sep 11 15:33:27 2013 -0500
@@ -104,8 +104,8 @@
// Statistical variables
Stats::Scalar m_link_utilization;
- std::vector<Stats::Vector> m_msg_counts;
- std::vector<Stats::Formula> m_msg_bytes;
+ Stats::Vector m_msg_counts[MessageSizeType_NUM];
+ Stats::Formula m_msg_bytes[MessageSizeType_NUM];
double m_link_utilization_proxy;
};
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev