The Gaudi Framework  v30r3 (a5ef0a68)
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

def plotBacklogPyRoot.createGraph (   max_min_blog_vals)

Definition at line 48 of file plotBacklogPyRoot.py.

48 def createGraph(max_min_blog_vals):
49  global graphCounter
50  global maxY
51  graph = TGraph(len(max_min_blog_vals))
52  counter = 0
53  for maxn, minn, blog in max_min_blog_vals:
54  blog = float(blog)
55  graph.SetPoint(counter, counter + 1, float(blog))
56  if maxY < blog:
57  maxY = blog
58  counter += 1
59 
60  graph.SetMarkerSize(MarkesSize)
61  graph.SetMarkerStyle(MarkerStyles[graphCounter])
62  graph.SetMarkerColor(Colors[graphCounter])
63  graph.SetLineWidth(LineWidth)
64  graph.SetLineColor(Colors[graphCounter])
65  graph.SetLineStyle(LineStyles[graphCounter])
66 
67  graphCounter += 1
68 
69  return graph
70 
71 
def createGraph(max_min_blog_vals)
def plotBacklogPyRoot.createInFlightGraph (   nevts)

Definition at line 72 of file plotBacklogPyRoot.py.

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

Definition at line 96 of file plotBacklogPyRoot.py.

96 def doPlot(logfilename, logfilename_copy):
97  global NEventsInFlight
98  global maxY
99  global NThreads
100  vals = parseLog(logfilename)
101  vals_c = parseLog(logfilename_copy)
102  n_vals = len(vals)
103  inFlightgraph = createInFlightGraph(n_vals)
104  graph = createGraph(vals)
105  graph_c = createGraph(vals_c)
106 
107  canvas = TCanvas("Backlog", "Backlog", 1100, 900)
108  canvas.cd()
109  canvas.SetGrid()
110  inFlightgraph.Draw("APL")
111  inFlightgraph.GetYaxis().SetRangeUser(0., maxY * 1.2)
112  inFlightgraph.GetXaxis().SetRangeUser(0., float(n_vals + 1))
113  graph.Draw("PLSame")
114  graph_c.Draw("PLSame")
115 
116  # Labels
117  eventInFlightLabel = getText(float(n_vals + 1) * 1.03, NEventsInFlight,
118  "#splitline{# Simultaneous}{ Events}", .6, 270, 2, 12)
119  eventInFlightLabel.Draw()
120  nThreadsLabel = getText(.15, .7, "%s Threads" %
121  NThreads, .6, 0, 2, 12, True)
122  nThreadsLabel.Draw()
123 
124  # Build a Legend
125  legend = TLegend(.7, .75, .9, .9)
126  legend.SetFillColor(kWhite)
127  legend.SetHeader("Algo Management")
128  legend.AddEntry(graph, "No Cloning", LegendDrawOpts)
129  legend.AddEntry(graph_c, "Cloning enabled", LegendDrawOpts)
130  legend.Draw()
131 
132  a = raw_input("press enter to continue")
133 
134  canvas.Print("EventBacklog.png")
135 
136 
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)
def plotBacklogPyRoot.getText (   x,
  y,
  text,
  scale,
  angle,
  colour,
  font,
  NDC = False 
)

Definition at line 86 of file plotBacklogPyRoot.py.

86 def getText(x, y, text, scale, angle, colour, font, NDC=False):
87  lat = TLatex(float(x), float(y),
88  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
89  if (NDC):
90  lat.SetNDC()
91  if angle != 0.:
92  lat.SetTextAngle(angle)
93  return lat
94 
95 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
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]*).*", line).groups())
41  elif "Running with" in line:
42  NEventsInFlight, NThreads = map(int, re.match(
43  ".*Running with ([0-9]*).* ([0-9]*) threads", line).groups())
44 
45  return content
46 
47 
struct GAUDI_API map
Parametrisation class for map-like implementation.
def parseLog(logfilename)

Variable Documentation

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 138 of file plotBacklogPyRoot.py.

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

Definition at line 18 of file plotBacklogPyRoot.py.

int plotBacklogPyRoot.graphCounter = 0

Definition at line 22 of file plotBacklogPyRoot.py.

string plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 25 of file plotBacklogPyRoot.py.

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 16 of file plotBacklogPyRoot.py.

int plotBacklogPyRoot.LineWidth = 3

Definition at line 17 of file plotBacklogPyRoot.py.

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 19 of file plotBacklogPyRoot.py.

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 20 of file plotBacklogPyRoot.py.

int plotBacklogPyRoot.maxY = -1

Definition at line 23 of file plotBacklogPyRoot.py.

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 13 of file plotBacklogPyRoot.py.

int plotBacklogPyRoot.NThreads = -1

Definition at line 14 of file plotBacklogPyRoot.py.