Bug 458256. Use LoadLibraryW instead of LoadLibrary (patch by DougT). r+sr=vlad
[wine-gecko.git] / tools / performance / layout / uncombine.pl
blob4938d8acf6e3396e3c2597e3ba0f851f317435da
1 ##########################################################################################
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1998
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
24 # 2/10/00 attinasi
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 # uncombine.pl : Break up the combined performance run output file into a file per URL
42 # When viewer or mozilla are run and provided a command line argument of '-f urlfile.txt'
43 # then the file 'urlfile.txt' is read and each line is expected to be a URL. The browser
44 # then cycles through each url and loads it, waiting for the load to end or a safety
45 # timeout to occur. In eaiter case the next url is loaded until there are no more and then
46 # the browser exits. The output from the run (stdout) is captured to a file which then
47 # contains all of the performance output we need to build charts of performance numbers
48 # (see average2.pl, along with header.pl and footer.pl).
50 # ASSUMES file urls are pathed as: file:///S|/Mozilla/Tools/ProfTools/WebSites/URL/FILE
51 # or if an http URL: http://URL/FILE
52 # Normally it is expected that local files will be used, however if we should use http
53 # URLs they can be processed (have not tested to date...)
55 # For file urls, the websites tree is assumed to be the one committed to cvs. Installed
56 # files will be at s:\mozilla\tools\perftools\websites\url\file
57 # If you have the files in a different location, adjust the part that extracts the url
58 # (most likely the index into the tokens will change. Search for SENSITIVE in the script)
60 #------------------------------------------------------------------------------
61 sub debug_print {
62 foreach $str (@_){
63 # print( $str );
66 #------------------------------------------------------------------------------
69 @ARGV;
70 $dir="Logs\\";
71 $i=0;
72 $TimingBlockBegun=0;
73 $fileURL=0;
74 $httpURL=0;
75 $shellID;
76 $infileName = $ARGV[0];
77 $supportHTTP = 0; # set to 1 if HTTP URLs are to be supported
79 open(COMBINEFILE, "< $infileName") or die "Unable to open $infileName\n";
80 while(<COMBINEFILE>){
81 $url;
82 @tokens = split( / /, $_ );
84 if($TimingBlockBegun == 0) {
85 # look for the start of a new block
86 if($_ =~ /Timing layout processes on url/){
87 debug_print( "Timing begin candidate: $_ \n" );
89 # see if it is a file or http url.
90 # If so, we are starting, otherwise it is probably a chrome url so ignore it
91 if( $_ =~ /url: \'file:/ ){
92 debug_print( " - file URL\n" );
93 $url = $tokens[6];
94 $TimingBlockBegun=1;
95 $httpURL=0;
96 $fileURL=1;
98 if($supportHTTP > 0) {
99 if( $_ =~ /url: \'http:/ ){
100 debug_print( "http URL\n" );
101 $url = $tokens[6]; ### SENSITIVE to installation path
102 $TimingBlockBegun=1;
103 $fileURL=0;
104 $httpURL=1;
108 # if we got a valid block then extract the WebShellID
109 # for matching the end-of-block later
110 if($TimingBlockBegun > 0){
111 chop($url);
112 $shellID = $tokens[8];
113 chop( $shellID );
114 debug_print( " - WebShellID: $shellID\n");
115 @urlParts = split(/\//, $url);
116 if($fileURL > 0){
117 $urlName = $urlParts[9]; ### SENSITIVE to installation path
118 ### eg. 'file:///S|/Mozilla/Tools/performance/layout/WebSites/amazon/index.html'
119 } else {
120 $urlName = $urlParts[2]; ### http://all.of.this.is.the.url.name/index.html
122 open(URLFILE, ">$dir$urlName-log"."\.txt") or die "cannot open file $dir$urlName\n";
123 print("Breaking out url $url into "."$dir$urlName-log"."\.txt"."\n");
128 if($TimingBlockBegun > 0){
129 $done=0;
130 $keepLine=1;
131 # Look for end of block:
132 # - Find the line with the "Layout + Page Load" in it...
133 if( $_ =~ /Layout \+ Page Load/ ){
134 # Match the WebShell ID - if it is a match then our block ended,
135 # otherwise it is the end of another block within our block
136 $webshellID = "\(webBrowserChrome=".$shellID."\)";
137 if( $tokens[6] =~ /$webshellID/ ){
138 debug_print( "- WebShellID MATCH: $webshellID $tokens[6]\n" );
139 $done=1;
140 } else {
141 $keepLine=0;
144 if($keepLine == 1){
145 # write the line to the file
146 print(URLFILE $_);
148 if($done == 1){
149 $TimingBlockBegun=0;
150 close(URLFILE);
153 $i++;