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 <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43589
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
Daniel R. Carvalho
2021-03-21 11:28:13 -03:00
committed by Daniel Carvalho
parent f5204295b1
commit 71653e20fb
3 changed files with 13 additions and 17 deletions

View File

@@ -255,7 +255,7 @@ class DataWrap : public InfoAccess
parent->addStat(info);
if (name) {
info->setName(parent, name);
info->setName(name, parent == nullptr);
info->flags.set(display);
}

View File

@@ -111,13 +111,7 @@ validateStatName(const std::string &name)
}
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);
@@ -126,12 +120,10 @@ Info::setName(const Group *parent, const std::string &name)
// 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;

View File

@@ -38,8 +38,6 @@ GEM5_DEPRECATED_NAMESPACE(Stats, statistics);
namespace statistics
{
class Group;
typedef uint16_t FlagsType;
typedef ::Flags<FlagsType> Flags;
@@ -101,9 +99,15 @@ class Info
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;}
/**