Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r11 (bdb84f5f)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 66 of file plotBacklogPyRoot.py.

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

◆ createInFlightGraph()

def plotBacklogPyRoot.createInFlightGraph (   nevts)

Definition at line 90 of file plotBacklogPyRoot.py.

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

◆ doPlot()

def plotBacklogPyRoot.doPlot (   logfilename,
  logfilename_copy 
)

Definition at line 116 of file plotBacklogPyRoot.py.

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

◆ getText()

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

Definition at line 103 of file plotBacklogPyRoot.py.

103 def getText(x, y, text, scale, angle, colour, font, NDC=False):
104  lat = TLatex(
105  float(x),
106  float(y),
107  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text),
108  )
109  if NDC:
110  lat.SetNDC()
111  if angle != 0.0:
112  lat.SetTextAngle(angle)
113  return lat
114 
115 

◆ parseLog()

def plotBacklogPyRoot.parseLog (   logfilename)

Definition at line 41 of file plotBacklogPyRoot.py.

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

Variable Documentation

◆ argc

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 164 of file plotBacklogPyRoot.py.

◆ Colors

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

Definition at line 31 of file plotBacklogPyRoot.py.

◆ graphCounter

int plotBacklogPyRoot.graphCounter = 0

Definition at line 35 of file plotBacklogPyRoot.py.

◆ LegendDrawOpts

string plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 38 of file plotBacklogPyRoot.py.

◆ LineStyles

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 29 of file plotBacklogPyRoot.py.

◆ LineWidth

int plotBacklogPyRoot.LineWidth = 3

Definition at line 30 of file plotBacklogPyRoot.py.

◆ MarkerStyles

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 32 of file plotBacklogPyRoot.py.

◆ MarkesSize

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 33 of file plotBacklogPyRoot.py.

◆ maxY

int plotBacklogPyRoot.maxY = -1

Definition at line 36 of file plotBacklogPyRoot.py.

◆ NEventsInFlight

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 26 of file plotBacklogPyRoot.py.

◆ NThreads

int plotBacklogPyRoot.NThreads = -1

Definition at line 27 of file plotBacklogPyRoot.py.

plotBacklogPyRoot.createInFlightGraph
def createInFlightGraph(nevts)
Definition: plotBacklogPyRoot.py:90
plotBacklogPyRoot.parseLog
def parseLog(logfilename)
Definition: plotBacklogPyRoot.py:41
plotBacklogPyRoot.createGraph
def createGraph(max_min_blog_vals)
Definition: plotBacklogPyRoot.py:66
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:103
plotBacklogPyRoot.doPlot
def doPlot(logfilename, logfilename_copy)
Definition: plotBacklogPyRoot.py:116