stats: allow stats to be reset even if no objects have been instantiated
authorNathan Binkert <nate@binkert.org>
Tue, 21 Dec 2010 16:02:41 +0000 (08:02 -0800)
committerNathan Binkert <nate@binkert.org>
Tue, 21 Dec 2010 16:02:41 +0000 (08:02 -0800)
src/python/m5/stats.py

index 76729d5ee42a5b9c772df02320a52dda15bd6cb0..907fad5319c6d7607a190bec91b75dc3d37de03f 100644 (file)
@@ -59,6 +59,8 @@ def dump():
 def reset():
     # call reset stats on all SimObjects
     root = Root.getInstance()
-    for obj in root.descendants(): obj.resetStats()
+    if root:
+        for obj in root.descendants(): obj.resetStats()
+
     # call any other registered stats reset callbacks
     internal.stats.reset()