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

Change subject: base-stats: Print the name of stats sharing the same name
......................................................................

base-stats: Print the name of stats sharing the same name

Having stats of the same name within the same group result in an error.
This commit adds the name to the error message to make it easier to find
the Stats::Group caused the error.

Change-Id: I4010d5d949d1c943d2dd1e2fca0aafcbf62e3ee1
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38337
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/stats/group.cc
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/src/base/stats/group.cc b/src/base/stats/group.cc
index f1eda1d..de546cd 100644
--- a/src/base/stats/group.cc
+++ b/src/base/stats/group.cc
@@ -37,8 +37,7 @@

 #include "base/stats/group.hh"

-#include <cassert>
-
+#include "base/logging.hh"
 #include "base/stats/info.hh"
 #include "base/trace.hh"
 #include "debug/Stats.hh"
@@ -112,7 +111,8 @@
 void
 Group::addStatGroup(const char *name, Group *block)
 {
-    assert(statGroups.find(name) == statGroups.end());
+    panic_if(statGroups.find(name) != statGroups.end(),
+             "Stats of the same group share the same name `%s`.\n", name);

     statGroups[name] = block;
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38337
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: I4010d5d949d1c943d2dd1e2fca0aafcbf62e3ee1
Gerrit-Change-Number: 38337
Gerrit-PatchSet: 5
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
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