40 def runme(infile,outfile,lookupfile,use_name):
41 fin = open(infile,
'r')
42 flook = open(lookupfile,'r')
43 fout = open(outfile,'w')
47 fout.write(
'digraph prof {')
56 for line
in fin.xreadlines():
57 count,from_node,to_node = line.split()
60 row_to = table[to_node]
61 row_from = table[from_node]
63 if row_from[-1] == row_to[-1]:
69 print >>fout,
'%s -> %s [label="%s",fontsize=18,color=%s];' % (from_node,to_node,count,color)
73 for function_id
in uni.keys():
74 function_data = table[function_id]
76 node_label = function_data[0]
77 if use_name: node_label = function_data[-2].strip(
'"')
78 leaf_fraction = float(function_data[5])
79 recursive_fraction = float(function_data[6])
80 if recursive_fraction > .03
and recursive_fraction <.20: shape=
"box"
82 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)