11 from __future__
import print_function
16 Produces the backlog plot, parsing the output of the EventLoopManager.
17 Lines with the pattern "Event backlog" are looked for.
18 Events in flight are looked for as well.
28 Colors = [kBlue, kGreen + 2]
29 MarkerStyles = [kOpenCircle, kFullCircle]
41 global NEventsInFlight
43 ifile = open(logfilename,
"r")
44 lines = ifile.readlines()
48 if "Event backlog" in line:
50 re.match(
".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*",
52 elif "Running with" in line:
53 NEventsInFlight, NThreads =
map(
55 re.match(
".*Running with ([0-9]*).* ([0-9]*) threads",
64 graph = TGraph(len(max_min_blog_vals))
66 for maxn, minn, blog
in max_min_blog_vals:
68 graph.SetPoint(counter, counter + 1, float(blog))
73 graph.SetMarkerSize(MarkesSize)
74 graph.SetMarkerStyle(MarkerStyles[graphCounter])
75 graph.SetMarkerColor(Colors[graphCounter])
76 graph.SetLineWidth(LineWidth)
77 graph.SetLineColor(Colors[graphCounter])
78 graph.SetLineStyle(LineStyles[graphCounter])
86 global NEventsInFlight
88 graph.SetPoint(0, 0., float(NEventsInFlight))
89 graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
91 graph.SetLineColor(kRed)
94 "GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
95 print(NEventsInFlight)
99 def getText(x, y, text, scale, angle, colour, font, NDC=False):
102 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
106 lat.SetTextAngle(angle)
110 def doPlot(logfilename, logfilename_copy):
111 global NEventsInFlight
121 canvas = TCanvas(
"Backlog",
"Backlog", 1100, 900)
124 inFlightgraph.Draw(
"APL")
125 inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
126 inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
128 graph_c.Draw(
"PLSame")
132 float(n_vals + 1) * 1.03, NEventsInFlight,
133 "#splitline{# Simultaneous}{ Events}", .6, 270, 2, 12)
134 eventInFlightLabel.Draw()
135 nThreadsLabel =
getText(.15, .7,
"%s Threads" % NThreads, .6, 0, 2, 12,
140 legend = TLegend(.7, .75, .9, .9)
141 legend.SetFillColor(kWhite)
142 legend.SetHeader(
"Algo Management")
143 legend.AddEntry(graph,
"No Cloning", LegendDrawOpts)
144 legend.AddEntry(graph_c,
"Cloning enabled", LegendDrawOpts)
147 a = raw_input(
"press enter to continue")
149 canvas.Print(
"EventBacklog.png")
152 if __name__ ==
"__main__":
155 print(
"Usage: plotBacklogPyRoot.py logfilename logfilename_copy")
157 doPlot(sys.argv[1], sys.argv[2])