2000-02-18 04:42:56 +03:00
|
|
|
##########################################################################################
|
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-02-18 04:42:56 +03:00
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# The contents of this file are subject to the Mozilla 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/MPL/
|
|
|
|
#
|
|
|
|
# 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.
|
2000-02-18 04:42:56 +03:00
|
|
|
#
|
|
|
|
# The Original Code is mozilla.org code.
|
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Netscape Communications Corporation.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
2000-02-18 04:42:56 +03:00
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# Contributor(s):
|
|
|
|
# 2/10/00 attinasi
|
2000-02-18 04:42:56 +03:00
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
2000-02-18 04:42:56 +03:00
|
|
|
#
|
2004-04-26 01:07:34 +04:00
|
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
|
2000-02-18 04:42:56 +03:00
|
|
|
# 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
|
2005-11-26 00:57:13 +03:00
|
|
|
# (most likely the index into the tokens will change. Search for SENSITIVE in the script)
|
2000-05-12 01:15:43 +04:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
sub debug_print {
|
|
|
|
foreach $str (@_){
|
|
|
|
# print( $str );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2000-02-18 04:42:56 +03:00
|
|
|
@ARGV;
|
|
|
|
$dir="Logs\\";
|
|
|
|
$i=0;
|
|
|
|
$TimingBlockBegun=0;
|
|
|
|
$fileURL=0;
|
|
|
|
$httpURL=0;
|
|
|
|
$shellID;
|
|
|
|
$infileName = $ARGV[0];
|
2000-05-12 01:15:43 +04:00
|
|
|
$supportHTTP = 0; # set to 1 if HTTP URLs are to be supported
|
2000-02-18 04:42:56 +03:00
|
|
|
|
|
|
|
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/){
|
2000-05-12 01:15:43 +04:00
|
|
|
debug_print( "Timing begin candidate: $_ \n" );
|
2000-02-18 04:42:56 +03:00
|
|
|
|
|
|
|
# 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:/ ){
|
2000-05-12 01:15:43 +04:00
|
|
|
debug_print( " - file URL\n" );
|
2000-02-18 04:42:56 +03:00
|
|
|
$url = $tokens[6];
|
|
|
|
$TimingBlockBegun=1;
|
|
|
|
$httpURL=0;
|
|
|
|
$fileURL=1;
|
|
|
|
}
|
2000-05-12 01:15:43 +04:00
|
|
|
if($supportHTTP > 0) {
|
|
|
|
if( $_ =~ /url: \'http:/ ){
|
|
|
|
debug_print( "http URL\n" );
|
|
|
|
$url = $tokens[6]; ### SENSITIVE to installation path
|
|
|
|
$TimingBlockBegun=1;
|
|
|
|
$fileURL=0;
|
|
|
|
$httpURL=1;
|
|
|
|
}
|
|
|
|
}
|
2000-02-18 04:42:56 +03:00
|
|
|
|
|
|
|
# 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 );
|
2000-05-12 01:15:43 +04:00
|
|
|
debug_print( " - WebShellID: $shellID\n");
|
2000-02-18 04:42:56 +03:00
|
|
|
@urlParts = split(/\//, $url);
|
|
|
|
if($fileURL > 0){
|
2000-02-23 20:58:22 +03:00
|
|
|
$urlName = $urlParts[9]; ### SENSITIVE to installation path
|
|
|
|
### eg. 'file:///S|/Mozilla/Tools/performance/layout/WebSites/amazon/index.html'
|
2000-02-18 04:42:56 +03:00
|
|
|
} 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
|
2000-05-12 01:15:43 +04:00
|
|
|
$webshellID = "\(webBrowserChrome=".$shellID."\)";
|
2000-02-18 04:42:56 +03:00
|
|
|
if( $tokens[6] =~ /$webshellID/ ){
|
2000-05-12 01:15:43 +04:00
|
|
|
debug_print( "- WebShellID MATCH: $webshellID $tokens[6]\n" );
|
2000-02-18 04:42:56 +03:00
|
|
|
$done=1;
|
|
|
|
} else {
|
|
|
|
$keepLine=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($keepLine == 1){
|
|
|
|
# write the line to the file
|
|
|
|
print(URLFILE $_);
|
|
|
|
}
|
|
|
|
if($done == 1){
|
|
|
|
$TimingBlockBegun=0;
|
|
|
|
close(URLFILE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|