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

def plotBacklogPyRoot.createGraph (   max_min_blog_vals)

Definition at line 45 of file plotBacklogPyRoot.py.

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

Definition at line 68 of file plotBacklogPyRoot.py.

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

Definition at line 89 of file plotBacklogPyRoot.py.

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

80 def getText(x,y,text,scale,angle,colour,font,NDC=False):
81  lat = TLatex(float(x),float(y),
82  "#scale[%s]{#color[%s]{#font[%s]{%s}}}"%(scale,colour,font,text))
83  if (NDC):
84  lat.SetNDC()
85  if angle!=0.:
86  lat.SetTextAngle(angle)
87  return lat
88 
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( re.match(".* \(max= ([0-9]*), min= ([0-9]*) \) = ([0-9]*).*",line).groups())
40  elif "Running with" in line:
41  NEventsInFlight,NThreads=map(int, re.match(".*Running with ([0-9]*).* ([0-9]*) threads",line).groups())
42 
43  return content
44 
struct GAUDI_API map
Parametrisation class for map-like implementation.
def parseLog(logfilename)

Variable Documentation

plotBacklogPyRoot.argc = len(sys.argv)

Definition at line 128 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.