Deleted Added
sdiff udiff text old ( 9852:16046705aa55 ) new ( 9853:20c07aa9322c )
full compact
1# Copyright (c) 2012-2013 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

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

124
125def dot_add_edge(simNode, callgraph, full_port_name, peerPort):
126 if peerPort.role == "MASTER":
127 peer_port_name = re.sub('\.', '_', peerPort.peer.simobj.path() \
128 + "." + peerPort.peer.name)
129 callgraph.add_edge(pydot.Edge(full_port_name, peer_port_name))
130
131def dot_create_cluster(simNode, full_path, label):
132 # if you read this, feel free to modify colors / style
133 return pydot.Cluster( \
134 full_path, \
135 shape = "Mrecord", \
136 label = label, \
137 style = "\"rounded, filled\"", \
138 color = "#000000", \
139 fillcolor = dot_gen_color(simNode), \
140 fontname = "Arial", \
141 fontsize = "14", \
142 fontcolor = "#000000" \
143 )
144
145def dot_create_node(simNode, full_path, label):
146 # if you read this, feel free to modify colors / style.
147 # leafs may have a different style => seperate function
148 return pydot.Node( \
149 full_path, \
150 shape = "Mrecord", \
151 label = label, \
152 style = "\"rounded, filled\"", \
153 color = "#000000", \
154 fillcolor = "#808080", \
155 fontname = "Arial", \
156 fontsize = "14", \
157 fontcolor = "#000000" \
158 )
159
160# generate color for nodes
161def dot_gen_color(simNode):
162 # start off with white
163 base = (256, 256, 256)
164 # scale the color based on the depth
165 depth = len(simNode.path().split('.'))
166 # slightly arbitrary, but assume that the depth is less than six
167 # levels
168 r, g, b = map(lambda x: x * max(1 - depth / 6.0, 0.3), base)
169
170 return dot_rgb_to_html(r, g, b)
171
172def dot_rgb_to_html(r, g, b):
173 return "#%.2x%.2x%.2x" % (r, g, b)
174
175def do_dot(root, outdir, dotFilename):
176 if not pydot:
177 return

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

185 dot_filename = os.path.join(outdir, dotFilename)
186 callgraph.write(dot_filename)
187 try:
188 # dot crashes if the figure is extremely wide.
189 # So avoid terminating simulation unnecessarily
190 callgraph.write_svg(dot_filename + ".svg")
191 callgraph.write_pdf(dot_filename + ".pdf")
192 except:
193 warn("failed to generate pdf output from %s", dot_filename)