Deleted Added
sdiff udiff text old ( 14205:197360deaa20 ) new ( 14206:9cd30cd80145 )
full compact
1# Copyright (c) 2017, 2019 Arm Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 144 unchanged lines hidden (view full) ---

153 fatal("Illegal stat file type specified.")
154
155 outputList.append(factory(parsed))
156
157def initSimStats():
158 _m5.stats.initSimStats()
159 _m5.stats.registerPythonStatsHandlers()
160
161def _visit_groups(root, visitor):
162 for group in root.getStatGroups().values():
163 visitor(group)
164 _visit_groups(group, visitor)
165
166def _visit_stats(root, visitor):
167 def for_each_stat(g):
168 for stat in g.getStats():
169 visitor(g, stat)
170 _visit_groups(root, for_each_stat)
171
172def _bindStatHierarchy(root):
173 def _bind_obj(name, obj):
174 if m5.SimObject.isSimObjectVector(obj):
175 for idx, obj in enumerate(obj):
176 _bind_obj("{}{}".format(name, idx), obj)
177 else:
178 root.addStatGroup(name, obj.getCCObject())

--- 28 unchanged lines hidden (view full) ---

207
208 stats_list.sort(key=lambda s: s.name.split('.'))
209 for stat in stats_list:
210 stats_dict[stat.name] = stat
211 stat.enable()
212
213
214 # New stats
215 _visit_stats(Root.getInstance(), check_stat)
216 _visit_stats(Root.getInstance(), lambda g, s: s.enable())
217
218 _m5.stats.enable();
219
220def prepare():
221 '''Prepare all stats for data access. This must be done before
222 dumping and serialization.'''
223
224 # Legacy stats
225 for stat in stats_list:
226 stat.prepare()
227
228 # New stats
229 _visit_stats(Root.getInstance(), lambda g, s: s.prepare())
230
231lastDump = 0
232
233def _dump_to_visitor(visitor):
234 # Legacy stats
235 for stat in stats_list:
236 stat.visit(visitor)
237
238 # New stats
239 def dump_group(group):
240 for stat in group.getStats():
241 stat.visit(visitor)
242
243 for n, g in group.getStatGroups().items():
244 visitor.beginGroup(n)
245 dump_group(g)
246 visitor.endGroup()
247
248 dump_group(Root.getInstance())
249
250
251def dump():
252 '''Dump all statistics data to the registered outputs'''
253
254 curTick = m5.curTick()
255
256 global lastDump
257 assert lastDump <= curTick
258 if lastDump == curTick:
259 return
260 lastDump = curTick
261
262 _m5.stats.processDumpQueue()
263
264 prepare()
265
266 for output in outputList:
267 if output.valid():
268 output.begin()
269 _dump_to_visitor(output)
270 output.end()
271
272def reset():
273 '''Reset all statistics to the base state'''
274
275 # call reset stats on all SimObjects
276 root = Root.getInstance()
277 if root:

--- 19 unchanged lines hidden ---