| The Gaudi Framework v32r1 (f65d50dc)

Functions | Variables
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 50 of file plotBacklogPyRoot.py.

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

## ◆ createInFlightGraph()

def plotBacklogPyRoot.createInFlightGraph | ( |  | nevts | ) |

Definition at line 74 of file plotBacklogPyRoot.py.

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

## ◆ doPlot()

def plotBacklogPyRoot.doPlot | ( |  | logfilename,
|  |  | logfilename_copy
| ) |  |

Definition at line 99 of file plotBacklogPyRoot.py.

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

## ◆ getText()

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

Definition at line 88 of file plotBacklogPyRoot.py.

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

## ◆ parseLog()

def plotBacklogPyRoot.parseLog | ( |  | logfilename | ) |

Definition at line 27 of file plotBacklogPyRoot.py.

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

## Variable Documentation

## ◆ argc

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 142 of file plotBacklogPyRoot.py.

## ◆ Colors

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

Definition at line 17 of file plotBacklogPyRoot.py.

## ◆ graphCounter

int plotBacklogPyRoot.graphCounter = 0

Definition at line 21 of file plotBacklogPyRoot.py.

## ◆ LegendDrawOpts

string plotBacklogPyRoot.LegendDrawOpts = "lp"

Definition at line 24 of file plotBacklogPyRoot.py.

## ◆ LineStyles

list plotBacklogPyRoot.LineStyles = [1, 2]

Definition at line 15 of file plotBacklogPyRoot.py.

## ◆ LineWidth

int plotBacklogPyRoot.LineWidth = 3

Definition at line 16 of file plotBacklogPyRoot.py.

## ◆ MarkerStyles

list plotBacklogPyRoot.MarkerStyles = [kOpenCircle, kFullCircle]

Definition at line 18 of file plotBacklogPyRoot.py.

## ◆ MarkesSize

float plotBacklogPyRoot.MarkesSize = 1.5

Definition at line 19 of file plotBacklogPyRoot.py.

## ◆ maxY

int plotBacklogPyRoot.maxY = -1

Definition at line 22 of file plotBacklogPyRoot.py.

## ◆ NEventsInFlight

int plotBacklogPyRoot.NEventsInFlight = -1

Definition at line 12 of file plotBacklogPyRoot.py.

## ◆ NThreads

int plotBacklogPyRoot.NThreads = -1

Definition at line 13 of file plotBacklogPyRoot.py.