This CL adds resolve, a function in the Stats namespace that allows
access to a stat as specified by its name.
Change-Id: I4fa8bed394b4cb35d9c6cf5d8db062b8d6bb9ca5
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27891
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
/*
- * Copyright (c) 2019 Arm Limited
+ * Copyright (c) 2019-2020 Arm Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
#include "base/str.hh"
#include "base/time.hh"
#include "base/trace.hh"
+#include "sim/root.hh"
using namespace std;
fatal("No registered Stats::reset handler");
}
+const Info *
+resolve(const std::string &name)
+{
+ const auto &it = nameMap().find(name);
+ if (it != nameMap().cend()) {
+ return it->second;
+ } else {
+ return Root::root()->resolveStat(name);
+ }
+}
+
void
registerDumpCallback(Callback *cb)
{
/*
- * Copyright (c) 2019 Arm Limited
+ * Copyright (c) 2019-2020 Arm Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
void reset();
void enable();
bool enabled();
+const Info* resolve(const std::string &name);
/**
* Register reset and dump handlers. These are the functions which