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 <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -111,7 +111,7 @@ InfoAccess::setInit()
|
||||
Info *
|
||||
InfoAccess::info()
|
||||
{
|
||||
if (_info) {
|
||||
if (newStyleStats()) {
|
||||
// New-style stats
|
||||
return _info;
|
||||
} else {
|
||||
@@ -125,7 +125,7 @@ InfoAccess::info()
|
||||
const Info *
|
||||
InfoAccess::info() const
|
||||
{
|
||||
if (_info) {
|
||||
if (newStyleStats()) {
|
||||
// New-style stats
|
||||
return _info;
|
||||
} else {
|
||||
@@ -136,6 +136,12 @@ InfoAccess::info() const
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -198,6 +198,9 @@ class InfoAccess
|
||||
/** 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 @@ class DataWrap : public InfoAccess
|
||||
parent->addStat(info);
|
||||
|
||||
if (name) {
|
||||
info->setName(name, parent == nullptr);
|
||||
info->setName(name, !newStyleStats());
|
||||
info->flags.set(display);
|
||||
}
|
||||
|
||||
@@ -286,7 +289,7 @@ class DataWrap : public InfoAccess
|
||||
name(const std::string &name)
|
||||
{
|
||||
Info *info = this->info();
|
||||
info->setName(name);
|
||||
info->setName(name, !newStyleStats());
|
||||
info->flags.set(display);
|
||||
return this->self();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user