base: Add warnings for legacy stats

Legacy stat is defined as a stat that doesn't belong to any
Stats::Group.

JIRA: https://gem5.atlassian.net/browse/GEM5-645

Change-Id: I8d426882b6bf7600998e181f18d1339ce82d5917
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44706
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:
Hoa Nguyen
2021-04-21 00:53:44 -07:00
parent 0209e7dede
commit e9ac090991

View File

@@ -75,6 +75,7 @@
#include "base/cast.hh"
#include "base/cprintf.hh"
#include "base/intmath.hh"
#include "base/logging.hh"
#include "base/stats/group.hh"
#include "base/stats/info.hh"
#include "base/stats/output.hh"
@@ -259,6 +260,14 @@ class DataWrap : public InfoAccess
if (desc)
info->desc = desc;
// Stat that does not belong to any Stats::Group is a legacy stat
std::string common_message = "Legacy stat is a stat that does not "
"belong to any Stats::Group. Legacy stat is deprecated.";
if (parent == nullptr && name != nullptr)
warn(csprintf("`%s` is a legacy stat. %s", name, common_message));
else if (parent == nullptr)
warn_once("One of the stats is a legacy stat. " + common_message);
}
/**