14 rc =
"\"%f,%f,%f\""%(me.h,me.s,me.b)
30 for line
in flook.xreadlines():
33 cols[s[7]] = next.next()
39 def runme(infile,outfile,lookupfile,use_name):
40 fin = open(infile,
'r')
41 flook = open(lookupfile,'r')
42 fout = open(outfile,'w')
46 fout.write(
'digraph prof {')
55 for line
in fin.xreadlines():
56 count,from_node,to_node = line.split()
59 row_to = table[to_node]
60 row_from = table[from_node]
62 if row_from[-1] == row_to[-1]:
68 print >>fout,
'%s -> %s [label="%s",fontsize=18,color=%s];' % (from_node,to_node,count,color)
72 for function_id
in uni.keys():
73 function_data = table[function_id]
75 node_label = function_data[0]
76 if use_name: node_label = function_data[-2].
strip(
'"')
77 leaf_fraction = float(function_data[5])
78 recursive_fraction = float(function_data[6])
79 if recursive_fraction > .03
and recursive_fraction <.20: shape=
"box"
81 print >>fout,
'%s [label="ID: %s\\nL: %5.1f%%\\nB: %5.1f%%",style=filled,color=%s,shape=%s,fontsize=18];' % (node_label,node_label,leaf_fraction*100, recursive_fraction*100,function_data[-1],shape)
85 if __name__ ==
"__main__":
87 print "usage: ", sys.argv[0],
" edge_input_file digraph_output_file func_names_lookup_file"
92 lookupfile = sys.argv[3]
94 if len(sys.argv)>4: use_name=1
95 runme(infile, outfile, lookupfile,use_name)