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 <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43590
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2021-03-21 16:00:57 -03:00
committed by Daniel Carvalho
parent cdc5758b51
commit 499a1cc7e8
2 changed files with 2 additions and 2 deletions

View File

@@ -86,7 +86,7 @@ validateStatName(const std::string &name)
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())

View File

@@ -870,7 +870,7 @@ $c_ident::regStats()
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());