Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/43589 )
Change subject: base-stats: Remove Stats::Group dependency from Stats::Info
......................................................................
base-stats: Remove Stats::Group dependency from Stats::Info
The parent group was not being used. The only thing required
was the information of whether the info concerns a new or an
old-style stats. Removing this dependency simplifies code
and removes a possible cyclic dependency.
Change-Id: I4d734cd83e9c7975a3ef45229edea4eebf1e430e
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/base/statistics.hh
M src/base/stats/info.cc
M src/base/stats/info.hh
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 63bfb5b..5e0442a 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -251,7 +251,7 @@
parent->addStat(info);
if (name) {
- info->setName(parent, name);
+ info->setName(name, parent == nullptr);
info->flags.set(display);
}
diff --git a/src/base/stats/info.cc b/src/base/stats/info.cc
index b2ad86b..5a0a515 100644
--- a/src/base/stats/info.cc
+++ b/src/base/stats/info.cc
@@ -109,13 +109,7 @@
}
void
-Info::setName(const std::string &name)
-{
- setName(nullptr, name);
-}
-
-void
-Info::setName(const Group *parent, const std::string &name)
+Info::setName(const std::string &name, bool old_style)
{
if (!validateStatName(name))
panic("invalid stat name '%s'", name);
@@ -124,12 +118,10 @@
// old-style stats without a parent group. New-style stats should
// be unique since their names should correspond to a member
// variable.
- if (!parent) {
+ if (old_style) {
auto p = nameMap().insert(make_pair(name, this));
- if (!p.second)
- panic("same statistic name used twice! name=%s\n",
- name);
+ panic_if(!p.second, "same statistic name used twice! name=%s\n",
name);
}
this->name = name;
diff --git a/src/base/stats/info.hh b/src/base/stats/info.hh
index 0568aa4..229a365 100644
--- a/src/base/stats/info.hh
+++ b/src/base/stats/info.hh
@@ -35,8 +35,6 @@
namespace Stats {
-class Group;
-
typedef uint16_t FlagsType;
typedef ::Flags<FlagsType> Flags;
@@ -98,9 +96,15 @@
Info();
virtual ~Info();
- /** Set the name of this statistic */
- void setName(const std::string &name);
- void setName(const Group *parent, const std::string &name);
+ /**
+ * Set the name of this statistic. Special handling must be done when
+ * creating an old-style statistic (i.e., stats without a parent
group).
+ *
+ * @param name The new name.
+ * @param old_style Whether we are using the old style.
+ */
+ void setName(const std::string &name, bool old_style=true);
+
void setSeparator(std::string _sep) { separatorString = _sep;}
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43589
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: I4d734cd83e9c7975a3ef45229edea4eebf1e430e
Gerrit-Change-Number: 43589
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s