Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44706 )

Change subject: base: Add warnings for legacy stats
......................................................................

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 <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44706
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/statistics.hh
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 63bfb5b..9de975b 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 @@

         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);
     }

     /**

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44706
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: I8d426882b6bf7600998e181f18d1339ce82d5917
Gerrit-Change-Number: 44706
Gerrit-PatchSet: 8
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to