Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/43590 )

Change subject: base-stats,mem: Fix empty Stats::Info names
......................................................................

base-stats,mem: Fix empty Stats::Info names

Sub-groups should not contain empty names. To make sure
that is the case, generate tokens even if the string is
empty.

Before the name 'group1..group2' would generate 2 tokens:
'group1' and 'group2'. As such, validateStatName would
not be able to detect it was an invalid name. With this
change three tokens will be generated: 'group1', '',
and 'group2'. The empty string will then trigger the
item->empty() check, which will successfully inform that
such stat name is not valid.

SLICC was breaking this rule with one of its stats by
creating a sub-group (inTransLatHist) whose parent had
an empty name, so it has been fixed.

Change-Id: Ica5ca684911374d59a0a809636594d048d755deb
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43590
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/stats/info.cc
M src/mem/slicc/symbols/StateMachine.py
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/stats/info.cc b/src/base/stats/info.cc
index c6024e7..de1fb7f 100644
--- a/src/base/stats/info.cc
+++ b/src/base/stats/info.cc
@@ -86,7 +86,7 @@
         return false;

     std::vector<std::string> vec;
-    tokenize(vec, name, '.');
+    tokenize(vec, name, '.', false);
     std::vector<std::string>::const_iterator item = vec.begin();
     while (item != vec.end()) {
         if (item->empty())
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index 77c999d..0c4651d 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -870,7 +870,7 @@

     for (${ident}_Event event = ${ident}_Event_FIRST;
                  event < ${ident}_Event_NUM; ++event) {
-        std::string stat_name = ".inTransLatHist." +
+        std::string stat_name = "inTransLatHist." +
                                 ${ident}_Event_to_string(event);
         statistics::Scalar* r = new statistics::Scalar(&stats,
(stat_name + ".total").c_str());

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43590
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: Ica5ca684911374d59a0a809636594d048d755deb
Gerrit-Change-Number: 43590
Gerrit-PatchSet: 11
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to