stats: add --stats-root option to dump only under some SimObjects

This commit makes it possible to make invocations such as:

gem5.opt se.py --stats-root 'system.cpu[:].dtb' --stats-root 'system.membus'

When --stats-root is given, only stats that are under any of the root
SimObjects get dumped. E.g. the above invocation would dump stats such as:

system.cpu0.dtb.walker.pwrStateResidencyTicks::UNDEFINED
system.cpu1.dtb.walker.pwrStateResidencyTicks::UNDEFINED
system.membus.pwrStateResidencyTicks::UNDEFINED
system.membus.trans_dist::ReadReq

but not for example `system.clk_domain.clock`.

If the --stats-root is given, only new stats as defined at:
Idc8ff448b9f70a796427b4a5231e7371485130b4 get dumped, and old ones are
ignored. The commits following that one have done some initial conversion
work, but many stats are still in the old format.

Change-Id: Iadaef26edf9a678b39f774515600884fbaeec497
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28628
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ciro Santilli
2020-03-17 16:51:14 +00:00
parent 01dd6dd460
commit 187ffa5be8
5 changed files with 61 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2017-2019 ARM Limited
# Copyright (c) 2017-2020 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -1071,6 +1071,9 @@ class SimObjectCliWrapper(object):
out.extend(sim_object[i] for i in _range)
return SimObjectCliWrapper(out)
def __iter__(self):
return iter(self._sim_objects)
# The SimObject class is the root of the special hierarchy. Most of
# the code in this class deals with the configuration hierarchy itself
# (parent/child node relationships).
@@ -1695,6 +1698,18 @@ class SimObject(object):
for param in params:
exec(param, d)
def get_simobj(self, simobj_path):
"""
Get all sim objects that match a given string.
The format is the same as that supported by SimObjectCliWrapper.
:param simobj_path: Current state to be in.
:type simobj_path: str
"""
d = self._apply_config_get_dict()
return eval(simobj_path, d)
# Function to provide to C++ so it can look up instances based on paths
def resolveSimObject(name):
obj = instanceDict[name]