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
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.
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 # 1) Load Mozilla with an argument indicating where to find the URLs to cycle through
41 # 2) Uncombine the logfile into a log for each site
42 # 3) Run the script genfromlogs.pl to process the logs and generate the chart
43 # 4) Rename the chart to the ID provided
44 # 5) Run the script history.pl to generate the history chart
45 # 6) Move the files to a directory just for them...
47 $UseViewer = 1; # set to 0 to use Mozilla
48 $UseClockTime=0; # if third argument is 'clock' this gets set to 1
50 # Get and check the arguments
54 $clockTimeArg = $ARGV[2];
57 $cmdLineArg[$arg++] = "-f ";
58 ##$cmdLineArg[$arg++] = "S:\\mozilla\\tools\\performance\\layout\\40-url-dup.txt ";
59 $cmdLineArg[$arg++] = "D:\\mozilla\\tools\\performance\\layout\\40-url.txt ";
61 $cmdLineArg[$arg++] = "-ftimeout ";
62 $cmdLineArg[$arg++] = "10 ";
63 $cmdLineArg[$arg++] = "-P ";
64 $cmdLineArg[$arg++] = "$profID ";
68 if(!$ID || !$bldRoot || !$profID || !$clockTimeArg){
69 die "ID, Build Root, Profile Name, and clock OR CPU must be provided. \n - Example: 'perl perf.pl Daily_021400 s:\\moz\\daily\\0214 clock|cpu Attinasi' \n";
72 if(!$ID || !$bldRoot || !$clockTimeArg){
73 die "ID, Build Root, and clock OR CPU must be provided. \n - Example: 'perl perf.pl Daily_021400 s:\\moz\\daily\\0214 clock|CPU' \n";
77 # build up a full path and argument strings for the invocation
81 $mozPath=$bldRoot."\\bin\\Mozilla.exe";
83 $mozPath=$bldRoot."\\bin\\Viewer.exe";
85 $logName="Logs\\".$ID."-combined.dat";
87 -e
$mozPath or die "$mozPath could not be found\n";
89 if($clockTimeArg eq "clock"){
91 print( "Charting Clock time...\n");
92 die "Clock Time Does Not Yet Work! <sorry>";
94 print( "Charting CPU time...\n");
98 $commandLine = $mozPath." ".$cmdLineArg[0].$cmdLineArg[1].$cmdLineArg[2].$cmdLineArg[3].$cmdLineArg[4].$cmdLineArg[5]."> $logName";
99 print("Running $commandLine\n");
100 system ("$commandLine") == 0 or die "Cannot invoke Mozilla\n";
102 # uncombine the output file
103 print("Breaking result into log files...\n");
104 system( ("perl", "uncombine.pl", "$logName") ) == 0 or die "Error uncombining the output\n";
106 # generate the chart from the logs
107 if($UseClockTime==1){
108 print("Generating performance table... (ClockTime)\n");
109 system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot", "clock") ) == 0 or die "Error generating the clock-time chart from the logs\n";
111 print("Generating performance table...(CPUTime)\n");
112 system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot") ) == 0 or die "Error generating the cpu-time chart from the logs\n";
116 system( ("copy", "table.html", "Tables\\$ID\.html") ) == 0 or die "Error copying table.html to Tables\\$ID\.html\n";
118 # run the history script
119 print("Generating history table...\n");
120 system( ("perl", "history.pl") ) == 0 or die "Could not execute the history.pl script\n";
123 system( ("copy", "TrendTable.html", "Tables\\$ID-TrendTable.html") ) == 0 or die "could not copy TrendTable.html to Tables\\$ID-TrendTable.html\n";
126 system( ("mkdir", "Logs\\$ID") );
127 system( ("copy", "Logs\\*.*", "Logs\\$ID\\*.*") ) == 0 or die "Cannot copy logfiles to Logs\\$ID\\*.*\n";
128 system( ("copy", "history.txt", "Logs\\$ID-history.txt") ) == 0 or die "Cannot copy $ID_history.txt to Logs\n";
130 print("perf.pl DONE!\n");