17 __author__ =
"Sebastien Binet <binet@cern.ch>"
24 ini =
'Initialization'
27 ALLOWED = (
'ini',
'exe',
'fin')
30 beg_pat = re.compile(
r"NameAuditor.*?About to Enter "
33 end_pat = re.compile(
r"NameAuditor.*?Just Exited "
40 for l
in open(fname,
'r'):
42 beg = re.match(beg_pat, l)
43 end = re.match(end_pat, l)
48 component = beg.group(
'CompName')
51 graph += [ (stack, component) ]
54 component = end.group(
'CompName')
61 if __name__ ==
'__main__':
63 raise SystemExit(1,
"You have to provide a path to a logfile to parse")
65 fname = os.path.expandvars(os.path.expanduser(sys.argv[1]))
66 if not os.path.exists(fname):
68 1,
"You have to provide a VALID path to a logfile to parse")
72 step = sys.argv[2].lower()
73 if step
not in Steps.ALLOWED:
75 2,
"Invalid step name [%s] allowed=%r"%(step, Steps.ALLOWED))
77 step = getattr(Steps,step)
82 print (
".."*(i[0]+1),i[1])