The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
plotBacklogPyRoot Namespace Reference

Functions

 parseLog (logfilename)
 
 createGraph (max_min_blog_vals)
 
 createInFlightGraph (nevts)
 
 getText (x, y, text, scale, angle, colour, font, NDC=False)
 
 doPlot (logfilename, logfilename_copy)
 

Variables

int NEventsInFlight = -1
 
int NThreads = -1
 
list LineStyles = [1, 2]
 
int LineWidth = 3
 
list Colors = [kBlue, kGreen + 2]
 
list MarkerStyles = [kOpenCircle, kFullCircle]
 
float MarkesSize = 1.5
 
int graphCounter = 0
 
int maxY = -1
 
str LegendDrawOpts = "lp"
 
 argc = len(sys.argv)
 

Function Documentation

◆ createGraph()

plotBacklogPyRoot.createGraph ( max_min_blog_vals)

Definition at line 75 of file plotBacklogPyRoot.py.

75def createGraph(max_min_blog_vals):
76 global graphCounter
77 global maxY
78 graph = TGraph(len(max_min_blog_vals))
79 counter = 0
80 for maxn, minn, blog in max_min_blog_vals:
81 blog = float(blog)
82 graph.SetPoint(counter, counter + 1, float(blog))
83 if maxY < blog:
84 maxY = blog
85 counter += 1
86
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])
93
94 graphCounter += 1
95
96 return graph
97
98

◆ createInFlightGraph()

plotBacklogPyRoot.createInFlightGraph ( nevts)

Definition at line 99 of file plotBacklogPyRoot.py.

99def createInFlightGraph(nevts):
100 global NEventsInFlight
101 graph = TGraph(2)
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)
109 return graph
110
111

◆ doPlot()

plotBacklogPyRoot.doPlot ( logfilename,
logfilename_copy )

Definition at line 125 of file plotBacklogPyRoot.py.

125def doPlot(logfilename, logfilename_copy):
126 global NEventsInFlight
127 global maxY
128 global NThreads
129 vals = parseLog(logfilename)
130 vals_c = parseLog(logfilename_copy)
131 n_vals = len(vals)
132 inFlightgraph = createInFlightGraph(n_vals)
133 graph = createGraph(vals)
134 graph_c = createGraph(vals_c)
135
136 canvas = TCanvas("Backlog", "Backlog", 1100, 900)
137 canvas.cd()
138 canvas.SetGrid()
139 inFlightgraph.Draw("APL")
140 inFlightgraph.GetYaxis().SetRangeUser(0.0, maxY * 1.2)
141 inFlightgraph.GetXaxis().SetRangeUser(0.0, float(n_vals + 1))
142 graph.Draw("PLSame")
143 graph_c.Draw("PLSame")
144
145 # Labels
146 eventInFlightLabel = getText(
147 float(n_vals + 1) * 1.03,
148 NEventsInFlight,
149 "#splitline{# Simultaneous}{ Events}",
150 0.6,
151 270,
152 2,
153 12,
154 )
155 eventInFlightLabel.Draw()
156 nThreadsLabel = getText(0.15, 0.7, "%s Threads" % NThreads, 0.6, 0, 2, 12, True)
157 nThreadsLabel.Draw()
158
159 # Build a Legend
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)
165 legend.Draw()
166
167 input("press enter to continue")
168
169 canvas.Print("EventBacklog.png")
170
171

◆ getText()

plotBacklogPyRoot.getText ( x,
y,
text,
scale,
angle,
colour,
font,
NDC = False )

Definition at line 112 of file plotBacklogPyRoot.py.

112def getText(x, y, text, scale, angle, colour, font, NDC=False):
113 lat = TLatex(
114 float(x),
115 float(y),
116 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text),
117 )
118 if NDC:
119 lat.SetNDC()
120 if angle != 0.0:
121 lat.SetTextAngle(angle)
122 return lat
123
124

◆ parseLog()

plotBacklogPyRoot.parseLog ( logfilename)

Definition at line 50 of file plotBacklogPyRoot.py.

50def parseLog(logfilename):
51 # a line looks like
52 # "HiveSlimEventLoopMgr SUCCESS Event backlog (max= 3, min= 0 ) = 3"
53 global NEventsInFlight
54 global NThreads
55 ifile = open(logfilename, "r")
56 lines = ifile.readlines()
57 ifile.close()
58 content = []
59 for line in lines:
60 if "Event backlog" in line:
61 content.append(
62 re.match(
63 r".* \‍(max= ([0-9]*), min= ([0-9]*) \‍) = ([0-9]*).*", line
64 ).groups()
65 )
66 elif "Running with" in line:
67 NEventsInFlight, NThreads = map(
68 int,
69 re.match(".*Running with ([0-9]*).* ([0-9]*) threads", line).groups(),
70 )
71
72 return content
73
74

Variable Documentation

◆ argc

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 173 of file plotBacklogPyRoot.py.

◆ Colors

list plotBacklogPyRoot.Colors = [kBlue, kGreen + 2]

Definition at line 40 of file plotBacklogPyRoot.py.

◆ graphCounter

int plotBacklogPyRoot.graphCounter = 0

Definition at line 44 of file plotBacklogPyRoot.py.

◆ LegendDrawOpts

str plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 47 of file plotBacklogPyRoot.py.

◆ LineStyles

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 38 of file plotBacklogPyRoot.py.

◆ LineWidth

int plotBacklogPyRoot.LineWidth = 3

Definition at line 39 of file plotBacklogPyRoot.py.

◆ MarkerStyles

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 41 of file plotBacklogPyRoot.py.

◆ MarkesSize

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 42 of file plotBacklogPyRoot.py.

◆ maxY

int plotBacklogPyRoot.maxY = -1

Definition at line 45 of file plotBacklogPyRoot.py.

◆ NEventsInFlight

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 35 of file plotBacklogPyRoot.py.

◆ NThreads

int plotBacklogPyRoot.NThreads = -1

Definition at line 36 of file plotBacklogPyRoot.py.