28 Produces the backlog plot, parsing the output of the EventLoopManager.
29 Lines with the pattern "Event backlog" are looked for.
30 Events in flight are looked for as well.
40 Colors = [kBlue, kGreen + 2]
41 MarkerStyles = [kOpenCircle, kFullCircle]
53 global NEventsInFlight
55 ifile = open(logfilename,
"r")
56 lines = ifile.readlines()
60 if "Event backlog" in line:
63 r".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*", line
66 elif "Running with" in line:
67 NEventsInFlight, NThreads =
map(
69 re.match(
".*Running with ([0-9]*).* ([0-9]*) threads", line).groups(),
78 graph = TGraph(len(max_min_blog_vals))
80 for maxn, minn, blog
in max_min_blog_vals:
82 graph.SetPoint(counter, counter + 1, float(blog))
87 graph.SetMarkerSize(MarkesSize)
88 graph.SetMarkerStyle(MarkerStyles[graphCounter])
89 graph.SetMarkerColor(Colors[graphCounter])
90 graph.SetLineWidth(LineWidth)
91 graph.SetLineColor(Colors[graphCounter])
92 graph.SetLineStyle(LineStyles[graphCounter])
100 global NEventsInFlight
102 graph.SetPoint(0, 0.0, float(NEventsInFlight))
103 graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
104 graph.SetLineWidth(3)
105 graph.SetLineColor(kRed)
106 graph.SetLineStyle(2)
107 graph.SetTitle(
"GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
108 print(NEventsInFlight)
112 def getText(x, y, text, scale, angle, colour, font, NDC=False):
116 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text),
121 lat.SetTextAngle(angle)
125 def doPlot(logfilename, logfilename_copy):
126 global NEventsInFlight
136 canvas = TCanvas(
"Backlog",
"Backlog", 1100, 900)
139 inFlightgraph.Draw(
"APL")
140 inFlightgraph.GetYaxis().SetRangeUser(0.0, maxY * 1.2)
141 inFlightgraph.GetXaxis().SetRangeUser(0.0, float(n_vals + 1))
143 graph_c.Draw(
"PLSame")
147 float(n_vals + 1) * 1.03,
149 "#splitline{# Simultaneous}{ Events}",
155 eventInFlightLabel.Draw()
156 nThreadsLabel =
getText(0.15, 0.7,
"%s Threads" % NThreads, 0.6, 0, 2, 12,
True)
160 legend = TLegend(0.7, 0.75, 0.9, 0.9)
161 legend.SetFillColor(kWhite)
162 legend.SetHeader(
"Algo Management")
163 legend.AddEntry(graph,
"No Cloning", LegendDrawOpts)
164 legend.AddEntry(graph_c,
"Cloning enabled", LegendDrawOpts)
167 input(
"press enter to continue")
169 canvas.Print(
"EventBacklog.png")
172 if __name__ ==
"__main__":
175 print(
"Usage: plotBacklogPyRoot.py logfilename logfilename_copy")
177 doPlot(sys.argv[1], sys.argv[2])