tools/performance/layout/perf.pl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/performance/layout/perf.pl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +##########################################################################################
     1.5 +#
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +# 1) Load Mozilla with an argument indicating where to find the URLs to cycle through
    1.11 +# 2) Uncombine the logfile into a log for each site
    1.12 +# 3) Run the script genfromlogs.pl to process the logs and generate the chart
    1.13 +# 4) Rename the chart to the ID provided
    1.14 +# 5) Run the script history.pl to generate the history chart
    1.15 +# 6) Move the files to a directory just for them...
    1.16 +
    1.17 +$UseViewer = 1;    # set to 0 to use Mozilla
    1.18 +$UseClockTime=0;   # if third argument is 'clock' this gets set to 1
    1.19 +
    1.20 +# Get and check the arguments
    1.21 +@ARGV;
    1.22 +$ID = $ARGV[0];
    1.23 +$bldRoot = $ARGV[1];
    1.24 +$clockTimeArg = $ARGV[2];
    1.25 +$profID = $ARGV[3];
    1.26 +$arg=0;
    1.27 +$cmdLineArg[$arg++] = "-f ";
    1.28 +##$cmdLineArg[$arg++] = "S:\\mozilla\\tools\\performance\\layout\\40-url-dup.txt ";
    1.29 +$cmdLineArg[$arg++] = "D:\\mozilla\\tools\\performance\\layout\\40-url.txt ";
    1.30 +if($UseViewer==0){
    1.31 +  $cmdLineArg[$arg++] = "-ftimeout ";
    1.32 +  $cmdLineArg[$arg++] = "10 ";
    1.33 +  $cmdLineArg[$arg++] = "-P ";
    1.34 +  $cmdLineArg[$arg++] = "$profID ";
    1.35 +}
    1.36 +
    1.37 +if($UseViewer==0){
    1.38 +  if(!$ID || !$bldRoot || !$profID || !$clockTimeArg){
    1.39 +    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";
    1.40 +  }
    1.41 +} else {
    1.42 +  if(!$ID || !$bldRoot || !$clockTimeArg){
    1.43 +    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";
    1.44 +  }
    1.45 +}
    1.46 +
    1.47 +# build up a full path and argument strings for the invocation
    1.48 +$mozPath;
    1.49 +$logName;
    1.50 +if($UseViewer==0){
    1.51 +  $mozPath=$bldRoot."\\bin\\Mozilla.exe";
    1.52 +} else {
    1.53 +  $mozPath=$bldRoot."\\bin\\Viewer.exe";
    1.54 +}
    1.55 +$logName="Logs\\".$ID."-combined.dat";
    1.56 +
    1.57 +-e $mozPath or die "$mozPath could not be found\n";
    1.58 +
    1.59 +if($clockTimeArg eq "clock"){
    1.60 +  $UseClockTime=1;
    1.61 +  print( "Charting Clock time...\n");
    1.62 +  die "Clock Time Does Not Yet Work! <sorry>";
    1.63 +} else {
    1.64 +  print( "Charting CPU time...\n");
    1.65 +}
    1.66 +
    1.67 +# run it
    1.68 +$commandLine = $mozPath." ".$cmdLineArg[0].$cmdLineArg[1].$cmdLineArg[2].$cmdLineArg[3].$cmdLineArg[4].$cmdLineArg[5]."> $logName";
    1.69 +print("Running $commandLine\n");
    1.70 +system ("$commandLine") == 0 or die "Cannot invoke Mozilla\n";
    1.71 +
    1.72 +# uncombine the output file
    1.73 +print("Breaking result into log files...\n");
    1.74 +system( ("perl", "uncombine.pl", "$logName") ) == 0 or die "Error uncombining the output\n";
    1.75 +
    1.76 +# generate the chart from the logs
    1.77 +if($UseClockTime==1){
    1.78 +  print("Generating performance table... (ClockTime)\n");
    1.79 +  system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot", "clock") ) == 0 or die "Error generating the clock-time chart from the logs\n";
    1.80 +} else {
    1.81 +  print("Generating performance table...(CPUTime)\n");
    1.82 +  system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot") ) == 0 or die "Error generating the cpu-time chart from the logs\n";
    1.83 +}
    1.84 +
    1.85 +# rename the output
    1.86 +system( ("copy", "table.html", "Tables\\$ID\.html") ) == 0 or die "Error copying table.html to Tables\\$ID\.html\n";
    1.87 +
    1.88 +# run the history script
    1.89 +print("Generating history table...\n");
    1.90 +system( ("perl", "history.pl") ) == 0 or die "Could not execute the history.pl script\n";
    1.91 +
    1.92 +# rename the output
    1.93 +system( ("copy", "TrendTable.html", "Tables\\$ID-TrendTable.html") ) == 0 or die "could not copy TrendTable.html to Tables\\$ID-TrendTable.html\n";
    1.94 +
    1.95 +# save off the files
    1.96 +system( ("mkdir", "Logs\\$ID") );
    1.97 +system( ("copy", "Logs\\*.*", "Logs\\$ID\\*.*") ) == 0 or die "Cannot copy logfiles to Logs\\$ID\\*.*\n";
    1.98 +system( ("copy", "history.txt", "Logs\\$ID-history.txt") ) == 0 or die "Cannot copy $ID_history.txt to Logs\n";
    1.99 +
   1.100 +print("perf.pl DONE!\n");

mercurial