tools/performance/layout/Footer.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial