| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

jsonFromLHCbLog.py
Go to the documentation of this file.
1 from pygraph.classes.graph import graph
2
3 def load_brunel_scenario(filename):
4 gr = graph()
5 algs = {}
6 timing = {}
7 objs = []
8 curr = None
9 order = 0
10 nodes = ('/Event', '/Event/Rec', '/Event/DAQ')
11 for l in open(filename).readlines():
12 if l.find('StoreTracer') == 0:
13 if l.find('Executing Algorithm') != -1:
14 alg = l.split()[-1]
15 if alg not in algs.keys() : algs[alg] = (order, set(),set())
16 curr = alg
17 order += 1
18 elif l.find('Done with Algorithm') != -1:
19 curr = None
20 elif l.find('[EventDataSvc]') != -1 and curr:
21 obj = l.split()[-1]
22 if obj in nodes : continue
23 if obj.find('/Event/') == 0 : obj = obj[7:]
24 obj = obj.replace('/','_')
25 if obj not in objs : objs.append(obj)
26 talg = algs[curr]
27 if l.find('RETRIEVE') != -1:
28 if obj not in talg[1] : talg[1].add(obj)
29 elif l.find('REGOBJ') != -1:
30 if obj not in talg[2] : talg[2].add(obj)
31 if l.find("TimingAuditor") != -1:
32 algo = l.split()[2]#.rstrip("|")
33 index = 13
34 if algo.endswith("|"):
35 index = 12
36 algo = algo.rstrip("|")
37 if algo in algs.keys():
38 timing[algo] = l.split()[index]
39 else:
40 for name in algs.keys():
41 if name.startswith(algo):
42 timing[name] = l.split()[index]
43
44 all_algos = []
45 for i, (alg,deps) in enumerate(algs.items()):
46 if alg in ["PatPVOffline","PrsADCs"]: continue
47 if deps[1] or deps[2] :
48 inputs = []
49 inputs = [item for item in deps[1] if item not in ("DAQ_ODIN","DAQ_RawEvent") and item not in deps[2]]
50 outputs = [item for item in deps[2]]
51 new_algo = {"name": alg, "inputs": inputs, "outputs" : outputs, "runtimes_wall" : [float(timing[alg])] }
52 all_algos.append(new_algo)
53 return all_algos
54
55 #####
56 if __name__ == "__main__":
57 json = {}
58 json["algorithms"] = load_brunel_scenario("Brunel.TES.trace.log")
59 print json
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:32
plotSpeedupsPyRoot.graph
graph
Definition: plotSpeedupsPyRoot.py:134
jsonFromLHCbLog.load_brunel_scenario
def load_brunel_scenario(filename)
Definition: jsonFromLHCbLog.py:3