1 from __future__
import print_function
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]*).*",
42 elif "Running with" in line:
43 NEventsInFlight, NThreads =
map(
45 re.match(
".*Running with ([0-9]*).* ([0-9]*) threads",
54 graph = TGraph(len(max_min_blog_vals))
56 for maxn, minn, blog
in max_min_blog_vals:
58 graph.SetPoint(counter, counter + 1, float(blog))
63 graph.SetMarkerSize(MarkesSize)
64 graph.SetMarkerStyle(MarkerStyles[graphCounter])
65 graph.SetMarkerColor(Colors[graphCounter])
66 graph.SetLineWidth(LineWidth)
67 graph.SetLineColor(Colors[graphCounter])
68 graph.SetLineStyle(LineStyles[graphCounter])
76 global NEventsInFlight
78 graph.SetPoint(0, 0., float(NEventsInFlight))
79 graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
81 graph.SetLineColor(kRed)
84 "GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
85 print(NEventsInFlight)
89 def getText(x, y, text, scale, angle, colour, font, NDC=False):
92 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
96 lat.SetTextAngle(angle)
100 def doPlot(logfilename, logfilename_copy):
101 global NEventsInFlight
111 canvas = TCanvas(
"Backlog",
"Backlog", 1100, 900)
114 inFlightgraph.Draw(
"APL")
115 inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
116 inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
118 graph_c.Draw(
"PLSame")
122 float(n_vals + 1) * 1.03, NEventsInFlight,
123 "#splitline{# Simultaneous}{ Events}", .6, 270, 2, 12)
124 eventInFlightLabel.Draw()
125 nThreadsLabel =
getText(.15, .7,
"%s Threads" % NThreads, .6, 0, 2, 12,
130 legend = TLegend(.7, .75, .9, .9)
131 legend.SetFillColor(kWhite)
132 legend.SetHeader(
"Algo Management")
133 legend.AddEntry(graph,
"No Cloning", LegendDrawOpts)
134 legend.AddEntry(graph_c,
"Cloning enabled", LegendDrawOpts)
137 a = raw_input(
"press enter to continue")
139 canvas.Print(
"EventBacklog.png")
142 if __name__ ==
"__main__":
145 print(
"Usage: plotBacklogPyRoot.py logfilename logfilename_copy")
147 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)