6 Produces the backlog plot, parsing the output of the EventLoopManager. 7 Lines with the pattern "Event backlog" are looked for. 8 Events in flight are looked for as well. 18 Colors = [kBlue, kGreen + 2]
19 MarkerStyles = [kOpenCircle, kFullCircle]
31 global NEventsInFlight
33 ifile = open(logfilename,
"r") 34 lines = ifile.readlines() 38 if "Event backlog" in line:
40 re.match(
".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*", line).groups())
41 elif "Running with" in line:
42 NEventsInFlight, NThreads =
map(int, re.match(
43 ".*Running with ([0-9]*).* ([0-9]*) threads", line).groups())
51 graph = TGraph(len(max_min_blog_vals))
53 for maxn, minn, blog
in max_min_blog_vals:
55 graph.SetPoint(counter, counter + 1, float(blog))
60 graph.SetMarkerSize(MarkesSize)
61 graph.SetMarkerStyle(MarkerStyles[graphCounter])
62 graph.SetMarkerColor(Colors[graphCounter])
63 graph.SetLineWidth(LineWidth)
64 graph.SetLineColor(Colors[graphCounter])
65 graph.SetLineStyle(LineStyles[graphCounter])
73 global NEventsInFlight
75 graph.SetPoint(0, 0., float(NEventsInFlight))
76 graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
78 graph.SetLineColor(kRed)
81 "GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
86 def getText(x, y, text, scale, angle, colour, font, NDC=False):
87 lat = TLatex(float(x), float(y),
88 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
92 lat.SetTextAngle(angle)
96 def doPlot(logfilename, logfilename_copy):
97 global NEventsInFlight
107 canvas = TCanvas(
"Backlog",
"Backlog", 1100, 900)
110 inFlightgraph.Draw(
"APL")
111 inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
112 inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
114 graph_c.Draw(
"PLSame")
117 eventInFlightLabel =
getText(float(n_vals + 1) * 1.03, NEventsInFlight,
118 "#splitline{# Simultaneous}{ Events}", .6, 270, 2, 12)
119 eventInFlightLabel.Draw()
120 nThreadsLabel =
getText(.15, .7,
"%s Threads" %
121 NThreads, .6, 0, 2, 12,
True)
125 legend = TLegend(.7, .75, .9, .9)
126 legend.SetFillColor(kWhite)
127 legend.SetHeader(
"Algo Management")
128 legend.AddEntry(graph,
"No Cloning", LegendDrawOpts)
129 legend.AddEntry(graph_c,
"Cloning enabled", LegendDrawOpts)
132 a = raw_input(
"press enter to continue")
134 canvas.Print(
"EventBacklog.png")
137 if __name__ ==
"__main__":
140 print "Usage: plotBacklogPyRoot.py logfilename logfilename_copy" 142 doPlot(sys.argv[1], sys.argv[2])
def getText(x, y, text, scale, angle, colour, font, NDC=False)
struct GAUDI_API map
Parametrisation class for map-like implementation.
def parseLog(logfilename)
def createInFlightGraph(nevts)
def doPlot(logfilename, logfilename_copy)
def createGraph(max_min_blog_vals)