|
1 ########################################################################################## |
|
2 # |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 # 1) Load Mozilla with an argument indicating where to find the URLs to cycle through |
|
8 # 2) Uncombine the logfile into a log for each site |
|
9 # 3) Run the script genfromlogs.pl to process the logs and generate the chart |
|
10 # 4) Rename the chart to the ID provided |
|
11 # 5) Run the script history.pl to generate the history chart |
|
12 # 6) Move the files to a directory just for them... |
|
13 |
|
14 $UseViewer = 1; # set to 0 to use Mozilla |
|
15 $UseClockTime=0; # if third argument is 'clock' this gets set to 1 |
|
16 |
|
17 # Get and check the arguments |
|
18 @ARGV; |
|
19 $ID = $ARGV[0]; |
|
20 $bldRoot = $ARGV[1]; |
|
21 $clockTimeArg = $ARGV[2]; |
|
22 $profID = $ARGV[3]; |
|
23 $arg=0; |
|
24 $cmdLineArg[$arg++] = "-f "; |
|
25 ##$cmdLineArg[$arg++] = "S:\\mozilla\\tools\\performance\\layout\\40-url-dup.txt "; |
|
26 $cmdLineArg[$arg++] = "D:\\mozilla\\tools\\performance\\layout\\40-url.txt "; |
|
27 if($UseViewer==0){ |
|
28 $cmdLineArg[$arg++] = "-ftimeout "; |
|
29 $cmdLineArg[$arg++] = "10 "; |
|
30 $cmdLineArg[$arg++] = "-P "; |
|
31 $cmdLineArg[$arg++] = "$profID "; |
|
32 } |
|
33 |
|
34 if($UseViewer==0){ |
|
35 if(!$ID || !$bldRoot || !$profID || !$clockTimeArg){ |
|
36 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"; |
|
37 } |
|
38 } else { |
|
39 if(!$ID || !$bldRoot || !$clockTimeArg){ |
|
40 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"; |
|
41 } |
|
42 } |
|
43 |
|
44 # build up a full path and argument strings for the invocation |
|
45 $mozPath; |
|
46 $logName; |
|
47 if($UseViewer==0){ |
|
48 $mozPath=$bldRoot."\\bin\\Mozilla.exe"; |
|
49 } else { |
|
50 $mozPath=$bldRoot."\\bin\\Viewer.exe"; |
|
51 } |
|
52 $logName="Logs\\".$ID."-combined.dat"; |
|
53 |
|
54 -e $mozPath or die "$mozPath could not be found\n"; |
|
55 |
|
56 if($clockTimeArg eq "clock"){ |
|
57 $UseClockTime=1; |
|
58 print( "Charting Clock time...\n"); |
|
59 die "Clock Time Does Not Yet Work! <sorry>"; |
|
60 } else { |
|
61 print( "Charting CPU time...\n"); |
|
62 } |
|
63 |
|
64 # run it |
|
65 $commandLine = $mozPath." ".$cmdLineArg[0].$cmdLineArg[1].$cmdLineArg[2].$cmdLineArg[3].$cmdLineArg[4].$cmdLineArg[5]."> $logName"; |
|
66 print("Running $commandLine\n"); |
|
67 system ("$commandLine") == 0 or die "Cannot invoke Mozilla\n"; |
|
68 |
|
69 # uncombine the output file |
|
70 print("Breaking result into log files...\n"); |
|
71 system( ("perl", "uncombine.pl", "$logName") ) == 0 or die "Error uncombining the output\n"; |
|
72 |
|
73 # generate the chart from the logs |
|
74 if($UseClockTime==1){ |
|
75 print("Generating performance table... (ClockTime)\n"); |
|
76 system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot", "clock") ) == 0 or die "Error generating the clock-time chart from the logs\n"; |
|
77 } else { |
|
78 print("Generating performance table...(CPUTime)\n"); |
|
79 system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot") ) == 0 or die "Error generating the cpu-time chart from the logs\n"; |
|
80 } |
|
81 |
|
82 # rename the output |
|
83 system( ("copy", "table.html", "Tables\\$ID\.html") ) == 0 or die "Error copying table.html to Tables\\$ID\.html\n"; |
|
84 |
|
85 # run the history script |
|
86 print("Generating history table...\n"); |
|
87 system( ("perl", "history.pl") ) == 0 or die "Could not execute the history.pl script\n"; |
|
88 |
|
89 # rename the output |
|
90 system( ("copy", "TrendTable.html", "Tables\\$ID-TrendTable.html") ) == 0 or die "could not copy TrendTable.html to Tables\\$ID-TrendTable.html\n"; |
|
91 |
|
92 # save off the files |
|
93 system( ("mkdir", "Logs\\$ID") ); |
|
94 system( ("copy", "Logs\\*.*", "Logs\\$ID\\*.*") ) == 0 or die "Cannot copy logfiles to Logs\\$ID\\*.*\n"; |
|
95 system( ("copy", "history.txt", "Logs\\$ID-history.txt") ) == 0 or die "Cannot copy $ID_history.txt to Logs\n"; |
|
96 |
|
97 print("perf.pl DONE!\n"); |