17 from __future__
import print_function
19 __author__ =
"Sebastien Binet <binet@cern.ch>"
26 ini =
'Initialization'
29 ALLOWED = (
'ini',
'exe',
'fin')
32 beg_pat = re.compile(
r"NameAuditor.*?About to Enter "
35 end_pat = re.compile(
r"NameAuditor.*?Just Exited "
42 for l
in open(fname,
'r'):
44 beg = re.match(beg_pat, l)
45 end = re.match(end_pat, l)
50 component = beg.group(
'CompName')
53 graph += [ (stack, component) ]
56 component = end.group(
'CompName')
63 if __name__ ==
'__main__':
65 raise SystemExit(1,
"You have to provide a path to a logfile to parse")
67 fname = os.path.expandvars(os.path.expanduser(sys.argv[1]))
68 if not os.path.exists(fname):
70 1,
"You have to provide a VALID path to a logfile to parse")
74 step = sys.argv[2].lower()
75 if step
not in Steps.ALLOWED:
77 2,
"Invalid step name [%s] allowed=%r"%(step, Steps.ALLOWED))
79 step = getattr(Steps,step)
84 print (
".."*(i[0]+1),i[1])