6 Prepare the clones plot. 7 Parses the end of the output file, printed by the destructors of the CPUCruncher. 8 A line with the pattern "Summary: name=" is looked for. 9 The number of Events in flight is parsed as well. 22 global NEventsInFlight
24 ifile = open(logfilename,
"r") 25 lines = ifile.readlines() 28 if "Summary: name=" in line:
29 runtime_nclones =
map(float,
30 re.match(
".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",line).groups())
31 vals.append(runtime_nclones)
32 elif "Running with" in line:
33 NEventsInFlight,NThreads=
map( int, re.match(
".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",line).groups())
38 graph = TGraph(len(vals))
40 for runtime,nclones
in vals:
41 graph.SetPoint(counter, runtime, nclones)
44 graph.SetMarkerStyle(MarkerStyle)
45 graph.SetMarkerSize(MarkerSize)
46 graph.SetMarkerColor(Color)
47 graph.SetTitle(
"GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones")
50 def getText(x,y,text,scale,angle,colour,font,NDC=False):
51 lat = TLatex(float(x),float(y),
52 "#scale[%s]{#color[%s]{#font[%s]{%s}}}"%(scale,colour,font,text))
56 lat.SetTextAngle(angle)
61 def getNclones(runtime_nclones):
62 return runtime_nclones[1]
63 max_nclones = int(max(vals,key=getNclones)[1])
67 for i
in xrange(1,max_nclones+1):
68 n_algos = len( filter(
lambda runtime_nclones:runtime_nclones[1]== i ,vals) )
69 latexes.append(
getText(xmax*1.01,
92 global NEventsInFlight
96 nalgorithms = len(vals)
98 canvas = TCanvas(
"Clones",
"Clones",1024,768)
106 map(
lambda latex:latex.Draw(),countLatexes)
108 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"%(NEventsInFlight,NThreads,nalgorithms),
113 a= raw_input(
"press enter to continue")
114 canvas.Print(
"PlotClones.png")
118 if __name__ ==
"__main__":
121 print "Usage: plotClonesPyRoot.py logfilename" def getText(x, y, text, scale, angle, colour, font, NDC=False)
def parseLog(logfilename)
def getCountLatexes(vals, xmax)
struct GAUDI_API map
Parametrisation class for map-like implementation.