From: Hoa Nguyen Date: Sat, 5 Dec 2020 07:57:14 +0000 (-0800) Subject: base-stats: Print the name of stats sharing the same name X-Git-Tag: develop-gem5-snapshot~373 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c07c011f5c7e6ae453e06eb8af963c76f00fcc0;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38337 Reviewed-by: Daniel Carvalho Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/src/base/stats/group.cc b/src/base/stats/group.cc index f1eda1d6d..de546cda6 100644 --- a/src/base/stats/group.cc +++ b/src/base/stats/group.cc @@ -37,8 +37,7 @@ #include "base/stats/group.hh" -#include - +#include "base/logging.hh" #include "base/stats/info.hh" #include "base/trace.hh" #include "debug/Stats.hh" @@ -112,7 +111,8 @@ Group::addStat(Stats::Info *info) 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; }