Commit 84d2593c authored by Maxime Perrotin's avatar Maxime Perrotin

Improve rendering of the dumped models

parent 9193650f
group taste;
interface_view(arrsFunctNames, arrsConnections) ::= <<
interface_view(arrsThreadNames, arrsPassiveNames, arrsConnections) ::= <<
# TASTE Interface View
# Save this output to file.dot and run "neato file.dot -Tpng -o out.png"
......@@ -8,12 +8,13 @@ digraph interfaceview {
overlap=scale;
splines=ortho;
sep=0.2;
<arrsFunctNames: {each| <each> [shape=box, style=filled, fontsize=36, margin=0.8 label="<each>"];}; separator="\n">
<arrsThreadNames: {each| <each> [shape=parallelogram, style=filled, fontsize=24, label="<each>"];}; separator="\n">
<arrsPassiveNames: {each| <each> [shape=box, fillcolor=cyan, style="filled, rounded", fontsize=20, label="<each>"];}; separator="\n">
<arrsConnections; separator="\n">
}
>>
connection(sFrom, sTo, arrsMessages) ::= <<
<sFrom> -> <sTo> [fontsize=20, color=blue, label="[<arrsMessages; separator=",\n">]"];
<sFrom> -> <sTo> [fontsize=14, color=blue, taillabel="[<arrsMessages; separator=",\n">]"];
>>
......@@ -21,32 +21,40 @@ initialize_stg()
tpl = new("interface_view")
#tpl['arrsFunctNames'] = iv.functions.keys()
# allow user to filter out function names
# they will still appear, but as bubbles
tpl['arrsFunctNames'] = [fName for fName in iv.functions.keys()
if fName.lower() not in sys.argv[1:]]
# all parameters in argv will be filted out
tpl['arrsThreadNames'] = [fName for fName in iv.functions.keys()
if fName.lower() not in sys.argv[1:] and
iv.functions[fName]['runtime_nature'] == iv.thread]
tpl['arrsPassiveNames'] = [fName for fName in iv.functions.keys()
if fName.lower() not in sys.argv[1:] and
iv.functions[fName]['runtime_nature'] != iv.thread]
connections = [] # type: List[str]
for fromName, content in iv.functions.viewitems():
group = defaultdict(list)
if fromName in sys.argv[1:]:
continue
for iName, iContent in content['interfaces'].viewitems():
if iContent['direction'] == iv.RI:
group[iContent['distant_fv']].append(iName)
if iName.lower() == content['interfaces'][iName]['distant_name']:
text = iName
else:
text = '{} -> {}'.format(iName,
content['interfaces'][iName]['distant_name'])
group[iContent['distant_fv']].append(text)
for destName, destContent in group.viewitems():
if destName in sys.argv[1:]:
continue
tplConn = new("connection")
tplConn['sFrom'] = fromName
tplConn['sTo'] = destName
tplConn = new("connection")
tplConn['sFrom'] = fromName
tplConn['sTo'] = destName
tplConn['arrsMessages'] = destContent
connections.append(str(tplConn))
tpl['arrsConnections'] = connections
print str(tpl).encode('latin1')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment