michael@0: ########################################################################################## michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # 1) Load Mozilla with an argument indicating where to find the URLs to cycle through michael@0: # 2) Uncombine the logfile into a log for each site michael@0: # 3) Run the script genfromlogs.pl to process the logs and generate the chart michael@0: # 4) Rename the chart to the ID provided michael@0: # 5) Run the script history.pl to generate the history chart michael@0: # 6) Move the files to a directory just for them... michael@0: michael@0: $UseViewer = 1; # set to 0 to use Mozilla michael@0: $UseClockTime=0; # if third argument is 'clock' this gets set to 1 michael@0: michael@0: # Get and check the arguments michael@0: @ARGV; michael@0: $ID = $ARGV[0]; michael@0: $bldRoot = $ARGV[1]; michael@0: $clockTimeArg = $ARGV[2]; michael@0: $profID = $ARGV[3]; michael@0: $arg=0; michael@0: $cmdLineArg[$arg++] = "-f "; michael@0: ##$cmdLineArg[$arg++] = "S:\\mozilla\\tools\\performance\\layout\\40-url-dup.txt "; michael@0: $cmdLineArg[$arg++] = "D:\\mozilla\\tools\\performance\\layout\\40-url.txt "; michael@0: if($UseViewer==0){ michael@0: $cmdLineArg[$arg++] = "-ftimeout "; michael@0: $cmdLineArg[$arg++] = "10 "; michael@0: $cmdLineArg[$arg++] = "-P "; michael@0: $cmdLineArg[$arg++] = "$profID "; michael@0: } michael@0: michael@0: if($UseViewer==0){ michael@0: if(!$ID || !$bldRoot || !$profID || !$clockTimeArg){ michael@0: 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: } michael@0: } else { michael@0: if(!$ID || !$bldRoot || !$clockTimeArg){ michael@0: 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: } michael@0: } michael@0: michael@0: # build up a full path and argument strings for the invocation michael@0: $mozPath; michael@0: $logName; michael@0: if($UseViewer==0){ michael@0: $mozPath=$bldRoot."\\bin\\Mozilla.exe"; michael@0: } else { michael@0: $mozPath=$bldRoot."\\bin\\Viewer.exe"; michael@0: } michael@0: $logName="Logs\\".$ID."-combined.dat"; michael@0: michael@0: -e $mozPath or die "$mozPath could not be found\n"; michael@0: michael@0: if($clockTimeArg eq "clock"){ michael@0: $UseClockTime=1; michael@0: print( "Charting Clock time...\n"); michael@0: die "Clock Time Does Not Yet Work! "; michael@0: } else { michael@0: print( "Charting CPU time...\n"); michael@0: } michael@0: michael@0: # run it michael@0: $commandLine = $mozPath." ".$cmdLineArg[0].$cmdLineArg[1].$cmdLineArg[2].$cmdLineArg[3].$cmdLineArg[4].$cmdLineArg[5]."> $logName"; michael@0: print("Running $commandLine\n"); michael@0: system ("$commandLine") == 0 or die "Cannot invoke Mozilla\n"; michael@0: michael@0: # uncombine the output file michael@0: print("Breaking result into log files...\n"); michael@0: system( ("perl", "uncombine.pl", "$logName") ) == 0 or die "Error uncombining the output\n"; michael@0: michael@0: # generate the chart from the logs michael@0: if($UseClockTime==1){ michael@0: print("Generating performance table... (ClockTime)\n"); michael@0: system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot", "clock") ) == 0 or die "Error generating the clock-time chart from the logs\n"; michael@0: } else { michael@0: print("Generating performance table...(CPUTime)\n"); michael@0: system( ("perl", "genfromlogs.pl", "$ID", "$bldRoot") ) == 0 or die "Error generating the cpu-time chart from the logs\n"; michael@0: } michael@0: michael@0: # rename the output michael@0: system( ("copy", "table.html", "Tables\\$ID\.html") ) == 0 or die "Error copying table.html to Tables\\$ID\.html\n"; michael@0: michael@0: # run the history script michael@0: print("Generating history table...\n"); michael@0: system( ("perl", "history.pl") ) == 0 or die "Could not execute the history.pl script\n"; michael@0: michael@0: # rename the output michael@0: system( ("copy", "TrendTable.html", "Tables\\$ID-TrendTable.html") ) == 0 or die "could not copy TrendTable.html to Tables\\$ID-TrendTable.html\n"; michael@0: michael@0: # save off the files michael@0: system( ("mkdir", "Logs\\$ID") ); michael@0: system( ("copy", "Logs\\*.*", "Logs\\$ID\\*.*") ) == 0 or die "Cannot copy logfiles to Logs\\$ID\\*.*\n"; michael@0: system( ("copy", "history.txt", "Logs\\$ID-history.txt") ) == 0 or die "Cannot copy $ID_history.txt to Logs\n"; michael@0: michael@0: print("perf.pl DONE!\n");