Yu-hsin Wang has submitted this change. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52323
Reviewed-by: Andreas Sandberg <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/statistics.cc
M src/base/statistics.hh
2 files changed, 36 insertions(+), 4 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks
good to me, approved
Andreas Sandberg: Looks good to me, approved
Daniel Carvalho: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/statistics.cc b/src/base/statistics.cc
index 39e76b6..c380143 100644
--- a/src/base/statistics.cc
+++ b/src/base/statistics.cc
@@ -111,7 +111,7 @@
Info *
InfoAccess::info()
{
- if (_info) {
+ if (newStyleStats()) {
// New-style stats
return _info;
} else {
@@ -125,7 +125,7 @@
const Info *
InfoAccess::info() const
{
- if (_info) {
+ if (newStyleStats()) {
// New-style stats
return _info;
} else {
@@ -136,6 +136,12 @@
}
}
+bool
+InfoAccess::newStyleStats() 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..24cbf71 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 newStyleStats() const;
+
public:
InfoAccess()
: _info(nullptr) {};
@@ -259,7 +262,7 @@
parent->addStat(info);
if (name) {
- info->setName(name, parent == nullptr);
+ info->setName(name, !newStyleStats());
info->flags.set(display);
}
@@ -286,7 +289,7 @@
name(const std::string &name)
{
Info *info = this->info();
- info->setName(name);
+ info->setName(name, !newStyleStats());
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: 4
Gerrit-Owner: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Earl Ou <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Gabe Black <[email protected]>
Gerrit-CC: Han-sheng Liu <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s