ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeBenchmark.py
Revision: 1.1
Committed: Mon Sep 7 09:46:41 2009 UTC (15 years, 8 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Log Message:
New integration build page using TWiki

File Contents

# User Rev Content
1 geonmo 1.1 #!/usr/bin/env python
2     import os, re
3     from ROOT import gROOT, TCanvas, TH1F, TLegend, TGaxis, gPad
4    
5     class makeBenchmark(object) :
6     def __init__(self, packagename):
7     self.packagename = packagename
8     url ='https://macms01.cern.ch/cgi-bin/ap/showTimeMemInfo.py?rel=CMSSW_3_1_X'
9     self.page = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
10    
11     def makecanvas(self, name, xlen, ylen):
12     can = TCanvas(name,name,0,0,xlen,ylen)
13     can.SetFillColor(0)
14     can.SetFrameFillColor(0)
15     can.SetFrameLineWidth(2)
16     return can
17    
18     def makehis(self, hisname,numofbin,color,max,min):
19     his = TH1F(hisname,hisname,numofbin,0,numofbin)
20     his.SetStats(0)
21     his.SetTitle(hisname)
22     his.SetLineColor(color)
23     his.SetLineWidth(2)
24     his.SetFillColor(0)
25     his.SetMaximum(max)
26     his.SetMinimum(min)
27     return his
28    
29     def makeleg(self, his1,his2,his3, his4):
30     leg = TLegend(0.55,0.86,0.99,0.98)
31     leg.AddEntry(his1,"step1_ProdMinBias+RECOPROD1")
32     leg.AddEntry(his2,"step2_ProdMinBias+RECOPROD1")
33     leg.AddEntry(his3,"step1_ProdTTbar+RECOPROD1+ALCATT1")
34     leg.AddEntry(his4,"step2_ProdTTbar+RECOPROD1+ALCATT1")
35     leg.SetFillColor(0)
36     return leg
37    
38     def mkBench(self) :
39     gROOT.Reset()
40    
41     data=[]
42     while 1:
43     line = self.page.readline()
44     if not line:
45     break
46     m1 = re.search('(step\w+\+\w+)',line)
47     if m1:
48     title = []
49     vmem = []
50     rss = []
51     cputime = []
52     cputime_error=[]
53     rawsize=[]
54     recosize=[]
55    
56     while 1:
57     slist = line.split()
58     if slist[0][0:2] != '<a':
59     break;
60     else :
61     title.append(slist[1][75:88])
62     vmem.append(float(slist[3]))
63     rss.append(float(slist[4]))
64     cputime.append(float(slist[5]))
65     cputime_error.append(float(slist[7]))
66     rawsize.append(float(slist[14]))
67     recosize.append(float(slist[15]))
68     line=self.page.readline()
69     hist = { 'title': title, 'vmem':vmem, 'rss':rss, 'cputime':cputime, 'cputime_error':cputime_error, 'rawsize':rawsize, 'recosize':recosize}
70     if len(hist['title'])>0 :
71     data.append(hist)
72     temp=data[0]['vmem']+data[1]['vmem']+data[2]['vmem']+data[3]['vmem']
73     print len(data[0]['vmem']), len(data[1]['vmem']), len(data[2]['vmem']), len(data[3]['vmem'])
74     temp.sort()
75     vmem_max = float(temp[-1]) + 0.1*float(temp[-1])
76     vmem_min = float(temp[0]) - 0.1*float(temp[0])
77    
78     numofdate=len(data[0]['title'])
79     his1 = self.makehis('vmem1',numofdate,2,vmem_max,vmem_min)
80     his2 = self.makehis('vmem2',numofdate,4,vmem_max,vmem_min)
81     his3 = self.makehis('vmem3',numofdate,6,vmem_max,vmem_min)
82     his4 = self.makehis('vmem4',numofdate,8,vmem_max,vmem_min)
83    
84     temp=data[0]['rss']+data[1]['rss']+data[2]['rss']+data[3]['rss']
85     temp.sort()
86     rss_max = float(temp[-1]) + 0.1*float(temp[-1])
87     rss_min = float(temp[0]) - 0.1*float(temp[0])
88    
89     his5 = self.makehis('rss1',numofdate,2,rss_max,rss_min)
90     his6 = self.makehis('rss2',numofdate,4,rss_max,rss_min)
91     his7 = self.makehis('rss3',numofdate,6,rss_max,rss_min)
92     his8 = self.makehis('rss4',numofdate,8,rss_max,rss_min)
93    
94     temp=data[0]['cputime']+data[1]['cputime']+data[2]['cputime']+data[3]['cputime']
95     temp.sort()
96     cpu_max = float(temp[-1]) + 0.1*float(temp[-1])
97     cpu_min = float(temp[0]) - 0.1*float(temp[0])
98    
99     his9 = self.makehis('cpu1',numofdate,2,cpu_max,cpu_min)
100     his10 = self.makehis('cpu2',numofdate,4,cpu_max,cpu_min)
101     his11 = self.makehis('cpu3',numofdate,6,cpu_max,cpu_min)
102     his12 = self.makehis('cpu4',numofdate,8,cpu_max,cpu_min)
103    
104     temp=data[0]['rawsize']+data[1]['rawsize']+data[2]['rawsize']+data[3]['rawsize']
105     temp.sort()
106     raw_max = float(temp[-1]) + 0.1*float(temp[-1])
107     raw_min = float(temp[0]) - 0.1*float(temp[0])
108    
109     his13 = self.makehis('raw1',numofdate,2,raw_max,raw_min)
110     his14 = self.makehis('raw2',numofdate,4,raw_max,raw_min)
111     his15 = self.makehis('raw3',numofdate,6,raw_max,raw_min)
112     his16 = self.makehis('raw4',numofdate,8,raw_max,raw_min)
113    
114     temp=data[0]['recosize']+data[1]['recosize']+data[2]['recosize']+data[3]['recosize']
115     temp.sort()
116     reco_max = float(temp[-1]) + 0.1*float(temp[-1])
117     reco_min = float(temp[0]) - 0.1*float(temp[0])
118    
119     his17 = self.makehis('reco1',numofdate,2,reco_max,reco_min)
120     his18 = self.makehis('reco2',numofdate,4,reco_max,reco_min)
121     his19 = self.makehis('reco3',numofdate,6,reco_max,reco_min)
122     his20 = self.makehis('reco4',numofdate,8,reco_max,reco_min)
123    
124     for k0 in range(len( data[0]['title'])):
125     his1.Fill( data[0]['title'][k0], float( data[0]['vmem'][k0]))
126     his5.Fill( data[0]['title'][k0], float( data[0]['rss'][k0]))
127     his9.Fill( data[0]['title'][k0], float( data[0]['cputime'][k0]))
128     his13.Fill( data[0]['title'][k0], float( data[0]['rawsize'][k0]))
129     his17.Fill( data[0]['title'][k0], float( data[0]['recosize'][k0]))
130    
131     for k1 in range(len( data[1]['title'])):
132     his2.Fill( data[1]['title'][k1], float( data[1]['vmem'][k1]))
133     his6.Fill( data[1]['title'][k1], float( data[1]['rss'][k1]))
134     his10.Fill( data[1]['title'][k1], float( data[1]['cputime'][k1]))
135     his14.Fill( data[1]['title'][k1], float( data[1]['rawsize'][k1]))
136     his18.Fill( data[1]['title'][k1], float( data[1]['recosize'][k1]))
137    
138     for k2 in range(len( data[2]['title'])):
139     his3.Fill( data[2]['title'][k2], float( data[2]['vmem'][k2]))
140     his7.Fill( data[2]['title'][k2], float( data[2]['rss'][k2]))
141     his11.Fill( data[2]['title'][k2], float( data[2]['cputime'][k2]))
142     his15.Fill( data[2]['title'][k2], float( data[2]['rawsize'][k2]))
143     his19.Fill( data[2]['title'][k2], float( data[2]['recosize'][k2]))
144    
145     for k3 in range(len( data[3]['title'])):
146     his4.Fill( data[3]['title'][k3], float( data[3]['vmem'][k3]))
147     his8.Fill( data[3]['title'][k3], float( data[3]['rss'][k3]))
148     his12.Fill( data[3]['title'][k3], float( data[3]['cputime'][k3]))
149     his16.Fill( data[3]['title'][k3], float( data[3]['rawsize'][k3]))
150     his20.Fill( data[3]['title'][k3], float( data[3]['recosize'][k3]))
151    
152    
153     leg1 = self.makeleg(his1, his2, his3, his4)
154     leg2 = self.makeleg(his5, his6, his7, his8)
155     leg3 = self.makeleg(his9, his10, his11, his12)
156     leg4 = self.makeleg(his13, his14, his15, his16)
157     leg5 = self.makeleg(his17, his18, his19, his20)
158    
159    
160    
161     c1 = self.makecanvas("thum",300,200)
162     c2 = self.makecanvas("lage",600,400)
163     c1.cd()
164     his1.Draw()
165     his2.Draw("same")
166     his3.Draw("same")
167     his4.Draw("same")
168     leg1.Draw()
169     c1.Update()
170     c1.Print("1_thum.png")
171    
172     c2.cd()
173     his1.Draw()
174     his2.Draw("same")
175     his3.Draw("same")
176     his4.Draw("same")
177     leg1.Draw()
178     c2.Update()
179     c2.Print("1.png")
180    
181     c1.cd()
182     his5.Draw()
183     his6.Draw("same")
184     his7.Draw("same")
185     his8.Draw("same")
186     leg2.Draw()
187     c1.Update()
188     c1.Print("2_thum.png")
189    
190     c2.cd()
191     his5.Draw()
192     his6.Draw("same")
193     his7.Draw("same")
194     his8.Draw("same")
195     leg2.Draw()
196     c2.Update()
197     c2.Print("2.png")
198    
199     c1.cd()
200     his9.Draw()
201     his10.Draw("same")
202     his11.Draw("same")
203     his12.Draw("same")
204     leg3.Draw()
205     c1.Update()
206     c1.Print("3_thum.png")
207    
208     c2.cd()
209     his9.Draw()
210     his10.Draw("same")
211     his11.Draw("same")
212     his12.Draw("same")
213     leg3.Draw()
214     c2.Update()
215     c2.Print("3.png")
216    
217     c1.cd()
218     his13.Draw()
219     his14.Draw("same")
220     his15.Draw("same")
221     his16.Draw("same")
222     leg4.Draw()
223     c1.Update()
224     c1.Print("4_thum.png")
225    
226     c2.cd()
227     his13.Draw()
228     his14.Draw("same")
229     his15.Draw("same")
230     his16.Draw("same")
231     leg4.Draw()
232     c2.Update()
233     c2.Print("4.png")
234    
235     c1.cd()
236     his17.Draw()
237     his18.Draw("same")
238     his19.Draw("same")
239     his20.Draw("same")
240     leg5.Draw()
241     c1.Update()
242     c1.Print("5_thum.png")
243    
244    
245     c2.cd()
246     his17.Draw()
247     his18.Draw("same")
248     his19.Draw("same")
249     his20.Draw("same")
250     leg5.Draw()
251     c2.Update()
252     c2.Print("5.png")
253    
254    
255    
256    
257     if __name__=="__main__" :
258     mbn = makeBenchmark('1')
259     mbn.mkBench()
260