summaryrefslogtreecommitdiff
path: root/src/python/m5/stats/__init__.py
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-01-03 12:03:45 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-01-03 12:03:45 +0000
commitc8b1e8f1cfdb5b66bacbbbd23dcf9ebb5a0f3b95 (patch)
treed5d367cc362881d9e00d2c881d86698549a735bd /src/python/m5/stats/__init__.py
parentabe7ef95cb89c68c6385162cb801bab8b27a585b (diff)
downloadgem5-c8b1e8f1cfdb5b66bacbbbd23dcf9ebb5a0f3b95.tar.xz
python: Don't use Swig to cast stats
Call the stat visitor from the stat itself rather than casting stats in Python. This reduces the number of ways visitors are called. Change-Id: Ic4d0b7b32e3ab9897b9a34cd22d353f4da62d738 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Joe Gross <joseph.gross@amd.com>
Diffstat (limited to 'src/python/m5/stats/__init__.py')
-rw-r--r--src/python/m5/stats/__init__.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/python/m5/stats/__init__.py b/src/python/m5/stats/__init__.py
index 4defaf5c1..f3d394311 100644
--- a/src/python/m5/stats/__init__.py
+++ b/src/python/m5/stats/__init__.py
@@ -49,25 +49,13 @@ def initSimStats():
names = []
stats_dict = {}
stats_list = []
-raw_stats_list = []
def enable():
'''Enable the statistics package. Before the statistics package is
enabled, all statistics must be created and initialized and once
the package is enabled, no more statistics can be created.'''
- __dynamic_cast = []
- for k, v in internal.stats.__dict__.iteritems():
- if k.startswith('dynamic_'):
- __dynamic_cast.append(v)
-
- for stat in internal.stats.statsList():
- for cast in __dynamic_cast:
- val = cast(stat)
- if val is not None:
- stats_list.append(val)
- raw_stats_list.append(val)
- break
- else:
- fatal("unknown stat type %s", stat)
+
+ global stats_list
+ stats_list = list(internal.stats.statsList())
for stat in stats_list:
if not stat.check() or not stat.baseCheck():
@@ -116,7 +104,7 @@ def dump():
if output.valid():
output.begin()
for stat in stats_list:
- output.visit(stat)
+ stat.visit(output)
output.end()
def reset():