|
1 ########################################################################################## |
|
2 # |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 |
|
8 #------------------------------------------------------------------------------ |
|
9 sub debug_print { |
|
10 foreach $str (@_){ |
|
11 # print( $str ); |
|
12 } |
|
13 } |
|
14 |
|
15 #------------------------------------------------------------------------------ |
|
16 @ARGV; |
|
17 $buildRoot = $ARGV[0]; |
|
18 #$buildIDFile = '< '.$buildRoot.'\bin\chrome\locales\en-US\navigator\locale\navigator.dtd'; |
|
19 $PullID = $ARGV[1]; |
|
20 |
|
21 #------------------------------------------------------------------------------ |
|
22 # Variables for the values in the AVERAGES.TXT file |
|
23 # NOTE this is the order they appear in the file |
|
24 $Num_Entries = 0; |
|
25 $Avg_Parse_Time = 0; |
|
26 $Avg_Parse_Time_Percentage = 0; |
|
27 $Avg_Content_Time = 0; |
|
28 $Avg_Content_Time_Percentage = 0; |
|
29 $Avg_Frame_Time = 0; |
|
30 $Avg_Frame_Time_Percentage = 0; |
|
31 $Avg_Style_Time = 0; |
|
32 $Avg_Style_Time_Percentage = 0; |
|
33 $Avg_Reflow_Time = 0; |
|
34 $Avg_Reflow_Time_Percentage = 0; |
|
35 $Avg_TotalLayout_Time = 0; |
|
36 $Avg_TotalLayout_Time_Percentage = 0; |
|
37 $Avg_TotalPageLoad_Time = 0; |
|
38 $count = 0; |
|
39 @List; |
|
40 @temp; |
|
41 |
|
42 #------------------------------------------------------------------------------ |
|
43 # Get the BuildID |
|
44 #open (XUL_FILE, $buildIDFile) or die "Unable to open BuildID file $buildIDFile (footer.pl)"; |
|
45 #$BuildNo = ""; |
|
46 #$LineList; |
|
47 #while (<XUL_FILE>) |
|
48 #{ |
|
49 # $ThisLine = $_; |
|
50 # chop ($ThisLine); |
|
51 # if (/Build ID/){ |
|
52 # @LineList = split (/\"/, $ThisLine); |
|
53 # $BuildNo = $LineList[1]; |
|
54 # } |
|
55 #} |
|
56 #$BuildNo =~ s/"//g; |
|
57 #$BuildNo =~ s/[>]//g; |
|
58 #close (XUL_FILE); |
|
59 #debug_print ($BuildNo); |
|
60 |
|
61 #------------------------------------------------------------------------------ |
|
62 # Process the averages file: get the number of entries |
|
63 # and divide out the accumulated values |
|
64 # |
|
65 open (AVERAGE, "< Average.txt") or die "Unable to open average.txt (Footer.pl)"; |
|
66 while (<AVERAGE>) |
|
67 { |
|
68 $ThisLine = $_; |
|
69 chop ($ThisLine); |
|
70 |
|
71 if( /Num Entries:/ ){ |
|
72 @list = split( / /, $ThisLine ); |
|
73 $Num_Entries = $list[2]; |
|
74 debug_print( "Num Entries in Footer: $Num_Entries\n" ); |
|
75 } else { |
|
76 if( $Num_Entries != 0 ){ |
|
77 @temp = split (/ /, $ThisLine); |
|
78 $List[$count] = $temp[2]; |
|
79 $List[$count] = $List[$count] / $Num_Entries; |
|
80 debug_print( "Averaged entry: $temp[2] / $Num_Entries = $List[$count]\n" ); |
|
81 $count ++; |
|
82 } else { |
|
83 print( "Number of entries is 0: this is either a bad file or the universe has imploded\n" ); |
|
84 die; |
|
85 } |
|
86 } |
|
87 } |
|
88 close (AVERAGE); |
|
89 |
|
90 #------------------------------------------------------------------------------ |
|
91 # Now put the values to the table |
|
92 # |
|
93 open (TABLE_FILE, ">>table.html") or die "Cannot open the file table.html"; |
|
94 |
|
95 print (TABLE_FILE "<tr>"); |
|
96 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
97 print (TABLE_FILE "<center><b><font size =+1>Average</font></b></center>"); |
|
98 print (TABLE_FILE "</td>"); |
|
99 |
|
100 $Avg_Parse_Time = @List [0]; |
|
101 debug_print ("$Avg_Parse_Time\n"); |
|
102 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
103 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Parse_Time); |
|
104 print (TABLE_FILE "</td>"); |
|
105 |
|
106 $Avg_Parse_Time_Percentage = @List [1]; |
|
107 debug_print ("$Avg_Parse_Time_Percentage\n"); |
|
108 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
109 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Parse_Time_Percentage); |
|
110 print (TABLE_FILE "</td>"); |
|
111 |
|
112 $Avg_Content_Time = @List [2]; |
|
113 debug_print ("$Avg_Content_Time\n"); |
|
114 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
115 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Content_Time); |
|
116 print (TABLE_FILE "</td>"); |
|
117 |
|
118 $Avg_Content_Time_Percentage = @List [3]; |
|
119 debug_print ("$Avg_Content_Time_Percentage\n"); |
|
120 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
121 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Content_Time_Percentage); |
|
122 print (TABLE_FILE "</td>"); |
|
123 |
|
124 $Avg_Frame_Time = @List [4]; |
|
125 debug_print ("$Avg_Frame_Time\n"); |
|
126 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
127 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Frame_Time); |
|
128 print (TABLE_FILE "</td>"); |
|
129 |
|
130 $Avg_Frame_Time_Percentage = @List [5]; |
|
131 debug_print ("$Avg_Frame_Time_Percentage\n"); |
|
132 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
133 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Frame_Time_Percentage); |
|
134 print (TABLE_FILE "</td>"); |
|
135 |
|
136 $Avg_Style_Time = @List [6]; |
|
137 debug_print ("$Avg_Style_Time\n"); |
|
138 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
139 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Style_Time); |
|
140 print (TABLE_FILE "</td>"); |
|
141 |
|
142 $Avg_Style_Time_Percentage = @List [7]; |
|
143 debug_print ("$Avg_Style_Time_Percentage\n"); |
|
144 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
145 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Style_Time_Percentage); |
|
146 print (TABLE_FILE "</td>"); |
|
147 |
|
148 $Avg_Reflow_Time = @List [8]; |
|
149 debug_print ("$Avg_Reflow_Time\n"); |
|
150 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
151 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Reflow_Time); |
|
152 print (TABLE_FILE "</td>"); |
|
153 |
|
154 $Avg_Reflow_Time_Percentage = @List [9]; |
|
155 debug_print ("$Avg_Reflow_Time_Percentage\n"); |
|
156 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
157 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Reflow_Time_Percentage); |
|
158 print (TABLE_FILE "</td>"); |
|
159 |
|
160 $Avg_TotalLayout_Time = @List [10]; |
|
161 debug_print ("$Avg_TotalLayout_Time\n"); |
|
162 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
163 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalLayout_Time); |
|
164 print (TABLE_FILE "</td>"); |
|
165 |
|
166 $Avg_TotalLayout_Time_Percentage = @List [11]; |
|
167 debug_print ("$Avg_TotalLayout_Time_Percentage\n"); |
|
168 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
169 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalLayout_Time_Percentage); |
|
170 print (TABLE_FILE "</td>"); |
|
171 |
|
172 $Avg_TotalPageLoad_Time = @List [12]; |
|
173 debug_print ("$Avg_TotalPageLoad_Time\n"); |
|
174 print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>"); |
|
175 printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalPageLoad_Time); |
|
176 print (TABLE_FILE "</td>"); |
|
177 |
|
178 print (TABLE_FILE "</tr>"); |
|
179 print (TABLE_FILE "</table>"); |
|
180 print (TABLE_FILE "</html>"); |
|
181 |
|
182 close (TABLE_FILE); |
|
183 |
|
184 #------------------------------------------------------------------------------ |
|
185 # Now create the History file entries |
|
186 # FORMAT: "pullID, buildID, ParseTime, ParsePer, ContentTime, ContentPer, FrameTime, FramePer, |
|
187 # StyleTime, StylePer, ReflowTime, ReflowPer, LayoutTime, LayoutPer, TotalTime" |
|
188 # |
|
189 open (HISTORY, ">> History.txt" ) or die "History file could not be opened: no history will be written\n"; |
|
190 print(HISTORY "$PullID,$BuildNo,$Avg_Parse_Time,$Avg_Parse_Time_Percentage,$Avg_Content_Time,$Avg_Content_Time_Percentage,"); |
|
191 print(HISTORY "$Avg_Frame_Time,$Avg_Frame_Time_Percentage,$Avg_Style_Time,$Avg_Style_Time_Percentage,$Avg_Reflow_Time,$Avg_Reflow_Time_Percentage,"); |
|
192 print(HISTORY "$Avg_TotalLayout_Time,$Avg_TotalLayout_Time_Percentage,$Avg_TotalPageLoad_Time\n"); |
|
193 close(HISTORY); |