misc: Fix hdf5 stats + test
HDF5 stats file creation was not completing correctly due to name clashes. Change-Id: Ifc2d52f4bbc62b0c6798ce92f4d027b0ec69a373 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51061 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "base/stats/info.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "debug/Stats.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -254,6 +256,8 @@ Hdf5::appendStat(const Info &info, int rank, hsize_t *dims, const double *data)
|
||||
|
||||
fspace = H5::DataSpace(rank, dims, max_dims.data());
|
||||
try {
|
||||
DPRINTF(Stats, "Creating dataset %s in group %s\n",
|
||||
info.name, group.getObjName());
|
||||
data_set = group.createDataSet(info.name,
|
||||
H5::PredType::NATIVE_DOUBLE, fspace, props);
|
||||
} catch (const H5::Exception &e) {
|
||||
|
||||
@@ -143,7 +143,7 @@ IEW::regProbePoints()
|
||||
}
|
||||
|
||||
IEW::IEWStats::IEWStats(CPU *cpu)
|
||||
: statistics::Group(cpu),
|
||||
: statistics::Group(cpu, "iew"),
|
||||
ADD_STAT(idleCycles, statistics::units::Cycle::get(),
|
||||
"Number of cycles IEW is idle"),
|
||||
ADD_STAT(squashCycles, statistics::units::Cycle::get(),
|
||||
|
||||
@@ -1893,10 +1893,6 @@ DRAMInterface::DRAMStats::DRAMStats(DRAMInterface &_dram)
|
||||
|
||||
ADD_STAT(bytesPerActivate, statistics::units::Byte::get(),
|
||||
"Bytes accessed per row activation"),
|
||||
ADD_STAT(bytesRead, statistics::units::Byte::get(),
|
||||
"Total number of bytes read from DRAM"),
|
||||
ADD_STAT(bytesWritten, statistics::units::Byte::get(),
|
||||
"Total number of bytes written to DRAM"),
|
||||
ADD_STAT(avgRdBW, statistics::units::Rate<
|
||||
statistics::units::Byte, statistics::units::Second>::get(),
|
||||
"Average DRAM read bandwidth in MiBytes/s"),
|
||||
@@ -2548,10 +2544,6 @@ NVMInterface::NVMStats::NVMStats(NVMInterface &_nvm)
|
||||
statistics::units::Tick, statistics::units::Count>::get(),
|
||||
"Average memory access latency per NVM burst"),
|
||||
|
||||
ADD_STAT(bytesRead, statistics::units::Byte::get(),
|
||||
"Total number of bytes read from NVM"),
|
||||
ADD_STAT(bytesWritten, statistics::units::Byte::get(),
|
||||
"Total number of bytes written to NVM"),
|
||||
ADD_STAT(avgRdBW, statistics::units::Rate<
|
||||
statistics::units::Byte, statistics::units::Second>::get(),
|
||||
"Average DRAM read bandwidth in MiBytes/s"),
|
||||
|
||||
@@ -44,7 +44,6 @@ import re
|
||||
import os
|
||||
from testlib import *
|
||||
|
||||
|
||||
if config.bin_path:
|
||||
resource_path = config.bin_path
|
||||
else:
|
||||
@@ -68,12 +67,20 @@ if have_hdf5():
|
||||
ok_exit_regex = re.compile(
|
||||
r"Exiting @ tick \d+ because exiting with last active thread context"
|
||||
)
|
||||
ok_verifier = verifier.MatchRegex(ok_exit_regex)
|
||||
|
||||
# FIXME: flaky, should check return code instead...
|
||||
# See: https://gem5.atlassian.net/browse/GEM5-1099
|
||||
err_regex = re.compile(
|
||||
r'RuntimeError: Failed creating H5::DataSet \w+; .*'
|
||||
)
|
||||
err_verifier = verifier.NoMatchRegex(err_regex, True, False)
|
||||
|
||||
stdout_verifier = verifier.MatchRegex(ok_exit_regex)
|
||||
h5_verifier = verifier.CheckH5StatsExist()
|
||||
|
||||
gem5_verify_config(
|
||||
name="hdf5_test",
|
||||
verifiers=[stdout_verifier, h5_verifier],
|
||||
verifiers=[ok_verifier, err_verifier, h5_verifier],
|
||||
fixtures=(),
|
||||
config=joinpath(
|
||||
config.base_dir,
|
||||
@@ -92,3 +99,4 @@ if have_hdf5():
|
||||
gem5_args=["--stats-file=h5://stats.h5"],
|
||||
valid_isas=(constants.arm_tag,),
|
||||
)
|
||||
|
||||
|
||||
@@ -229,6 +229,21 @@ class MatchRegex(MatchFileRegex):
|
||||
filenames.append(constants.gem5_simulation_stderr)
|
||||
super(MatchRegex, self).__init__(regex, filenames)
|
||||
|
||||
class NoMatchRegex(MatchRegex):
|
||||
"""
|
||||
Checks that the given pattern does *not* match
|
||||
"""
|
||||
def __init__(self, regex, match_stderr=True, match_stdout=True):
|
||||
super(NoMatchRegex, self).__init__(regex, match_stderr, match_stdout)
|
||||
|
||||
def test(self, params):
|
||||
fixtures = params.fixtures
|
||||
tempdir = fixtures[constants.tempdir_fixture_name].path
|
||||
|
||||
for fname in self.filenames:
|
||||
if self.parse_file(joinpath(tempdir, fname)):
|
||||
test_util.fail('Could not match regex.')
|
||||
|
||||
_re_type = type(re.compile(''))
|
||||
def _iterable_regex(regex):
|
||||
if isinstance(regex, _re_type) or isinstance(regex, str):
|
||||
|
||||
Reference in New Issue
Block a user