The Gaudi Framework  master (37c0b60a)
plotBacklogPyRoot Namespace Reference

Functions

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

Variables

 NEventsInFlight
 
 NThreads
 
 LineStyles
 
 LineWidth
 
 Colors
 
 MarkerStyles
 
 MarkesSize
 
 graphCounter
 
 maxY
 
 LegendDrawOpts
 
 argc
 

Function Documentation

◆ createGraph()

def plotBacklogPyRoot.createGraph (   max_min_blog_vals)

Definition at line 75 of file plotBacklogPyRoot.py.

75 def 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()

def plotBacklogPyRoot.createInFlightGraph (   nevts)

Definition at line 99 of file plotBacklogPyRoot.py.

99 def 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()

def plotBacklogPyRoot.doPlot (   logfilename,
  logfilename_copy 
)

Definition at line 125 of file plotBacklogPyRoot.py.

125 def 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()

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

Definition at line 112 of file plotBacklogPyRoot.py.

112 def 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()

def plotBacklogPyRoot.parseLog (   logfilename)

Definition at line 50 of file plotBacklogPyRoot.py.

50 def 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

Definition at line 173 of file plotBacklogPyRoot.py.

◆ Colors

plotBacklogPyRoot.Colors

Definition at line 40 of file plotBacklogPyRoot.py.

◆ graphCounter

plotBacklogPyRoot.graphCounter

Definition at line 44 of file plotBacklogPyRoot.py.

◆ LegendDrawOpts

plotBacklogPyRoot.LegendDrawOpts

Definition at line 47 of file plotBacklogPyRoot.py.

◆ LineStyles

plotBacklogPyRoot.LineStyles

Definition at line 38 of file plotBacklogPyRoot.py.

◆ LineWidth

plotBacklogPyRoot.LineWidth

Definition at line 39 of file plotBacklogPyRoot.py.

◆ MarkerStyles

plotBacklogPyRoot.MarkerStyles

Definition at line 41 of file plotBacklogPyRoot.py.

◆ MarkesSize

plotBacklogPyRoot.MarkesSize

Definition at line 42 of file plotBacklogPyRoot.py.

◆ maxY

plotBacklogPyRoot.maxY

Definition at line 45 of file plotBacklogPyRoot.py.

◆ NEventsInFlight

plotBacklogPyRoot.NEventsInFlight

Definition at line 35 of file plotBacklogPyRoot.py.

◆ NThreads

plotBacklogPyRoot.NThreads

Definition at line 36 of file plotBacklogPyRoot.py.

plotBacklogPyRoot.createInFlightGraph
def createInFlightGraph(nevts)
Definition: plotBacklogPyRoot.py:99
plotBacklogPyRoot.parseLog
def parseLog(logfilename)
Definition: plotBacklogPyRoot.py:50
plotBacklogPyRoot.createGraph
def createGraph(max_min_blog_vals)
Definition: plotBacklogPyRoot.py:75
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:35
plotBacklogPyRoot.getText
def getText(x, y, text, scale, angle, colour, font, NDC=False)
Definition: plotBacklogPyRoot.py:112
plotBacklogPyRoot.doPlot
def doPlot(logfilename, logfilename_copy)
Definition: plotBacklogPyRoot.py:125