The Gaudi Framework  v32r2 (46d42edc)
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

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
 
string LegendDrawOpts = "lp"
 
 argc = len(sys.argv)
 

Function Documentation

◆ createGraph()

def plotBacklogPyRoot.createGraph (   max_min_blog_vals)

Definition at line 51 of file plotBacklogPyRoot.py.

51 def createGraph(max_min_blog_vals):
52  global graphCounter
53  global maxY
54  graph = TGraph(len(max_min_blog_vals))
55  counter = 0
56  for maxn, minn, blog in max_min_blog_vals:
57  blog = float(blog)
58  graph.SetPoint(counter, counter + 1, float(blog))
59  if maxY < blog:
60  maxY = blog
61  counter += 1
62 
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])
69 
70  graphCounter += 1
71 
72  return graph
73 
74 
def createGraph(max_min_blog_vals)

◆ createInFlightGraph()

def plotBacklogPyRoot.createInFlightGraph (   nevts)

Definition at line 75 of file plotBacklogPyRoot.py.

75 def createInFlightGraph(nevts):
76  global NEventsInFlight
77  graph = TGraph(2)
78  graph.SetPoint(0, 0., float(NEventsInFlight))
79  graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
80  graph.SetLineWidth(3)
81  graph.SetLineColor(kRed)
82  graph.SetLineStyle(2)
83  graph.SetTitle(
84  "GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
85  print(NEventsInFlight)
86  return graph
87 
88 
def createInFlightGraph(nevts)

◆ doPlot()

def plotBacklogPyRoot.doPlot (   logfilename,
  logfilename_copy 
)

Definition at line 100 of file plotBacklogPyRoot.py.

100 def doPlot(logfilename, logfilename_copy):
101  global NEventsInFlight
102  global maxY
103  global NThreads
104  vals = parseLog(logfilename)
105  vals_c = parseLog(logfilename_copy)
106  n_vals = len(vals)
107  inFlightgraph = createInFlightGraph(n_vals)
108  graph = createGraph(vals)
109  graph_c = createGraph(vals_c)
110 
111  canvas = TCanvas("Backlog", "Backlog", 1100, 900)
112  canvas.cd()
113  canvas.SetGrid()
114  inFlightgraph.Draw("APL")
115  inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
116  inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
117  graph.Draw("PLSame")
118  graph_c.Draw("PLSame")
119 
120  # Labels
121  eventInFlightLabel = getText(
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,
126  True)
127  nThreadsLabel.Draw()
128 
129  # Build a Legend
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)
135  legend.Draw()
136 
137  a = raw_input("press enter to continue")
138 
139  canvas.Print("EventBacklog.png")
140 
141 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
def parseLog(logfilename)
def createInFlightGraph(nevts)
def doPlot(logfilename, logfilename_copy)
def createGraph(max_min_blog_vals)

◆ getText()

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

Definition at line 89 of file plotBacklogPyRoot.py.

89 def getText(x, y, text, scale, angle, colour, font, NDC=False):
90  lat = TLatex(
91  float(x), float(y),
92  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
93  if (NDC):
94  lat.SetNDC()
95  if angle != 0.:
96  lat.SetTextAngle(angle)
97  return lat
98 
99 
def getText(x, y, text, scale, angle, colour, font, NDC=False)

◆ parseLog()

def plotBacklogPyRoot.parseLog (   logfilename)

Definition at line 28 of file plotBacklogPyRoot.py.

28 def parseLog(logfilename):
29  # a line looks like
30  #"HiveSlimEventLoopMgr SUCCESS Event backlog (max= 3, min= 0 ) = 3"
31  global NEventsInFlight
32  global NThreads
33  ifile = open(logfilename, "r")
34  lines = ifile.readlines()
35  ifile.close()
36  content = []
37  for line in lines:
38  if "Event backlog" in line:
39  content.append(
40  re.match(".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*",
41  line).groups())
42  elif "Running with" in line:
43  NEventsInFlight, NThreads = map(
44  int,
45  re.match(".*Running with ([0-9]*).* ([0-9]*) threads",
46  line).groups())
47 
48  return content
49 
50 
struct GAUDI_API map
Parametrisation class for map-like implementation.
def parseLog(logfilename)

Variable Documentation

◆ argc

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 143 of file plotBacklogPyRoot.py.

◆ Colors

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

Definition at line 18 of file plotBacklogPyRoot.py.

◆ graphCounter

int plotBacklogPyRoot.graphCounter = 0

Definition at line 22 of file plotBacklogPyRoot.py.

◆ LegendDrawOpts

string plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 25 of file plotBacklogPyRoot.py.

◆ LineStyles

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 16 of file plotBacklogPyRoot.py.

◆ LineWidth

int plotBacklogPyRoot.LineWidth = 3

Definition at line 17 of file plotBacklogPyRoot.py.

◆ MarkerStyles

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 19 of file plotBacklogPyRoot.py.

◆ MarkesSize

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 20 of file plotBacklogPyRoot.py.

◆ maxY

int plotBacklogPyRoot.maxY = -1

Definition at line 23 of file plotBacklogPyRoot.py.

◆ NEventsInFlight

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 13 of file plotBacklogPyRoot.py.

◆ NThreads

int plotBacklogPyRoot.NThreads = -1

Definition at line 14 of file plotBacklogPyRoot.py.