test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
EdgesToViz Namespace Reference

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
 

Function Documentation

def EdgesToViz.readtable (   flook)

Definition at line 25 of file EdgesToViz.py.

Referenced by runme().

25 
26 def readtable(flook):
27  # field 7 is the library name
28  tab = {}
29  next = Col()
30  cols = {}
31  for line in flook.xreadlines():
32  s = line.split()
33  if not s[7] in cols:
34  cols[s[7]] = next.next()
35  s.append(cols[s[7]])
36  tab[s[0]]=s
37  return tab,cols
38 
def readtable
Definition: EdgesToViz.py:25
def EdgesToViz.runme (   infile,
  outfile,
  lookupfile,
  use_name 
)

Definition at line 39 of file EdgesToViz.py.

References readtable().

39 
40 def runme(infile,outfile,lookupfile,use_name):
41  fin = open(infile,'r')
42  flook = open(lookupfile,'r')
43  fout = open(outfile,'w')
44 
45  table,libcols = readtable(flook)
46 
47  fout.write('digraph prof {')
48 
49  uni = {}
50 # d=1
51 # for i in libcols.items():
52 # print >>fout,'lib%d [label="%s",style=filled,color=%s,fontsize=18];' % (d,os.path.basename(i[0].strip('"')),i[1])
53 # d += 1
54 
55 
56  for line in fin.xreadlines():
57  count,from_node,to_node = line.split()
58  uni[from_node] = 1
59  uni[to_node] = 1
60  row_to = table[to_node]
61  row_from = table[from_node]
62 
63  if row_from[-1] == row_to[-1]:
64  color="\"#000000\""
65  else:
66  row=table[to_node]
67  color=row[-1]
68 
69  print >>fout, '%s -> %s [label="%s",fontsize=18,color=%s];' % (from_node,to_node,count,color)
70 
71  # print "blob",uni.keys
72 
73  for function_id in uni.keys():
74  function_data = table[function_id]
75  # print e
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"
81  else: shape="circle"
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)
83 
84  fout.write('}')
def readtable
Definition: EdgesToViz.py:25

Variable Documentation

list EdgesToViz.infile = sys.argv[1]

Definition at line 90 of file EdgesToViz.py.

list EdgesToViz.lookupfile = sys.argv[3]

Definition at line 92 of file EdgesToViz.py.

list EdgesToViz.outfile = sys.argv[2]

Definition at line 91 of file EdgesToViz.py.

int EdgesToViz.use_name = 0

Definition at line 93 of file EdgesToViz.py.