From 1097aa1638dc3b1e009738932908ab5c253b461b Mon Sep 17 00:00:00 2001 From: Sascha Bischoff Date: Wed, 6 Apr 2016 17:55:17 +0100 Subject: misc: Bail out of DVFS dot if we cannot resolve the domains This changeset updates the dot output to bail out if it is unable to resolve the voltage or clock domains (which will cause it to raise an AttributeError). Additionally, the DVFS dot output is disabled by default for speed purposes. Minor fixup for 0aeca8f. --- src/python/m5/main.py | 2 +- src/python/m5/simulate.py | 3 ++- src/python/m5/util/dot_writer.py | 22 +++++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/python/m5/main.py b/src/python/m5/main.py index ea2a06e9e..36d3d7d35 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -91,7 +91,7 @@ def parse_options(): help="Create JSON output of the configuration [Default: %default]") option("--dot-config", metavar="FILE", default="config.dot", help="Create DOT & pdf outputs of the configuration [Default: %default]") - option("--dot-dvfs-config", metavar="FILE", default="config_dvfs.dot", + option("--dot-dvfs-config", metavar="FILE", default=None, help="Create DOT & pdf outputs of the DVFS configuration" + \ " [Default: %default]") diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 1d7ebeb9d..b3ae367ba 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -129,7 +129,8 @@ def instantiate(ckpt_dir=None): # We want to generate the DVFS diagram for the system. This can only be # done once all of the CPP objects have been created and initialised so # that we are able to figure out which object belongs to which domain. - do_dvfs_dot(root, options.outdir, options.dot_dvfs_config) + if options.dot_dvfs_config: + do_dvfs_dot(root, options.outdir, options.dot_dvfs_config) # We're done registering statistics. Enable the stats package now. stats.enable() diff --git a/src/python/m5/util/dot_writer.py b/src/python/m5/util/dot_writer.py index f0ad15adf..501af5174 100644 --- a/src/python/m5/util/dot_writer.py +++ b/src/python/m5/util/dot_writer.py @@ -310,7 +310,7 @@ def dot_create_dvfs_nodes(simNode, callgraph, domain=None): except AttributeError: # Just re-use the domain from above c_dom = domain - c_dom.__getattr__('voltage_domain') + v_dom = c_dom.__getattr__('voltage_domain') pass if c_dom == domain or c_dom == None: @@ -329,7 +329,7 @@ def dot_create_dvfs_nodes(simNode, callgraph, domain=None): except AttributeError: # Just re-use the domain from above c_dom = domain - c_dom.__getattr__('voltage_domain') + v_dom = c_dom.__getattr__('voltage_domain') pass if c_dom == domain or c_dom == None: @@ -370,11 +370,19 @@ def do_dot(root, outdir, dotFilename): def do_dvfs_dot(root, outdir, dotFilename): if not pydot: return - dvfsgraph = pydot.Dot(graph_type='digraph', ranksep='1.3') - dot_create_dvfs_nodes(root, dvfsgraph) - dot_create_edges(root, dvfsgraph) - dot_filename = os.path.join(outdir, dotFilename) - dvfsgraph.write(dot_filename) + + # There is a chance that we are unable to resolve the clock or + # voltage domains. If so, we fail silently. + try: + dvfsgraph = pydot.Dot(graph_type='digraph', ranksep='1.3') + dot_create_dvfs_nodes(root, dvfsgraph) + dot_create_edges(root, dvfsgraph) + dot_filename = os.path.join(outdir, dotFilename) + dvfsgraph.write(dot_filename) + except: + warn("Failed to generate dot graph for DVFS domains") + return + try: # dot crashes if the figure is extremely wide. # So avoid terminating simulation unnecessarily -- cgit v1.2.3