Classes | |
class | Col |
Functions | |
def | readtable |
def | runme |
Variables | |
list | infile = sys.argv[1] |
list | lookupfile = sys.argv[3] |
list | outfile = sys.argv[2] |
int | use_name = 0 |
def EdgesToViz::readtable | ( | flook | ) |
Definition at line 25 of file EdgesToViz.py.
00025 : 00026 # field 7 is the library name 00027 tab = {} 00028 next = Col() 00029 cols = {} 00030 for line in flook.xreadlines(): 00031 s = line.split() 00032 if not s[7] in cols: 00033 cols[s[7]] = next.next() 00034 s.append(cols[s[7]]) 00035 tab[s[0]]=s 00036 return tab,cols 00037 00038 def runme(infile,outfile,lookupfile,use_name):
def EdgesToViz::runme | ( | infile, | ||
outfile, | ||||
lookupfile, | ||||
use_name | ||||
) |
Definition at line 39 of file EdgesToViz.py.
00039 : 00040 fin = open(infile,'r') 00041 flook = open(lookupfile,'r') 00042 fout = open(outfile,'w') 00043 00044 table,libcols = readtable(flook) 00045 00046 fout.write('digraph prof {') 00047 00048 uni = {} 00049 # d=1 00050 # for i in libcols.items(): 00051 # print >>fout,'lib%d [label="%s",style=filled,color=%s,fontsize=18];' % (d,os.path.basename(i[0].strip('"')),i[1]) 00052 # d += 1 00053 00054 00055 for line in fin.xreadlines(): 00056 count,from_node,to_node = line.split() 00057 uni[from_node] = 1 00058 uni[to_node] = 1 00059 row_to = table[to_node] 00060 row_from = table[from_node] 00061 00062 if row_from[-1] == row_to[-1]: 00063 color="\"#000000\"" 00064 else: 00065 row=table[to_node] 00066 color=row[-1] 00067 00068 print >>fout, '%s -> %s [label="%s",fontsize=18,color=%s];' % (from_node,to_node,count,color) 00069 00070 # print "blob",uni.keys 00071 00072 for function_id in uni.keys(): 00073 function_data = table[function_id] 00074 # print e 00075 node_label = function_data[0] 00076 if use_name: node_label = function_data[-2].strip('"') 00077 leaf_fraction = float(function_data[5]) 00078 recursive_fraction = float(function_data[6]) 00079 if recursive_fraction > .03 and recursive_fraction <.20: shape="box" 00080 else: shape="circle" 00081 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) 00082 00083 fout.write('}') 00084 if __name__ == "__main__":
list EdgesToViz::infile = sys.argv[1] [static] |
Definition at line 90 of file EdgesToViz.py.
list EdgesToViz::lookupfile = sys.argv[3] [static] |
Definition at line 92 of file EdgesToViz.py.
list EdgesToViz::outfile = sys.argv[2] [static] |
Definition at line 91 of file EdgesToViz.py.
int EdgesToViz::use_name = 0 [static] |
Definition at line 93 of file EdgesToViz.py.