summaryrefslogtreecommitdiff
path: root/src/python/m5/SimObject.py
diff options
context:
space:
mode:
authorUri Wiener <uri.wiener@arm.com>2012-05-10 18:04:27 -0500
committerUri Wiener <uri.wiener@arm.com>2012-05-10 18:04:27 -0500
commitcb1b63ea61c597e680adf80540ad65abeceb76a8 (patch)
treeb6831287e68560541031484a9fafcb3919474580 /src/python/m5/SimObject.py
parentf2f7fa1a1c23da74c6ca8da8e6539f3330b06da4 (diff)
downloadgem5-cb1b63ea61c597e680adf80540ad65abeceb76a8.tar.xz
DOT: fixed broken code for visualizing configuration using dot
Fixed broken code which visualizes the system configuration by generating a tree from each component's children, starting from root. Requires DOT (hence pydot).
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r--src/python/m5/SimObject.py61
1 files changed, 28 insertions, 33 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index c1f0ff63e..04b4af69d 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1061,47 +1061,42 @@ class SimObject(object):
self._ccObject.takeOverFrom(old_cpu._ccObject)
# generate output file for 'dot' to display as a pretty graph.
- # this code is currently broken.
def outputDot(self, dot):
- label = "{%s|" % self.path
- if isSimObject(self.realtype):
- label += '%s|' % self.type
+ if isRoot(self):
+ label = "{root|"
+ else:
+ label = "{%s|" % self._name
- if self.children:
- # instantiate children in same order they were added for
- # backward compatibility (else we can end up with cpu1
- # before cpu0).
- for c in self.children:
- dot.add_edge(pydot.Edge(self.path,c.path, style="bold"))
+ if isSimObject(self._base):
+ label += '%s|' % self.type
- simobjs = []
- for param in self.params:
- try:
- if param.value is None:
- raise AttributeError, 'Parameter with no value'
+ if self._children:
+ for c in self._children:
+ child = self._children[c]
+ if isSimObjectVector(child):
+ for obj in child:
+ dot.add_edge(pydot.Edge(self.path(), obj.path(), style="bold"))
+ else:
+ dot.add_edge(pydot.Edge(self.path(), child.path(), style="bold"))
- value = param.value
- string = param.string(value)
- except Exception, e:
- msg = 'exception in %s:%s\n%s' % (self.name, param.name, e)
- e.args = (msg, )
- raise
-
- if isSimObject(param.ptype) and string != "Null":
- simobjs.append(string)
- else:
- label += '%s = %s\\n' % (param.name, string)
+ for param in self._params.keys():
+ value = self._values.get(param)
+ if value != None:
+ ini_str_value = self._values[param].ini_str()
+ label += '%s = %s\\n' % (param, re.sub(':', '-', ini_str_value))
- for so in simobjs:
- label += "|<%s> %s" % (so, so)
- dot.add_edge(pydot.Edge("%s:%s" % (self.path, so), so,
- tailport="w"))
label += '}'
- dot.add_node(pydot.Node(self.path,shape="Mrecord",label=label))
+
+ dot.add_node(pydot.Node(self.path(), shape="Mrecord",label=label))
# recursively dump out children
- for c in self.children:
- c.outputDot(dot)
+ for c in self._children:
+ child = self._children[c]
+ if isSimObjectVector(child):
+ for obj in child:
+ obj.outputDot(dot)
+ else:
+ child.outputDot(dot)
# Function to provide to C++ so it can look up instances based on paths
def resolveSimObject(name):