From e9ac09099106edc207ba343cdefaf7be36039064 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Wed, 21 Apr 2021 00:53:44 -0700 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44706 Reviewed-by: Daniel Carvalho Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/base/statistics.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 63bfb5b69d..9de975be45 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -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); } /**