stats: add option to disable alignment spaces in stats.txt file

The alignment spaces in stats.txt takes up a lot of space and increases
simulation time, this commit adds the option to disable them with:

--stats-file stats.txt?spaces=False

Sample old lines with ?desc=False:

system.cpu.op_class::FloatMultAcc                   0      0.00%     65.92%
system.cpu.op_class::FloatDiv                       0      0.00%     65.92%

Sample new lines with ?desc=False;spaces=False:

system.cpu.op_class::FloatMultAcc 0 0.00% 65.92%
system.cpu.op_class::FloatDiv 0 0.00% 65.92%

On a 1000 dumpstats m5op loop spaces=False reduces:

* size: from 38MB to 20MB
* time: from 4.5s to 3.5s

Change-Id: Ib738b996b5646c329094cf61aaa1d977e844e759
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28627
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-16 18:02:26 +00:00
parent acb771be91
commit 182effa273
3 changed files with 71 additions and 28 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
@@ -131,7 +131,7 @@ def _url_factory(schemes, enable=True):
return decorator
@_url_factory([ None, "", "text", "file", ])
def _textFactory(fn, desc=True):
def _textFactory(fn, desc=True, spaces=True):
"""Output stats in text format.
Text stat files contain one stat per line with an optional
@@ -140,13 +140,14 @@ def _textFactory(fn, desc=True):
Parameters:
* desc (bool): Output stat descriptions (default: True)
* spaces (bool): Output alignment spaces (default: True)
Example:
text://stats.txt?desc=False
text://stats.txt?desc=False;spaces=False
"""
return _m5.stats.initText(fn, desc)
return _m5.stats.initText(fn, desc, spaces)
@_url_factory([ "h5", ], enable=hasattr(_m5.stats, "initHDF5"))
def _hdf5Factory(fn, chunking=10, desc=True, formulas=True):