Added perl scripts for performance monitoring of Mozilla

This commit is contained in:
attinasi%netscape.com 2000-02-18 01:42:56 +00:00
Родитель 5bf101f82d
Коммит fdf1371fa0
7 изменённых файлов: 1558 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,465 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
#------------------------------------------------------------------------------
sub debug_print {
foreach $str (@_){
# print( $str );
}
}
#------------------------------------------------------------------------------
# get the arguments:
#------------------------------------------------------------------------------
@ARGV;
$UrlName = $ARGV[0];
$logFile = $ARGV[1];
$NumOfSites = $ARGV[2];
$buildIDFile = $ARGV[3];
$LinkURL = $ARGV[4];
$buildIDFile = '< '.$buildIDFile.'\bin\chrome\navigator\locale\en-US\navigator.dtd';
debug_print( "Arguments:[ $UrlName | $logFile | $NumOfSites | $buildIDFile | $LinkURL ]\n");
#------------------------------------------------------------------------------
# Open the ID file and get the build ID
#------------------------------------------------------------------------------
open (XUL_FILE, $buildIDFile) or die "Cannot open BuildID file $buildIDFile (AverageTable2.pl)\n";
$BuildNo = "";
$LineList;
while (<XUL_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
if (/Build ID/){
@LineList = split (/ /, $ThisLine);
$BuildNo = $LineList[5];
}
}
$BuildNo =~ s/"//g;
$BuildNo =~ s/[>]//g;
debug_print ("Build Number: $BuildNo\n");
close( XUL_FILE );
#------------------------------------------------------------------------------
# Open the logfile (input)
# and the deviation file (output,append)
#------------------------------------------------------------------------------
open (LOG_FILE, "< $logFile") or die "Logfile $logFile could not be opened";
#------------------------------------------------------------------------------
# Deviation file:
# Flat file used to calculate and display deviation between latest and
# week old builds data.
#
# Format of flat file is attributes separated by commas with no spaces as follows:
# BuildNo,date,url,parsingtime,parsingper,contenttime,contentper,frametime,
# frameper,styletime,styleper,reflowtime,reflowper,totallayouttime,totallayoutper,
# totalpageloadtime
$file = $BuildNo.".dat";
open (DEVIATION, ">> $file") or die "Deviation file could not be opened";
# add entry to the deviation file
($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $$WeekDay, $DayOfYear, $IsDST) = localtime (time);
$RealMonth = $Month + 1;
$date2 = $RealMonth.$DayOfMonth.$Year;
print (DEVIATION "$BuildNo,$date2,$UrlName,");
#------------------------------------------------------------------------------
# local variables
#------------------------------------------------------------------------------
@List;
$Content_Time = 0;
$Reflow_Time = 0;
$FrameAndStyle_Time = 0;
$Frame_Time = 0;
$Style_Time = 0;
$Parse_Time = 0;
$TotalPageLoad_Time = 0;
$TotalLayout_Time = 0;
$Avg_Content_Time = 0;
$Avg_Reflow_Time = 0;
$Avg_FrameAndStyle_Time = 0;
$Avg_Frame_Time = 0;
$Avg_Style_Time = 0;
$Avg_Parse_Time = 0;
$Avg_TotalPageLoad_Time = 0;
$Avg_TotalLayout_Time = 0;
$Content_Time_Percentage = 0;
$Reflow_Time_Percentage = 0;
$FrameAndStyle_Time_Percentage = 0;
$Frame_Time_Percentage = 0;
$Style_Time_Percentage = 0;
$Parse_Time_Percentage = 0;
$TotalLayout_Time_Percentage = 0;
$Avg_Content_Time_Percentage = 0;
$Avg_Reflow_Time_Percentage = 0;
$Avg_FrameAndStyle_Time_Percentage = 0;
$Avg_Frame_Time_Percentage = 0;
$Avg_Style_Time_Percentage = 0;
$Avg_Parse_Time_Percentage = 0;
$Avg_TotalLayout_Time_Percentage = 0;
$Num_Entries = 0;
$valid = 0;
$WebShell;
$temp;
$url;
$Content_Flag = 0;
$Reflow_Flag = 0;
$Style_Flag = 0;
$Parse_Flag = 0;
#------------------------------------------------------------------------------
# Management of averages via average.txt file
# NOTE: the averag.txt file is used to accumulate all performance times
# and keep track of the number of entries. When completed, the footer.pl
# script does the averaging by dividing the accumulated times by the
# number of entries
#------------------------------------------------------------------------------
# if first site, delete any old Average file (in case the caller did not)
#
if ( $NumOfSites == 1 ){
unlink( "Average.txt" );
debug_print( "Deleting file Average.txt\n" );
}
# load the averages data so we can accumulate it
#
if ( -r "Average.txt" ) {
open (AVERAGE, "< Average.txt");
while( <AVERAGE> ){
$ThisLine = $_;
chop ($ThisLine);
if( /Num Entries:/ ){
@list = split( / /, $ThisLine );
$Num_Entries = $list[2];
debug_print( "Num Entries: $Num_Entries\n" );
}
if( /Avg Parse:/ ){
@list = split( / /, $ThisLine );
$Avg_Parse_Time = $list[2];
debug_print( "Avg Parse: $Avg_Parse_Time\n" );
}
if( /Per Parse:/ ){
@list = split( / /, $ThisLine );
$Avg_Parse_Time_Percentage = $list[2];
debug_print( "Per Parse: $Avg_Parse_Time_Percentage\n" );
}
if( /Avg Content:/ ){
@list = split( / /, $ThisLine );
$Avg_Content_Time = $list[2];
debug_print( "Avg Content: $Avg_Content_Time\n" );
}
if( /Per Content:/ ){
@list = split( / /, $ThisLine );
$Avg_Content_Time_Percentage = $list[2];
debug_print( "Per Content: $Avg_Content_Time_Percentage\n" );
}
if( /Avg Frame:/ ){
@list = split( / /, $ThisLine );
$Avg_Frame_Time = $list[2];
debug_print( "Avg Frame: $Avg_Frame_Time\n" );
}
if( /Per Frame:/ ){
@list = split( / /, $ThisLine );
$Avg_Frame_Time_Percentage = $list[2];
debug_print( "Per Frame: $Avg_Frame_Time_Percentage\n" );
}
if( /Avg Style:/ ){
@list = split( / /, $ThisLine );
$Avg_Style_Time = $list[2];
debug_print( "Avg Style: $Avg_Style_Time\n" );
}
if( /Per Style:/ ){
@list = split( / /, $ThisLine );
$Avg_Style_Time_Percentage = $list[2];
debug_print( "Per Style: $Avg_Style_Time_Percentage\n" );
}
if( /Avg Reflow:/ ){
@list = split( / /, $ThisLine );
$Avg_Reflow_Time = $list[2];
debug_print( "Avg Reflow: $Avg_Reflow_Time\n" );
}
if( /Per Reflow:/ ){
@list = split( / /, $ThisLine );
$Avg_Reflow_Time_Percentage = $list[2];
debug_print( "Per Reflow: $Avg_Reflow_Time_Percentage\n" );
}
if( /Avg TotalLayout:/ ){
@list = split( / /, $ThisLine );
$Avg_TotalLayout_Time = $list[2];
debug_print( "Avg TotalLayout: $Avg_TotalLayout_Time\n" );
}
if( /Per Layout:/ ){
@list = split( / /, $ThisLine );
$Avg_TotalLayout_Time_Percentage = $list[2];
debug_print( "Per Layout: $Avg_TotalLayout_Time_Percentage\n" );
}
if( /Avg PageLoad:/ ){
@list = split( / /, $ThisLine );
$Avg_TotalPageLoad_Time = $list[2];
debug_print( "Avg PageLoad: $Avg_TotalPageLoad_Time\n" );
}
}
print (AVERAGE "Avg PageLoad: $Avg_TotalPageLoad_Time\n");
close (AVERAGE);
}
#------------------------------------------------------------------------------
# now run through the log file and process the performance data
#------------------------------------------------------------------------------
$IsValidURL = 0;
while (<LOG_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
if (/Timing layout/)
{
@List = split (/webshell: /, $ThisLine);
$WebShell = $List[1];
$WebShell = "(webshell=".$WebShell;
$WebShell = $WebShell."):";
debug_print( "$WebShell\n" );
@List = split (/'/, $ThisLine);
$url = $List[1];
debug_print( "(URI: $url) " );
if( $url =~ /$LinkURL/ ){
debug_print( "$url is the one!\n" );
$IsValidURL = 1;
} else {
debug_print( "Skipping URL $url\n" );
$IsValidURL = 0;
}
}
if (/Content/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$Content_Time = $List[9];
$Content_Flag = 1;
debug_print( "Content Time: $Content_Time\n" );
}
}
if (/Reflow/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$Reflow_Time = $List[8];
$Reflow_Flag = 1;
debug_print( "Reflow Time: $Reflow_Time\n" );
}
}
if (/Frame construction plus/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$FrameAndStyle_Time = $List[12];
debug_print( "Frame and Style Time: $FrameAndStyle_Time\n" );
}
}
if (/Style/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$Style_Time = $List[9];
$Style_Flag = 1;
debug_print( "Style Time: $Style_Time\n" );
}
}
if (/Parse/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$Parse_Time = $List[8];
$Parse_Flag = 1;
debug_print( "Parse Time: $Parse_Time\n" );
}
}
if (/Total/){
if ($IsValidURL == 1){
@List = split (/ /, $ThisLine);
$temp = $List[6];
if (($temp == $WebShell) &&
($Parse_Flag == 1) &&
($Content_Flag == 1) &&
($Reflow_Flag == 1) &&
($Style_Flag == 1)){
$TotalPageLoad_Time = $List[12];
debug_print( "Total Page Load_Time Time: $TotalPageLoad_Time\n" );
$Content_Flag = 0;
$Reflow_Flag = 0;
$Style_Flag = 0;
$Parse_Flag = 0;
}
}
}
}
#------------------------------------------------------------------------------
# Calculate the significant time values
#------------------------------------------------------------------------------
$Frame_Time = $FrameAndStyle_Time - $Style_Time;
$TotalLayout_Time = $Content_Time + $Reflow_Time + $Frame_Time + $Style_Time + $Parse_Time;
$Avg_Time = $Avg_Time + $TotalLayoutTime + $TotalPageLoad_Time;
if( $TotalLayout_Time > 0 ){
if ($Content_Time != 0)
{
$Content_Time_Percentage = ($Content_Time / $TotalLayout_Time) * 100;
}
if ($Reflow_Time != 0)
{
$Reflow_Time_Percentage = ($Reflow_Time / $TotalLayout_Time) * 100;
}
if ($Frame_Time != 0)
{
$Frame_Time_Percentage = ($Frame_Time / $TotalLayout_Time) * 100;
}
if ($Style_Time != 0)
{
$Style_Time_Percentage = ($Style_Time / $TotalLayout_Time) * 100;
}
if ($Parse_Time != 0)
{
$Parse_Time_Percentage = ($Parse_Time / $TotalLayout_Time) * 100;
}
if( $TotalPageLoad_Time > 0 ){
$TotalLayout_Time_Percentage = ($TotalLayout_Time / $TotalPageLoad_Time) * 100;
} else {
$TotalLayout_Time_Percentage = 100;
}
}
#------------------------------------------------------------------------------
# Add current values to those in the averages-fields
#------------------------------------------------------------------------------
$Avg_Content_Time += $Content_Time;
$Avg_Reflow_Time += $Reflow_Time;
$Avg_Frame_Time += $Frame_Time;
$Avg_Style_Time += $Style_Time;
$Avg_Parse_Time += $Parse_Time;
$Avg_TotalPageLoad_Time += $TotalPageLoad_Time;
$Avg_TotalLayout_Time += $TotalLayout_Time;
$Avg_Content_Time_Percentage += $Content_Time_Percentage;
$Avg_Reflow_Time_Percentage += $Reflow_Time_Percentage;
$Avg_Frame_Time_Percentage += $Frame_Time_Percentage;
$Avg_Style_Time_Percentage += $Style_Time_Percentage;
$Avg_Parse_Time_Percentage += $Parse_Time_Percentage;
$Avg_TotalLayout_Time_Percentage += $TotalLayout_Time_Percentage;
$Num_Entries += 1;
#------------------------------------------------------------------------------
# Now write this site's data to the table
#------------------------------------------------------------------------------
open (TABLE_FILE, ">>table.html");
print (TABLE_FILE "<tr>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
print (TABLE_FILE "<center><a href='$LinkURL'>$UrlName</a></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Parse_Time);
print (DEVIATION "$Parse_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Parse_Time_Percentage);
print (DEVIATION "$Parse_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Content_Time);
print (DEVIATION "$Content_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Content_Time_Percentage);
print (DEVIATION "$Content_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Frame_Time);
print (DEVIATION "$Frame_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Frame_Time_Percentage);
print (DEVIATION "$Frame_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Style_Time);
print (DEVIATION "$Style_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Style_Time_Percentage);
print (DEVIATION "$Style_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Reflow_Time);
print (DEVIATION "$Reflow_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$Reflow_Time_Percentage);
print (DEVIATION "$Reflow_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$TotalLayout_Time);
print (DEVIATION "$TotalLayout_Time,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFF00'>");
printf (TABLE_FILE "<center>%4.2f</center>",$TotalLayout_Time_Percentage);
print (DEVIATION "$TotalLayout_Time_Percentage,");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td BGCOLOR='#FFFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center>",$TotalPageLoad_Time);
print (DEVIATION "$TotalPageLoad_Time\n");
print (TABLE_FILE "</td>");
print (TABLE_FILE "</tr>\n");
close (LOG_FILE);
open (AVERAGE, "> Average.txt");
print (AVERAGE "Num Entries: $Num_Entries\n");
print (AVERAGE "Avg Parse: $Avg_Parse_Time\n");
print (AVERAGE "Per Parse: $Avg_Parse_Time_Percentage\n");
print (AVERAGE "Avg Content: $Avg_Content_Time\n");
print (AVERAGE "Per Content: $Avg_Content_Time_Percentage\n");
print (AVERAGE "Avg Frame: $Avg_Frame_Time\n");
print (AVERAGE "Per Frame: $Avg_Frame_Time_Percentage\n");
print (AVERAGE "Avg Style: $Avg_Style_Time\n");
print (AVERAGE "Per Style: $Avg_Style_Time_Percentage\n");
print (AVERAGE "Avg Reflow: $Avg_Reflow_Time\n");
print (AVERAGE "Per Reflow: $Avg_Reflow_Time_Percentage\n");
print (AVERAGE "Avg TotalLayout: $Avg_TotalLayout_Time\n");
print (AVERAGE "Per Layout: $Avg_TotalLayout_Time_Percentage\n");
print (AVERAGE "Avg PageLoad: $Avg_TotalPageLoad_Time\n");
close (AVERAGE);

Просмотреть файл

@ -0,0 +1,213 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
#------------------------------------------------------------------------------
sub debug_print {
foreach $str (@_){
# print( $str );
}
}
#------------------------------------------------------------------------------
@ARGV;
$buildIDFile = $ARGV[0];
$buildIDFile = '< '.$buildIDFile.'\bin\chrome\navigator\locale\en-US\navigator.dtd';
$PullID = $ARGV[1];
#------------------------------------------------------------------------------
# Variables for the values in the AVERAGES.TXT file
# NOTE this is the order they appear in the file
$Num_Entries = 0;
$Avg_Parse_Time = 0;
$Avg_Parse_Time_Percentage = 0;
$Avg_Content_Time = 0;
$Avg_Content_Time_Percentage = 0;
$Avg_Frame_Time = 0;
$Avg_Frame_Time_Percentage = 0;
$Avg_Style_Time = 0;
$Avg_Style_Time_Percentage = 0;
$Avg_Reflow_Time = 0;
$Avg_Reflow_Time_Percentage = 0;
$Avg_TotalLayout_Time = 0;
$Avg_TotalLayout_Time_Percentage = 0;
$Avg_TotalPageLoad_Time = 0;
$count = 0;
@List;
@temp;
#------------------------------------------------------------------------------
# Get the BuildID
open (XUL_FILE, $buildIDFile) or die "Unable to open BuildID file $buildIDFile (header.pl)";
$BuildNo = "";
$LineList;
while (<XUL_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
if (/Build ID/){
@LineList = split (/ /, $ThisLine);
$BuildNo = $LineList[3];
$BuildNo .= " ".$LineList[4];
$BuildNo .= " ".$LineList[5];
}
}
$BuildNo =~ s/"//g;
$BuildNo =~ s/[>]//g;
close (XUL_FILE);
debug_print ($BuildNo);
#------------------------------------------------------------------------------
# Process the averages file: get the number of entries
# and divide out the accumulated values
#
open (AVERAGE, "< Average.txt") or die "Unable to open average.txt (Footer.pl)";
while (<AVERAGE>)
{
$ThisLine = $_;
chop ($ThisLine);
if( /Num Entries:/ ){
@list = split( / /, $ThisLine );
$Num_Entries = $list[2];
debug_print( "Num Entries in Footer: $Num_Entries\n" );
} else {
if( $Num_Entries != 0 ){
@temp = split (/ /, $ThisLine);
$List[$count] = $temp[2];
$List[$count] = $List[$count] / $Num_Entries;
debug_print( "Averaged entry: $temp[2] / $Num_Entries = $List[$count]\n" );
$count ++;
} else {
print( "Number of entries is 0: this is either a bad file or the universe has imploded\n" );
die;
}
}
}
close (AVERAGE);
#------------------------------------------------------------------------------
# Now put the values to the table
#
open (TABLE_FILE, ">>table.html") or die "Cannot open the file table.html";
print (TABLE_FILE "<tr>");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b><font size =+1>Average</font></b></center>");
print (TABLE_FILE "</td>");
$Avg_Parse_Time = @List [0];
debug_print ("$Avg_Parse_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Parse_Time);
print (TABLE_FILE "</td>");
$Avg_Parse_Time_Percentage = @List [1];
debug_print ("$Avg_Parse_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Parse_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_Content_Time = @List [2];
debug_print ("$Avg_Content_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Content_Time);
print (TABLE_FILE "</td>");
$Avg_Content_Time_Percentage = @List [3];
debug_print ("$Avg_Content_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Content_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_Frame_Time = @List [4];
debug_print ("$Avg_Frame_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Frame_Time);
print (TABLE_FILE "</td>");
$Avg_Frame_Time_Percentage = @List [5];
debug_print ("$Avg_Frame_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Frame_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_Style_Time = @List [6];
debug_print ("$Avg_Style_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Style_Time);
print (TABLE_FILE "</td>");
$Avg_Style_Time_Percentage = @List [7];
debug_print ("$Avg_Style_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Style_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_Reflow_Time = @List [8];
debug_print ("$Avg_Reflow_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Reflow_Time);
print (TABLE_FILE "</td>");
$Avg_Reflow_Time_Percentage = @List [9];
debug_print ("$Avg_Reflow_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_Reflow_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_TotalLayout_Time = @List [10];
debug_print ("$Avg_TotalLayout_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalLayout_Time);
print (TABLE_FILE "</td>");
$Avg_TotalLayout_Time_Percentage = @List [11];
debug_print ("$Avg_TotalLayout_Time_Percentage\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalLayout_Time_Percentage);
print (TABLE_FILE "</td>");
$Avg_TotalPageLoad_Time = @List [12];
debug_print ("$Avg_TotalPageLoad_Time\n");
print (TABLE_FILE "<td BGCOLOR='#CCFFFF'>");
printf (TABLE_FILE "<center>%4.2f</center></B></FONT>",$Avg_TotalPageLoad_Time);
print (TABLE_FILE "</td>");
print (TABLE_FILE "</tr>");
print (TABLE_FILE "</table>");
print (TABLE_FILE "</html>");
close (TABLE_FILE);
#------------------------------------------------------------------------------
# Now create the History file entries
# FORMAT: "pullID, buildID, ParseTime, ParsePer, ContentTime, ContentPer, FrameTime, FramePer,
# StyleTime, StylePer, ReflowTime, ReflowPer, LayoutTime, LayoutPer, TotalTime"
#
open (HISTORY, ">> History.txt" ) or die "History file could not be opened: no history will be written\n";
print(HISTORY "$PullID,$BuildNo,$Avg_Parse_Time,$Avg_Parse_Time_Percentage,$Avg_Content_Time,$Avg_Content_Time_Percentage,");
print(HISTORY "$Avg_Frame_Time,$Avg_Frame_Time_Percentage,$Avg_Style_Time,$Avg_Style_Time_Percentage,$Avg_Reflow_Time,$Avg_Reflow_Time_Percentage,");
print(HISTORY "$Avg_TotalLayout_Time,$Avg_TotalLayout_Time_Percentage,$Avg_TotalPageLoad_Time\n");
close(HISTORY);

Просмотреть файл

@ -0,0 +1,164 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
#############################################
# User-defined variables
#
$machineStats = "WinNT 4.0 (sp5), 450 MHz, 128mg RAM";
#
#############################################
sub debug_print {
foreach $str (@_){
# print( $str );
}
}
@ARGV;
$buildIDFile = $ARGV[0];
$buildIDFile = '< '.$buildIDFile.'\bin\chrome\navigator\locale\en-US\navigator.dtd';
$pullDate = $ARGV[1];
open (XUL_FILE, $buildIDFile) or die "Unable to open BuildID file $buildIDFile (header.pl)";
$BuildNo = "";
$LineList;
while (<XUL_FILE>)
{
$ThisLine = $_;
chop ($ThisLine);
if (/Build ID/){
@LineList = split (/ /, $ThisLine);
$BuildNo = $LineList[3];
$BuildNo .= " ".$LineList[4];
$BuildNo .= " ".$LineList[5];
}
}
$BuildNo =~ s/"//g;
$BuildNo =~ s/[>]//g;
close (XUL_FILE);
debug_print ($BuildNo);
#############################################
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)=localtime;
%weekday= (
"1", "$day",
'2', 'Tuesday',
'3', 'Wednesday',
'4', 'Thursday',
'5', 'Friday',
'6', 'Saturday',
'7', 'Sunday',
);
$mon += 1;
$year += 1900;
open (TABLE_FILE, ">table.html");
print (TABLE_FILE "<center><b><font size=+2>Top 40 Sites - File Load Performance Metrics</font></b></center>");
print (TABLE_FILE "<center><b><font size=+2>Seamonkey Win32</font></B></Center>");
print (TABLE_FILE "<BR>");
print (TABLE_FILE "<center><font size=+2 color=maroon>$pullDate / $BuildNo </font></center>");
print (TABLE_FILE "<BR><center><b><font size=+1>");
print (TABLE_FILE "$weekday{$wday} ");
print (TABLE_FILE "$mon/$mday/$year ");
printf (TABLE_FILE "%02d:%02d:%02d", $hour, $min, $sec);
print (TABLE_FILE "</font></b></center>");
print (TABLE_FILE "<BR>");
print (TABLE_FILE "<B><CENTER><font size=-1>\n");
print (TABLE_FILE "$machineStats\n");
print (TABLE_FILE "<BR>");
print (TABLE_FILE "Time is reported in Seconds of CPU time");
print (TABLE_FILE "</font></CENTER></B>\n");
print (TABLE_FILE "<BR>\n\n");
print (TABLE_FILE "<table BORDER COLS=15 WIDTH='90%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<tr>");
print (TABLE_FILE "<td WIDTH='25%'></td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Parsing</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Content Creation</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Frame Creation</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Style Resolution</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Reflow</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Total Layout Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='2' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Total Page Load Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "</tr>");
print (TABLE_FILE "<tr>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Sites</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>%</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "<td COLSPAN='1' WIDTH='25%' BGCOLOR='#CCFFFF'>");
print (TABLE_FILE "<center><b>Time</b></center>");
print (TABLE_FILE "</td>");
print (TABLE_FILE "</tr>\n\n");
close (TABLE_FILE);

Просмотреть файл

@ -0,0 +1,56 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
@ARGV;
$milestone = $ARGV[0];
print ($milestone);
$bldRoot = $ARGV[1];
print("BuildRoot: $bldRoot\n");
$cnt = 0;
# Backup the history file
system( ("copy", "history.txt", "history.bak" ) );
# Run the Header script
system( ("perl", "header.pl", "$bldRoot", "$milestone" ) );
#
# now run the average2 script for each file in the logs directory
#
while( <Logs\\*.txt> ){
$line = $_;
$cnt++;
if ($line =~ /-log.txt/ ){
print( "File $cnt: $line\t" );
@nameParts = split( /-/, $line );
@nameNoDir = split( /\\/, $nameParts[0] );
print( "Name: $nameNoDir[1]\n" );
system( ("perl", "Averagetable2.pl", "$nameNoDir[1]", "$line", "$cnt", "$bldRoot", "$nameNoDir[1]" ) );
}
}
# Run the Footer script
system( ("perl", "footer.pl", "$bldRoot", "$milestone" ) );
print("Processed $cnt logs\n");

Просмотреть файл

@ -0,0 +1,447 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
#------------------------------------------------------------------------------
sub debug_print {
foreach $str (@_){
# print( $str );
}
}
#------------------------------------------------------------------------------
# Variables
#------------------------------------------------------------------------------
$Parse_Time_Max=0;
$Content_Time_Max=0;
$Frame_Time_Max=0;
$Style_Time_Max=0;
$Reflow_Time_Max=0;
$Layout_Time_Max=0;
$Total_Time_Max=0;
@RecordList;
@LineList;
#------------------------------------------------------------------------------
# Open the history file and begin by collecting the records into the data-arrays
# and set all of the max-values too
#------------------------------------------------------------------------------
$count=0;
open( HISTORY, "History.txt" ) or die "History file could not be opened\n";
while(<HISTORY>)
{
my $PullID;
my $BuildID;
# - Time variables
my $Parse_Time=0;
my $Content_Time=0;
my $Frame_Time=0;
my $Style_Time=0;
my $Reflow_Time=0;
my $Layout_Time=0;
my $Total_Time=0;
# - percentage variables
my $Parse_Per=0;
my $Content_Per=0;
my $Frame_Per=0;
my $Style_Per=0;
my $Reflow_Per=0;
my $Layout_Per=0;
$i=0;
$ThisLine = $_;
chop( $Thisline );
@LineList = split( /,/, $ThisLine );
# get each value into a variable
$PullID = $LineList[$i++];
$RecordList[$count++] = $PullID;
debug_print( "PullID : $PullID \n" );
$BuildID = $LineList[$i++];
$RecordList[$count++] = $BuildID;
debug_print( "BuildID : $BuildID \n" );
$Parse_Time = $LineList[$i++];
$RecordList[$count++] = $Parse_Time;
debug_print( "Parse_Time : $Parse_Time \n" );
$Parse_Per = $LineList[$i++];
$RecordList[$count++] = $Parse_Per;
debug_print( "Parse_Per : $Parse_Per \n" );
$Content_Time = $LineList[$i++];
$RecordList[$count++] = $Content_Time;
debug_print( "Content_Time : $Content_Time \n" );
$Content_Per = $LineList[$i++];
$RecordList[$count++] = $Content_Per;
debug_print( "Content_Per : $Content_Per \n" );
$Frame_Time = $LineList[$i++];
$RecordList[$count++] = $Frame_Time;
debug_print( "Frame_Time : $Frame_Time \n" );
$Frame_Per = $LineList[$i++];
$RecordList[$count++] = $Frame_Per;
debug_print( "Frame_Per : $Frame_Per \n" );
$Style_Time = $LineList[$i++];
$RecordList[$count++] = $Style_Time;
debug_print( "Style_Time : $Style_Time \n" );
$Style_Per = $LineList[$i++];
$RecordList[$count++] = $Style_Per;
debug_print( "Style_Per : $Style_Per \n" );
$Reflow_Time = $LineList[$i++];
$RecordList[$count++] = $Reflow_Time;
debug_print( "Reflow_Time : $Reflow_Time \n" );
$Reflow_Per = $LineList[$i++];
$RecordList[$count++] = $Reflow_Per;
debug_print( "Reflow_Per : $Reflow_Per \n" );
$Layout_Time = $LineList[$i++];
$RecordList[$count++] = $Layout_Time;
debug_print( "Layout_Time : $Layout_Time \n" );
$Layout_Per = $LineList[$i++];
$RecordList[$count++] = $Layout_Per;
debug_print( "Layout_Per : $Layout_Per \n" );
$Total_Time = $LineList[$i++];
$RecordList[$count++] = $Total_Time;
debug_print( "Total_Time : $Total_Time \n" );
# Now check for max values
if( $Parse_Time > $Parse_Time_Max ){
$Parse_Time_Max = $Parse_Time;
debug_print( "ParseTimeMax: .$Parse_Time_Max\n");
}
if( $Content_Time > $Content_Time_Max ){
$Content_Time_Max = $Content_Time;
debug_print( "Content_Time_Max: $Content_Time_Max\n");
}
if( $Frame_Time > $Frame_Time_Max ){
$Frame_Time_Max = $Frame_Time;
debug_print( "Frame_Time_Max: $Frame_Time_Max\n");
}
if( $Style_Time > $Style_Time_Max ){
$Style_Time_Max = $Style_Time;
debug_print( "Style_Time_Max: $Style_Time_Max\n");
}
if( $Reflow_Time > $Reflow_Time_Max ){
$Reflow_Time_Max = $Reflow_Time;
debug_print( "Reflow_Time_Max: $Reflow_Time_Max\n");
}
if( $Layout_Time > $Layout_Time_Max ){
$Layout_Time_Max = $Layout_Time;
debug_print( "Layout_Time_Max: $Layout_Time_Max\n");
}
if( $Total_Time > $Total_Time_Max ){
$Total_Time_Max = $Total_Time;
debug_print( "Total_Time_Max: $Total_Time_Max\n");
}
}
close(HISTORY);
for $foo (@RecordList){
# print( "FOO: $foo \n" );
}
ProcessHeader();
for($index=0; $index<($count/15); $index++)
{
my $start = 15*$index;
my $end = $start+15;
print( "Start: $start -> End: $end\n");
my @entry = @RecordList[$start..$end];
print( "Processing entry $index\n");
ProcessEntry( @entry );
}
ProcessFooter();
#------------------------------------------------------------------------------
#
sub ProcessHeader {
debug_print("ProcessHeader\n");
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)=localtime;
%weekday= (
"1", "$day",
'2', 'Tuesday',
'3', 'Wednesday',
'4', 'Thursday',
'5', 'Friday',
'6', 'Saturday',
'7', 'Sunday',
);
$mon += 1;
$year += 1900;
open(TRENDTABLE, "> TrendTable.html") or die "Cannot open trend-table file (TrendTable.html) in ProcessHeader\n";
print(TRENDTABLE "<!-- Generated by history.pl part of the Gecko PerfTools -->\n");
print(TRENDTABLE "<BODY>\n" );
print(TRENDTABLE "<H2 align=center><font color='maroon'>Performance History and Trending Table</font></H2><BR>\n" );
print (TRENDTABLE "<center><font size=-1>");
print (TRENDTABLE "$weekday{$wday} ");
print (TRENDTABLE "$mon/$mday/$year ");
printf (TRENDTABLE "%02d:%02d:%02d", $hour, $min, $sec);
print (TRENDTABLE "</font></center>");
print (TRENDTABLE "<BR>");
print(TRENDTABLE "<!-- First the headings (static) -->\n" );
print(TRENDTABLE "<TABLE BORDER=1 width=99% BGCOLOR='white'>\n" );
print(TRENDTABLE "<TR >\n" );
print(TRENDTABLE "<TD ROWSPAN=2 width=5% align=center valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Pull-ID</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=2 align=center width=5% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Build-ID</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Parsing</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Content Creation</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Frame Creation</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Style Resolution</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Reflow</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Total Layout</B>\n" );
print(TRENDTABLE "<TD ROWSPAN=1 align=center width=10% valign=top BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<B>Total Time</B>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "</TR>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=50%>Sec</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>%</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
print(TRENDTABLE "<TD>\n" );
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center BGCOLOR='#E0E0E0'>\n" );
print(TRENDTABLE "<TR><TD BGCOLOR='#FFFFC6' align=left width=100%>Sec</TD></TR></TABLE>\n" );
print(TRENDTABLE "</TD>\n" );
close(TRENDTABLE);
}
#------------------------------------------------------------------------------
#
sub ProcessEntry {
my $PullID;
my $BuildID;
# - Time variables
my $Parse_Time=0;
my $Content_Time=0;
my $Frame_Time=0;
my $Style_Time=0;
my $Reflow_Time=0;
my $Layout_Time=0;
my $Total_Time=0;
# - percentage variables
my $Parse_Per=0;
my $Content_Per=0;
my $Frame_Per=0;
my $Style_Per=0;
my $Reflow_Per=0;
my $Layout_Per=0;
# - weight variables
my $Parse_Weight=0;
my $Content_Weight=0;
my $Frame_Weight=0;
my $Style_Weight=0;
my $Reflow_Weight=0;
my $Layout_Weight=0;
my $Total_Weight=0;
debug_print( "Process Entry\n" );
my @EntryLine =@_;
open(TRENDTABLE, ">> TrendTable.html") or die "Cannot open trend-table file (TrendTable.html) in ProcessHeader\n";
$i=0;
$PullID = $EntryLine[$i++];
debug_print( "PullID: $PullID \n" );
$BuildID = $EntryLine[$i++];
debug_print( "BuildID: $BuildID \n" );
$Parse_Time = $EntryLine[$i++];
debug_print( "Parse_Time : $Parse_Time \n" );
$Parse_Per = $EntryLine[$i++];
debug_print( "Parse_Per : $Parse_Per \n" );
$Content_Time = $EntryLine[$i++];
debug_print( "Content_Time : $Content_Time \n" );
$Content_Per = $EntryLine[$i++];
debug_print( "Content_Per : $Content_Per \n" );
$Frame_Time = $EntryLine[$i++];
debug_print( "Frame_Time : $Frame_Time \n" );
$Frame_Per = $EntryLine[$i++];
debug_print( "Frame_Per : $Frame_Per \n" );
$Style_Time = $EntryLine[$i++];
debug_print( "Style_Time : $Style_Time \n" );
$Style_Per = $EntryLine[$i++];
debug_print( "Style_Per : $Style_Per \n" );
$Reflow_Time = $EntryLine[$i++];
debug_print( "Reflow_Time : $Reflow_Time \n" );
$Reflow_Per = $EntryLine[$i++];
debug_print( "Reflow_Per : $Reflow_Per \n" );
$Layout_Time = $EntryLine[$i++];
debug_print( "Layout_Time : $Layout_Time \n" );
$Layout_Per = $EntryLine[$i++];
debug_print( "Layout_Per : $Layout_Per \n" );
$Total_Time = $EntryLine[$i++];
debug_print( "Total_Time : $Total_Time \n" );
if( $Parse_Time_Max > 0 ){
$ParseWeight = $Parse_Time / $Parse_Time_Max * 100;
debug_print( "ParseWeight = $ParseWeight \n" );
}
if( $Content_Time_Max > 0 ){
$ContentWeight = $Content_Time / $Content_Time_Max * 100;
debug_print( "ContentWeight = $ContentWeight \n" );
}
if( $Frame_Time_Max > 0 ){
$FrameWeight = $Frame_Time / $Frame_Time_Max * 100;
debug_print( "FrameWeight = $FrameWeight \n" );
}
if( $Style_Time_Max > 0 ){
$StyleWeight = $Style_Time / $Style_Time_Max * 100;
debug_print( "StyleWeight = $StyleWeight \n" );
}
if( $Reflow_Time_Max > 0 ){
$ReflowWeight = $Reflow_Time / $Reflow_Time_Max * 100;
debug_print( "ReflowWeight = $ReflowWeight \n" );
}
if( $Layout_Time_Max > 0 ){
$LayoutWeight = $Layout_Time / $Layout_Time_Max * 100;
debug_print( "LayoutWeight = $LayoutWeight \n" );
}
if( $Total_Time_Max > 0 ){
$TotalWeight = $Total_Time / $Total_Time_Max * 100;
debug_print( "TotalWeight = $TotalWeight \n" );
}
$bldID;
@bldIDParts = split( /:/, $BuildID );
$bldID = $bldIDParts[1];
print(TRENDTABLE "<!-- Next entry... -->\n");
print(TRENDTABLE "<TR> \n");
print(TRENDTABLE "<TD ROWSPAN=1>$PullID</TD>\n");
print(TRENDTABLE "<TD ROWSPAN=1>$bldID</TD>\n");
print(TRENDTABLE "<!-- Parse Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f", $Parse_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>");
printf(TRENDTABLE "%4.3f",$Parse_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$ParseWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $ParseWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Content Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f",$Content_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>");
printf(TRENDTABLE "%4.3f",$Content_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$ContentWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $ContentWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Frames Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f",$Frame_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%> ");
printf(TRENDTABLE "%4.3f",$Frame_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$FrameWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $FrameWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Style Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f",$Style_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>");
printf(TRENDTABLE "%4.3f",$Style_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$StyleWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $StyleWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Reflow Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f",$Reflow_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>");
printf(TRENDTABLE "%4.3f",$Reflow_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$ReflowWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $ReflowWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Layout Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=50%>");
printf(TRENDTABLE "%4.3f",$Layout_Time);
print(TRENDTABLE "</TD><TD BGCOLOR='#CFEEF7' align=right width=50%>");
printf(TRENDTABLE "%4.3f",$Layout_Per);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$LayoutWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $LayoutWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "<!-- Parse Time -->\n");
print(TRENDTABLE "<TD>\n");
print(TRENDTABLE "<TABLE BORDER=0 width=100% align=center COLS=2><TR><TD BGCOLOR='#FFFFC6' align=left width=100%>");
printf(TRENDTABLE "%4.3f",$Total_Time);
print(TRENDTABLE "</TD></TR><TR><TD colspan=2><table WIDTH=$TotalWeight% bgcolor=blue><tr><td><font align=center size=-2>&nbsp;");
print(TRENDTABLE "</td></font></tr></table></TD></TR></TABLE>");
printf(TRENDTABLE "<font size=-1>%4.2f % </font>", $TotalWeight);
print(TRENDTABLE "</TD>\n");
print(TRENDTABLE "</TR>\n");
close(TRENDTABLE);
}
#------------------------------------------------------------------------------
#
sub ProcessFooter {
debug_print("ProcessHeader\n");
open(TRENDTABLE, ">> TrendTable.html") or die "Cannot open trend-table file (TrendTable.html) in ProcessFooter\n";
print(TRENDTABLE "</TABLE>\n");
print(TRENDTABLE "</BODY>\n");
close(TRENDTABLE);
}

Просмотреть файл

@ -0,0 +1,86 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
# 1) Load Mozilla with an argument indicating where to find the URLs to cycle through
# 2) Uncombine the logfile into a log for each site
# 3) Run the script genfromlogs.pl to process the logs and generate the chart
# 4) Rename the chart to the ID provided
# 5) Run the script history.pl to generate the history chart
# 6) Move the files to a directory just for them...
# Get and check the arguments
@ARGV;
$ID = $ARGV[0];
$bldRoot = $ARGV[1];
$profID = $ARGV[2];
$arg=0;
$cmdLineArg[$arg++] = "-f ";
$cmdLineArg[$arg++] = "S:\\mozilla\\tools\\performance\\layout\\40-url.txt ";
#$cmdLineArg[$arg++] = "-ftimeout ";
#$cmdLineArg[$arg++] = "15 ";
#$cmdLineArg[$arg++] = "-P ";
#$cmdLineArg[$arg++] = "$profID ";
if(!$ID || !$bldRoot || !$profID){
die "ID, Build Root and Profile Name must be provided. \n - Example: 'perl perf.pl Daily_021400 s:\\moz\\daily\\0214 Attinasi' \n";
}
# build up a full path and argument strings for the invocation
$mozPath;
$logName;
#$mozPath=$bldRoot."\\bin\\Mozilla.exe";
$mozPath=$bldRoot."\\bin\\Viewer.exe";
$logName="Logs\\".$ID."-combined.dat";
-e $mozPath or die "$mozPath could not be found\n";
# run it
$commandLine = $mozPath." ".$cmdLineArg[0].$cmdLineArg[1].$cmdLineArg[2].$cmdLineArg[3].$cmdLineArg[4].$cmdLineArg[5]."> $logName";
print("Running $commandLine\n");
system ("$commandLine") == 0 or die "Cannot invoke Mozilla\n";
# uncombine the output file
print("Breaking result into log files...\n");
system( ("perl", "uncombine.pl", "$logName") ) == 0 or die "Error uncombining the output\n";
# generate the chart from the logs
print("Generating performance table...\n");
system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot") ) == 0 or die "Error generating the chart from the logs\n";
# rename the output
system( ("copy", "table.html", "Tables\\$ID\.html") ) == 0 or die "Error copying table.html to Tables\\$ID\.html\n";
# run the history script
print("Generating history table...\n");
system( ("perl", "history.pl") ) == 0 or die "Could not execute the history.pl script\n";
# rename the output
system( ("copy", "TrendTable.html", "Tables\\$ID-TrendTable.html") ) == 0 or die "could not copy TrendTable.html to Tables\\$ID-TrendTable.html\n";
# save off the files
system( ("mkdir", "Logs\\$ID") );
system( ("copy", "Logs\\*.*", "Logs\\$ID\\*.*") ) == 0 or die "Cannot copy logfiles to Logs\\$ID\\*.*\n";
system( ("copy", "history.txt", "Logs\\$ID_history.txt") ) == 0 or die "Cannot copy $ID_history.txt to Logs\n";
print("perf.pl DONE!\n");

Просмотреть файл

@ -0,0 +1,127 @@
##########################################################################################
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): 2/10/00 attinasi
#
##########################################################################################
#
# uncombine.pl : Break up the combined performance run output file into a file per URL
#
# When viewer or mozilla are run and provided a command line argument of '-f urlfile.txt'
# then the file 'urlfile.txt' is read and each line is expected to be a URL. The browser
# then cycles through each url and loads it, waiting for the load to end or a safety
# timeout to occur. In eaiter case the next url is loaded until there are no more and then
# the browser exits. The output from the run (stdout) is captured to a file which then
# contains all of the performance output we need to build charts of performance numbers
# (see average2.pl, along with header.pl and footer.pl).
#
# ASSUMES file urls are pathed as: file:///S|/Mozilla/Tools/ProfTools/WebSites/URL/FILE
# or if an http URL: http://URL/FILE
# Normally it is expected that local files will be used, however if we should use http
# URLs they can be processed (have not tested to date...)
#
# For file urls, the websites tree is assumed to be the one committed to cvs. Installed
# files will be at s:\mozilla\tools\perftools\websites\url\file
# If you have the files in a different location, adjust the part that extracts the url
# (most likely the index into the tokens will change. Search for SENSITIVE in teh script)
#
##########################################################################################
@ARGV;
$dir="Logs\\";
$i=0;
$TimingBlockBegun=0;
$fileURL=0;
$httpURL=0;
$shellID;
$infileName = $ARGV[0];
open(COMBINEFILE, "< $infileName") or die "Unable to open $infileName\n";
while(<COMBINEFILE>){
$url;
@tokens = split( / /, $_ );
if($TimingBlockBegun == 0) {
# look for the start of a new block
if($_ =~ /Timing layout processes on url/){
#print( "Timing begin candidate: $_ \n" );
# see if it is a file or http url.
# If so, we are starting, otherwise it is probably a chrome url so ignore it
if( $_ =~ /url: \'file:/ ){
#printf( " - file URL\n" );
$url = $tokens[6];
$TimingBlockBegun=1;
$httpURL=0;
$fileURL=1;
}
if( $_ =~ /url: \'http:/ ){
#printf( "http URL\n" );
$url = $tokens[6]; ### SENSITIVE to installation path
$TimingBlockBegun=1;
$fileURL=0;
$httpURL=1;
}
# if we got a valid block then extract the WebShellID
# for matching the end-of-block later
if($TimingBlockBegun > 0){
chop($url);
$shellID = $tokens[8];
chop( $shellID );
#print( " - WebShellID: $shellID\n");
@urlParts = split(/\//, $url);
if($fileURL > 0){
$urlName = $urlParts[8]; ### SENSITIVE to installation path
### eg. 'file:///S|/Mozilla/Tools/PerfTools/WebSites/amazon/index.html'
} else {
$urlName = $urlParts[2]; ### http://all.of.this.is.the.url.name/index.html
}
open(URLFILE, ">$dir$urlName-log"."\.txt") or die "cannot open file $dir$urlName\n";
print("Breaking out url $url into "."$dir$urlName-log"."\.txt"."\n");
}
}
}
if($TimingBlockBegun > 0){
$done=0;
$keepLine=1;
# Look for end of block:
# - Find the line with the "Layout + Page Load" in it...
if( $_ =~ /Layout \+ Page Load/ ){
# Match the WebShell ID - if it is a match then our block ended,
# otherwise it is the end of another block within our block
$webshellID = "\(webshell=".$shellID."\)";
if( $tokens[6] =~ /$webshellID/ ){
#print( "- WebShellID MATCH: $webshellID $tokens[6]\n" );
$done=1;
} else {
$keepLine=0;
}
}
if($keepLine == 1){
# write the line to the file
print(URLFILE $_);
}
if($done == 1){
$TimingBlockBegun=0;
close(URLFILE);
}
}
$i++;
}