tools/performance/layout/perf.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial