summaryrefslogtreecommitdiff
path: root/src/python/m5/main.py
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-02-27 11:24:59 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-02-27 11:24:59 +0000
commit8b1ba9f99db97a6bcc07dd29b97e9ff60503eebf (patch)
treede0304fa95caba1a0ff1cadcac6f50d95b712ad6 /src/python/m5/main.py
parenta5802c823f4f6ec2bd97c953494551e31faa2cf8 (diff)
downloadgem5-8b1ba9f99db97a6bcc07dd29b97e9ff60503eebf.tar.xz
python: Add a generalized mechanism to configure stats
Add a mechanism to configure the stat output format using a URL-like syntax. This makes it possible to specify both an output format (currently, only text is supported) and override default parameters. On the Python-side, this is implemented using a helper function (m5.stats.addStatVisitor) that adds a visitor to the list of active stat visitors. The helper function parses a URL-like stat specification to determine the stat output type. Optional parameters can be specified to change how stat visitors behave. For example, to output stats in text format without stat descriptions: m5.stats.addStatVisitor("text://stats.txt?desc=False") From the command line: gem5.opt --stats-file="text://stats.txt?desc=False" Internally, the stat framework uses the _url_factory decorator to wrap a Python function with the fn(path, **kwargs) signature in a function that takes a parsed URL as its only argument. The path and keyword arguments are automatically derived from the URL in the wrapper function. New output formats can be registered in the m5.stats.factories dictionary. This dictionary contains a mapping between format names (URL schemes) and factory methods. To retain backwards compatibility, the code automatically assumes that the user wants text output if no format has been specified (i.e., when specifying a plain path). Change-Id: Ic4dce93ab4ead07ffdf71e55a22ba0ae5a143061 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Ilias Vougioukas <ilias.vougioukas@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com>
Diffstat (limited to 'src/python/m5/main.py')
-rw-r--r--src/python/m5/main.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index bbc708899..42c4911dc 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -319,7 +319,7 @@ def main(*args):
sys.path[0:0] = options.path
# set stats options
- stats.initText(options.stats_file)
+ stats.addStatVisitor(options.stats_file)
# set debugging options
debug.setRemoteGDBPort(options.remote_gdb_port)