Yu-hsin Wang has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/52323 )
Change subject: base: fix name setter doesn't pass correct stat style
......................................................................
base: fix name setter doesn't pass correct stat style
There are two kinds of stats in the system. The old one requires an
unique name, while the new one requires an local name. The setName
function has a flag to specify the difference. In the constructor of
InfoAccess, it sets correct flag to the setName function. However, if
you set the name later with the setter, it wouldn't set the flag for
you. This leads the name conflict in new style stats with same local
name. We should also pass the correct flag in the name setter.
Change-Id: I0fcaad3cca65d0f2859c5f6cb28a00813a026a0c
---
M src/base/statistics.cc
M src/base/statistics.hh
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/base/statistics.cc b/src/base/statistics.cc
index 39e76b6..65d7799 100644
--- a/src/base/statistics.cc
+++ b/src/base/statistics.cc
@@ -111,7 +111,7 @@
Info *
InfoAccess::info()
{
- if (_info) {
+ if (newStyleState()) {
// New-style stats
return _info;
} else {
@@ -125,7 +125,7 @@
const Info *
InfoAccess::info() const
{
- if (_info) {
+ if (newStyleState()) {
// New-style stats
return _info;
} else {
@@ -136,6 +136,12 @@
}
}
+bool
+InfoAccess::newStyleState() const
+{
+ return _info != nullptr;
+}
+
Formula::Formula(Group *parent, const char *name, const char *desc)
: DataWrapVec<Formula, FormulaInfoProxy>(
parent, name, units::Unspecified::get(), desc)
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 5079443..02e7dac 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -198,6 +198,9 @@
/** Grab the information class for this statistic */
const Info *info() const;
+ /** Check if the info is new style stats */
+ bool newStyleState() const;
+
public:
InfoAccess()
: _info(nullptr) {};
@@ -259,7 +262,7 @@
parent->addStat(info);
if (name) {
- info->setName(name, parent == nullptr);
+ info->setName(name, !newStyleState());
info->flags.set(display);
}
@@ -286,7 +289,7 @@
name(const std::string &name)
{
Info *info = this->info();
- info->setName(name);
+ info->setName(name, !newStyleState());
info->flags.set(display);
return this->self();
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52323
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0fcaad3cca65d0f2859c5f6cb28a00813a026a0c
Gerrit-Change-Number: 52323
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s