From cb1b63ea61c597e680adf80540ad65abeceb76a8 Mon Sep 17 00:00:00 2001 From: Uri Wiener Date: Thu, 10 May 2012 18:04:27 -0500 Subject: 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). --- src/python/m5/simulate.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/python/m5/simulate.py') diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 38129592c..b1d01db3b 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -32,6 +32,12 @@ import atexit import os import sys +try: + import pydot +except: + pydot = False + + # import the SWIG-wrapped main C++ functions import internal import core @@ -82,6 +88,8 @@ def instantiate(ckpt_dir=None): except ImportError: pass + if pydot: + doDot(root) # Initialize the global statistics stats.initSimStats() @@ -113,14 +121,16 @@ def instantiate(ckpt_dir=None): stats.reset() def doDot(root): + from m5 import options dot = pydot.Dot() - instance.outputDot(dot) + root.outputDot(dot) dot.orientation = "portrait" dot.size = "8.5,11" dot.ranksep="equally" dot.rank="samerank" - dot.write("config.dot") - dot.write_ps("config.ps") + dot_filename = os.path.join(options.outdir, options.dot_config) + dot.write(dot_filename) + dot.write_pdf(dot_filename + ".pdf") need_resume = [] need_startup = True -- cgit v1.2.3