michael@0: ########################################################################################## michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: sub debug_print { michael@0: foreach $str (@_){ michael@0: # print( $str ); michael@0: } michael@0: } michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: @ARGV; michael@0: $buildRoot = $ARGV[0]; michael@0: #$buildIDFile = '< '.$buildRoot.'\bin\chrome\locales\en-US\navigator\locale\navigator.dtd'; michael@0: $PullID = $ARGV[1]; michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: # Variables for the values in the AVERAGES.TXT file michael@0: # NOTE this is the order they appear in the file michael@0: $Num_Entries = 0; michael@0: $Avg_Parse_Time = 0; michael@0: $Avg_Parse_Time_Percentage = 0; michael@0: $Avg_Content_Time = 0; michael@0: $Avg_Content_Time_Percentage = 0; michael@0: $Avg_Frame_Time = 0; michael@0: $Avg_Frame_Time_Percentage = 0; michael@0: $Avg_Style_Time = 0; michael@0: $Avg_Style_Time_Percentage = 0; michael@0: $Avg_Reflow_Time = 0; michael@0: $Avg_Reflow_Time_Percentage = 0; michael@0: $Avg_TotalLayout_Time = 0; michael@0: $Avg_TotalLayout_Time_Percentage = 0; michael@0: $Avg_TotalPageLoad_Time = 0; michael@0: $count = 0; michael@0: @List; michael@0: @temp; michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: # Get the BuildID michael@0: #open (XUL_FILE, $buildIDFile) or die "Unable to open BuildID file $buildIDFile (footer.pl)"; michael@0: #$BuildNo = ""; michael@0: #$LineList; michael@0: #while () michael@0: #{ michael@0: # $ThisLine = $_; michael@0: # chop ($ThisLine); michael@0: # if (/Build ID/){ michael@0: # @LineList = split (/\"/, $ThisLine); michael@0: # $BuildNo = $LineList[1]; michael@0: # } michael@0: #} michael@0: #$BuildNo =~ s/"//g; michael@0: #$BuildNo =~ s/[>]//g; michael@0: #close (XUL_FILE); michael@0: #debug_print ($BuildNo); michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: # Process the averages file: get the number of entries michael@0: # and divide out the accumulated values michael@0: # michael@0: open (AVERAGE, "< Average.txt") or die "Unable to open average.txt (Footer.pl)"; michael@0: while () michael@0: { michael@0: $ThisLine = $_; michael@0: chop ($ThisLine); michael@0: michael@0: if( /Num Entries:/ ){ michael@0: @list = split( / /, $ThisLine ); michael@0: $Num_Entries = $list[2]; michael@0: debug_print( "Num Entries in Footer: $Num_Entries\n" ); michael@0: } else { michael@0: if( $Num_Entries != 0 ){ michael@0: @temp = split (/ /, $ThisLine); michael@0: $List[$count] = $temp[2]; michael@0: $List[$count] = $List[$count] / $Num_Entries; michael@0: debug_print( "Averaged entry: $temp[2] / $Num_Entries = $List[$count]\n" ); michael@0: $count ++; michael@0: } else { michael@0: print( "Number of entries is 0: this is either a bad file or the universe has imploded\n" ); michael@0: die; michael@0: } michael@0: } michael@0: } michael@0: close (AVERAGE); michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: # Now put the values to the table michael@0: # michael@0: open (TABLE_FILE, ">>table.html") or die "Cannot open the file table.html"; michael@0: michael@0: print (TABLE_FILE ""); michael@0: print (TABLE_FILE ""); michael@0: print (TABLE_FILE "
Average
"); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Parse_Time = @List [0]; michael@0: debug_print ("$Avg_Parse_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Parse_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Parse_Time_Percentage = @List [1]; michael@0: debug_print ("$Avg_Parse_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Parse_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Content_Time = @List [2]; michael@0: debug_print ("$Avg_Content_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Content_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Content_Time_Percentage = @List [3]; michael@0: debug_print ("$Avg_Content_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Content_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Frame_Time = @List [4]; michael@0: debug_print ("$Avg_Frame_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Frame_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Frame_Time_Percentage = @List [5]; michael@0: debug_print ("$Avg_Frame_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Frame_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Style_Time = @List [6]; michael@0: debug_print ("$Avg_Style_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Style_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Style_Time_Percentage = @List [7]; michael@0: debug_print ("$Avg_Style_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Style_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Reflow_Time = @List [8]; michael@0: debug_print ("$Avg_Reflow_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Reflow_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_Reflow_Time_Percentage = @List [9]; michael@0: debug_print ("$Avg_Reflow_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_Reflow_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_TotalLayout_Time = @List [10]; michael@0: debug_print ("$Avg_TotalLayout_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_TotalLayout_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_TotalLayout_Time_Percentage = @List [11]; michael@0: debug_print ("$Avg_TotalLayout_Time_Percentage\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_TotalLayout_Time_Percentage); michael@0: print (TABLE_FILE ""); michael@0: michael@0: $Avg_TotalPageLoad_Time = @List [12]; michael@0: debug_print ("$Avg_TotalPageLoad_Time\n"); michael@0: print (TABLE_FILE ""); michael@0: printf (TABLE_FILE "
%4.2f
",$Avg_TotalPageLoad_Time); michael@0: print (TABLE_FILE ""); michael@0: michael@0: print (TABLE_FILE ""); michael@0: print (TABLE_FILE ""); michael@0: print (TABLE_FILE ""); michael@0: michael@0: close (TABLE_FILE); michael@0: michael@0: #------------------------------------------------------------------------------ michael@0: # Now create the History file entries michael@0: # FORMAT: "pullID, buildID, ParseTime, ParsePer, ContentTime, ContentPer, FrameTime, FramePer, michael@0: # StyleTime, StylePer, ReflowTime, ReflowPer, LayoutTime, LayoutPer, TotalTime" michael@0: # michael@0: open (HISTORY, ">> History.txt" ) or die "History file could not be opened: no history will be written\n"; michael@0: print(HISTORY "$PullID,$BuildNo,$Avg_Parse_Time,$Avg_Parse_Time_Percentage,$Avg_Content_Time,$Avg_Content_Time_Percentage,"); michael@0: 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: print(HISTORY "$Avg_TotalLayout_Time,$Avg_TotalLayout_Time_Percentage,$Avg_TotalPageLoad_Time\n"); michael@0: close(HISTORY);