The Gaudi Framework  v36r1 (3e2fb5a8)
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 61 of file plotBacklogPyRoot.py.

61 def createGraph(max_min_blog_vals):
62  global graphCounter
63  global maxY
64  graph = TGraph(len(max_min_blog_vals))
65  counter = 0
66  for maxn, minn, blog in max_min_blog_vals:
67  blog = float(blog)
68  graph.SetPoint(counter, counter + 1, float(blog))
69  if maxY < blog:
70  maxY = blog
71  counter += 1
72 
73  graph.SetMarkerSize(MarkesSize)
74  graph.SetMarkerStyle(MarkerStyles[graphCounter])
75  graph.SetMarkerColor(Colors[graphCounter])
76  graph.SetLineWidth(LineWidth)
77  graph.SetLineColor(Colors[graphCounter])
78  graph.SetLineStyle(LineStyles[graphCounter])
79 
80  graphCounter += 1
81 
82  return graph
83 
84 

◆ createInFlightGraph()

def plotBacklogPyRoot.createInFlightGraph (   nevts)

Definition at line 85 of file plotBacklogPyRoot.py.

85 def createInFlightGraph(nevts):
86  global NEventsInFlight
87  graph = TGraph(2)
88  graph.SetPoint(0, 0., float(NEventsInFlight))
89  graph.SetPoint(1, float(nevts) + 1, float(NEventsInFlight))
90  graph.SetLineWidth(3)
91  graph.SetLineColor(kRed)
92  graph.SetLineStyle(2)
93  graph.SetTitle(
94  "GaudiHive Backlog (Brunel, 100 evts);Events Finished;Event Backlog")
95  print(NEventsInFlight)
96  return graph
97 
98 

◆ doPlot()

def plotBacklogPyRoot.doPlot (   logfilename,
  logfilename_copy 
)

Definition at line 110 of file plotBacklogPyRoot.py.

110 def doPlot(logfilename, logfilename_copy):
111  global NEventsInFlight
112  global maxY
113  global NThreads
114  vals = parseLog(logfilename)
115  vals_c = parseLog(logfilename_copy)
116  n_vals = len(vals)
117  inFlightgraph = createInFlightGraph(n_vals)
118  graph = createGraph(vals)
119  graph_c = createGraph(vals_c)
120 
121  canvas = TCanvas("Backlog", "Backlog", 1100, 900)
122  canvas.cd()
123  canvas.SetGrid()
124  inFlightgraph.Draw("APL")
125  inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
126  inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
127  graph.Draw("PLSame")
128  graph_c.Draw("PLSame")
129 
130  # Labels
131  eventInFlightLabel = getText(
132  float(n_vals + 1) * 1.03, NEventsInFlight,
133  "#splitline{# Simultaneous}{ Events}", .6, 270, 2, 12)
134  eventInFlightLabel.Draw()
135  nThreadsLabel = getText(.15, .7, "%s Threads" % NThreads, .6, 0, 2, 12,
136  True)
137  nThreadsLabel.Draw()
138 
139  # Build a Legend
140  legend = TLegend(.7, .75, .9, .9)
141  legend.SetFillColor(kWhite)
142  legend.SetHeader("Algo Management")
143  legend.AddEntry(graph, "No Cloning", LegendDrawOpts)
144  legend.AddEntry(graph_c, "Cloning enabled", LegendDrawOpts)
145  legend.Draw()
146 
147  a = raw_input("press enter to continue")
148 
149  canvas.Print("EventBacklog.png")
150 
151 

◆ getText()

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

Definition at line 99 of file plotBacklogPyRoot.py.

99 def getText(x, y, text, scale, angle, colour, font, NDC=False):
100  lat = TLatex(
101  float(x), float(y),
102  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
103  if (NDC):
104  lat.SetNDC()
105  if angle != 0.:
106  lat.SetTextAngle(angle)
107  return lat
108 
109 

◆ parseLog()

def plotBacklogPyRoot.parseLog (   logfilename)

Definition at line 38 of file plotBacklogPyRoot.py.

38 def parseLog(logfilename):
39  # a line looks like
40  #"HiveSlimEventLoopMgr SUCCESS Event backlog (max= 3, min= 0 ) = 3"
41  global NEventsInFlight
42  global NThreads
43  ifile = open(logfilename, "r")
44  lines = ifile.readlines()
45  ifile.close()
46  content = []
47  for line in lines:
48  if "Event backlog" in line:
49  content.append(
50  re.match(".* \‍(max= ([0-9]*), min= ([0-9]*) \‍) = ([0-9]*).*",
51  line).groups())
52  elif "Running with" in line:
53  NEventsInFlight, NThreads = map(
54  int,
55  re.match(".*Running with ([0-9]*).* ([0-9]*) threads",
56  line).groups())
57 
58  return content
59 
60 

Variable Documentation

◆ argc

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 153 of file plotBacklogPyRoot.py.

◆ Colors

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

Definition at line 28 of file plotBacklogPyRoot.py.

◆ graphCounter

int plotBacklogPyRoot.graphCounter = 0

Definition at line 32 of file plotBacklogPyRoot.py.

◆ LegendDrawOpts

string plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 35 of file plotBacklogPyRoot.py.

◆ LineStyles

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 26 of file plotBacklogPyRoot.py.

◆ LineWidth

int plotBacklogPyRoot.LineWidth = 3

Definition at line 27 of file plotBacklogPyRoot.py.

◆ MarkerStyles

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 29 of file plotBacklogPyRoot.py.

◆ MarkesSize

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 30 of file plotBacklogPyRoot.py.

◆ maxY

int plotBacklogPyRoot.maxY = -1

Definition at line 33 of file plotBacklogPyRoot.py.

◆ NEventsInFlight

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 23 of file plotBacklogPyRoot.py.

◆ NThreads

int plotBacklogPyRoot.NThreads = -1

Definition at line 24 of file plotBacklogPyRoot.py.

plotBacklogPyRoot.createInFlightGraph
def createInFlightGraph(nevts)
Definition: plotBacklogPyRoot.py:85
plotBacklogPyRoot.parseLog
def parseLog(logfilename)
Definition: plotBacklogPyRoot.py:38
plotBacklogPyRoot.createGraph
def createGraph(max_min_blog_vals)
Definition: plotBacklogPyRoot.py:61
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:99
plotBacklogPyRoot.doPlot
def doPlot(logfilename, logfilename_copy)
Definition: plotBacklogPyRoot.py:110