11 from __future__
import print_function
19 Produces the backlog plot, parsing the output of the EventLoopManager.
20 Lines with the pattern "Event backlog" are looked for.
21 Events in flight are looked for as well.
31 Colors = [kBlue, kGreen + 2]
32 MarkerStyles = [kOpenCircle, kFullCircle]
44 global NEventsInFlight
46 ifile = open(logfilename,
"r")
47 lines = ifile.readlines()
51 if "Event backlog" in line:
54 ".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*", line
57 elif "Running with" in line:
58 NEventsInFlight, NThreads =
map(
60 re.match(
".*Running with ([0-9]*).* ([0-9]*) threads", line).groups(),
69 graph = TGraph(len(max_min_blog_vals))
71 for maxn, minn, blog
in max_min_blog_vals:
73 graph.SetPoint(counter, counter + 1, float(blog))
78 graph.SetMarkerSize(MarkesSize)
79 graph.SetMarkerStyle(MarkerStyles[graphCounter])
80 graph.SetMarkerColor(Colors[graphCounter])
81 graph.SetLineWidth(LineWidth)
82 graph.SetLineColor(Colors[graphCounter])
83 graph.SetLineStyle(LineStyles[graphCounter])
91 global NEventsInFlight
93 graph.SetPoint(0, 0.0, float(NEventsInFlight))
94 graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
96 graph.SetLineColor(kRed)
98 graph.SetTitle(
"GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
99 print(NEventsInFlight)
103 def getText(x, y, text, scale, angle, colour, font, NDC=False):
107 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text),
112 lat.SetTextAngle(angle)
116 def doPlot(logfilename, logfilename_copy):
117 global NEventsInFlight
127 canvas = TCanvas(
"Backlog",
"Backlog", 1100, 900)
130 inFlightgraph.Draw(
"APL")
131 inFlightgraph.GetYaxis().SetRangeUser(0.0, maxY * 1.2)
132 inFlightgraph.GetXaxis().SetRangeUser(0.0, float(n_vals + 1))
134 graph_c.Draw(
"PLSame")
138 float(n_vals + 1) * 1.03,
140 "#splitline{# Simultaneous}{ Events}",
146 eventInFlightLabel.Draw()
147 nThreadsLabel =
getText(0.15, 0.7,
"%s Threads" % NThreads, 0.6, 0, 2, 12,
True)
151 legend = TLegend(0.7, 0.75, 0.9, 0.9)
152 legend.SetFillColor(kWhite)
153 legend.SetHeader(
"Algo Management")
154 legend.AddEntry(graph,
"No Cloning", LegendDrawOpts)
155 legend.AddEntry(graph_c,
"Cloning enabled", LegendDrawOpts)
158 a = raw_input(
"press enter to continue")
160 canvas.Print(
"EventBacklog.png")
163 if __name__ ==
"__main__":
166 print(
"Usage: plotBacklogPyRoot.py logfilename logfilename_copy")
168 doPlot(sys.argv[1], sys.argv[2])