4 # Script to time mozilla startup
7 # - a Profile with name "Default User"
8 # - a MOZ_TIMELINE build
10 # This starts mozilla with the profile "Default User" and makes it quit immediately.
11 # Measurement is of main1 from MOZ_TIMELINE output
13 # This does multiple runs [default 3] and averages all but the first run.
15 # startup-quick.pl <exe> [n times]
26 usage: measure-simple.pl [n]
29 measure-simple.pl ../../../dist/bin/mozilla
30 measure-simple.pl ../../../dist/bin/mozilla 10
35 PrintUsage() unless $#ARGV >= 0;
36 my $exe = shift @ARGV;
37 my $ntimes = shift @ARGV || 3;
38 my $timelinelog = "timeline.log";
39 # Do one more than what was requested as we ignore the first run timing
42 # Build up command string.
43 my $cwd = Cwd::getcwd();
45 # take care of cygwin adding /cygdrive/<driveletter>
46 $cwd =~ s/\/cygdrive\/(.)/$1:/;
48 my $cmd = "$exe -P \"Default User\" file:///$cwd/quit.html";
50 print "$ntimes times\n";
52 # Setup run environment
53 $ENV{"NS_TIMELINE_ENABLE"} = 1;
54 $ENV{"NS_TIMELINE_LOG_FILE"} = $timelinelog;
55 $ENV{"XPCOM_DEBUG_BREAK"} = "warn";
60 for($i = 0; $i < $ntimes; $i++) {
64 # find the time taken from the TIMELINE LOG
66 open(F, "< $timelinelog") || die "no timeline log ($timelinelog) found";
68 if (/^(.*): \.\.\.main1$/) {
71 print "[$i] startup time : $t sec\n";
80 # Compute final number. Skip first run and average the rest.
83 foreach $i (@runtimes) {
86 printf "Average startup time : %8.4f secs (%d trials - %s)\n", $sum/($ntimes-1), $ntimes-1, join(" ", @runtimes);