CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
accesses.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 import re
3 warning = re.compile("warning: function")
4 tab = re.compile("\s+")
5 topfunc = re.compile("::produce$|::analyze$|::filter$")
6 paths = re.compile(".*?\s*src/([A-Z].*?/[A-z].*?)(/.*?):(.*?):(.*?)")
7 from collections import defaultdict
8 
9 gets = defaultdict(list)
10 calls = defaultdict(list)
11 
12 f = open('log.txt')
13 lines=[]
14 
15 for line in f:
16  if warning.search(line):
17  line = line.strip();
18 # print line
19  fields = line.split("\'")
20 # print fields
21  if fields[2] == ' calls ' :
22 # print fields[3]+" here\n"
23  if fields[3].strip() not in calls[fields[1]]:
24  calls[fields[1]].append(fields[3].strip())
25  else :
26 # print fields[3]+" not\n"
27  if fields[3].strip() not in gets[fields[1]]:
28  gets[fields[1]].append(fields[3].strip())
29  if topfunc.search(fields[1]):
30  dirs = paths.match(fields[0])
31  filename = dirs.group(1)+dirs.group(2)
32  line = filename+";"+fields[1]
33  if line not in lines:
34  lines.append(line)
35 
36 f.close()
37 
38 
39 lines.sort()
40 
41 import pprint
42 #pprint.pprint(gets)
43 #pprint.pprint(calls)
44 
45 def funcprint(str,nspaces):
46  "This prints out the get and calls of a function"
47  print "".join((nspaces * "\t")+"function:\t"+str)
48  for l in gets[str]:
49 # print l
50  lf = l.split(" edm::Handle ")
51 # print lf
52  if len(lf) == 2 :
53  print "".join(((nspaces+1) * "\t")+"acceses:\t"+lf[1].strip())
54  print "".join(((nspaces+2) * "\t")+"label:\t"+lf[0].strip())
55  else :
56  print "".join(((nspaces+1) * "\t")+"acceses:\t"+l.strip())
57  for call in calls[str]:
58  print "".join(((nspaces+1) * "\t")+"calls:\t"+call.strip())
59  if call != str: funcprint(call,(nspaces+2))
60  return
61 
62 for line in lines:
63  fields = line.split(";")
64 # print fields
65  print "Package and filename: "+fields[0]
66 # print fields[1]
67  funcprint(fields[1],1)
68  print "\n"
def funcprint
Definition: accesses.py:45
static std::string join(char **cmd)
Definition: RemoteFile.cc:18