michael@0: #!/usr/bin/perl 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: michael@0: # michael@0: # Script to time mozilla startup. michael@0: # Feeds in start time as url argument, startup-test.html michael@0: # takes this arg and computes the time difference. michael@0: # So something like this happens: michael@0: # michael@0: # mozilla file:/foo/startup-test.html?begin=T michael@0: # where T = ms since 1970, e.g.: michael@0: # mozilla file:/foo/startup-test.html?begin=999456977124 michael@0: # michael@0: # NOTE: You will get much better results if you install the michael@0: # Time::HiRes perl module (urls in gettime.pl) and test michael@0: # an optimized build. michael@0: # michael@0: # For optimized builds, startup-test.html will also dump michael@0: # the time out to stdout if you set: michael@0: # user_pref("browser.dom.window.dump.enabled", true); michael@0: # michael@0: michael@0: require 5.003; michael@0: michael@0: require "gettime.pl"; michael@0: michael@0: use strict; michael@0: use Cwd; michael@0: michael@0: sub PrintUsage { michael@0: die < [] michael@0: e.g michael@0: startup-unix.pl ../../../dist/bin/mozilla michael@0: startup-unix.pl ../../../dist/bin/mozilla -P \"Default User\" michael@0: END_USAGE michael@0: } michael@0: michael@0: { michael@0: PrintUsage() unless $#ARGV >= 0; michael@0: # Build up command string. michael@0: my $cwd = Cwd::getcwd(); michael@0: michael@0: my $cmd = join(' ', map {/\s/ ? qq("$_") : $_} @ARGV); michael@0: my $time = Time::PossiblyHiRes::getTime(); michael@0: $cmd .= qq( -url "file:$cwd/startup-test.html?begin=$time"); michael@0: print "cmd = $cmd\n"; michael@0: michael@0: # Run the command. michael@0: exec $cmd; michael@0: } michael@0: