ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeDepMetrics.py
Revision: 1.13
Committed: Wed Sep 9 19:47:48 2009 UTC (15 years, 7 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +3 -5 lines
Log Message:
Modify the cycles info. It is not use dropdown menu now.

File Contents

# Content
1 #!/usr/bin/env python
2 import re, os
3
4 class mkDepMetrics(object) :
5 def __init__(self, page, tday, arch, packagename) :
6 self.page=page
7 self.tday = tday
8 self.arch = arch
9 self.packagename = packagename
10 self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+packagename+'/igRun/metrics'
11 temp = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url)
12 self.contents=[]
13 self.contents = temp.readlines()
14
15
16 def makeSummary(self):
17 contents=self.contents
18 writeflag = False
19 cycleflag = False
20 typeCycle = re.compile('^(Cycle \w*)')
21 if len(contents)==0 :
22 self.page.write(' * No data about summary\n')
23 for line in contents :
24 matchCycle = typeCycle.search(line)
25 if line=='# Summary\n' :
26 self.page.write(' * Summary\n')
27 writeflag = True
28 elif line=='# Levels\n' :
29 writeflag = False
30 cycleflag = False
31 self.page.write('''<br><pre>
32 * CCD: Cumulative Component Dependency measures the cumulative testing cost
33 across the system.
34 * ACD: Average Component Dependency indicates the number of other packages
35 an average package depends on.
36 * NCCD: Normalised Cumulative Component Dependency measures how the structure
37 differs from a balanced binary tree of comparable size. If NCCD is one,
38 the structure resembles a binary tree; if much less than one, the
39 packages are mostly independent; if much greater than one, the system
40 is fairly strongly coupled. The only universal NCCD target is to
41 minimise for any given software system--a high value indicates a
42 strongly coupled system and less coupling is better.
43 </pre>
44 ''')
45 break
46 elif line=='\n' :
47 continue
48 elif line[0:5] =='* CCD' :
49 writeflag = False
50 elif line=='# Cycles\n' :
51 self.page.write(' * Cycles\n')
52 cycleflag=True
53 elif matchCycle and cycleflag :
54 self.page.write(' * '+matchCycle.group(1)+'\n')
55 elif cycleflag :
56 self.page.write(' * !'+line.strip()+'\n')
57 elif writeflag :
58 self.page.write(' * '+line)
59 else :
60 continue
61
62
63 def packlist(self):
64 contents=self.contents
65 pack = [['Levels']]
66 j=0
67 writeflag = False
68 valueflag = False
69 if len(contents)==0 :
70 self.page.write(' * No data about metrics information.\n')
71 return pack
72 for line in contents :
73 if line =='# Levels\n' :
74 writeflag = True
75 continue
76 elif not writeflag :
77 continue
78 if line=='\n':
79 continue
80 matchLevel = re.search('[0-9]. ',line)
81 if matchLevel :
82 j = j + 1
83 temp = line.split()
84 pack.append(temp)
85 valueflag=True
86 continue
87 if valueflag :
88 if line=='\n' :
89 valueflag=False
90 continue
91 else :
92 temp =line.strip()
93 pack[j].append(temp)
94 return pack
95 # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...]
96 def repack(self,pack):
97 listlen = len(pack)
98 pack2 = [['Levels']]
99 countpack = 0
100 for i in range(1,listlen):
101 packname = [[str(i)]]
102 check = 1
103 for j in range(1,len(pack[i])):
104
105 m = re.search('/',pack[i][j])
106 per = m.span()
107 title = pack[i][j][0:per[0]]
108 module = pack[i][j][per[1]:]
109 if j==1:
110 temp = []
111 temp.append(title)
112 packname.append(temp)
113 packname[check].append(module)
114 else:
115 if packname[check][0]==title:
116 packname[check].append(module)
117 else:
118 check = check + 1
119 temp = []
120 temp.append(title)
121 packname.append(temp)
122 packname[check].append(module)
123
124 pack2.append(packname)
125 return pack2
126
127 def dropdown(self,list):
128 self.page.write('\n<div id="test">\n\n')
129 listlen = len(list)
130 for level in range(1,listlen):
131 self.page.write(' * !'+str(list[level][0][0])+'\n')
132 for pack in range(1,len(list[level])):
133 self.page.write(' * !'+str(list[level][pack][0])+'\n')
134 for module in range(1,len(list[level][pack])):
135 self.page.write(' * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.packagename+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n')
136 self.page.write('</div>\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n<br><br>\n\n')
137
138
139
140 if __name__=="__main__" :
141 from makeDepMetrics import mkDepMetrics
142 mkDM = mkDepMetrics('t','slc4_ia32_gcc345','CMSSW_3_1_X_2009-08-05-1200')
143 pkglist = mkDM.packlist()
144 outputlist = mkDM.repack(pkglist)
145 mkDM.dropdown(outputlist)
146