|
1 #!/usr/bin/perl |
|
2 # This Source Code Form is subject to the terms of the Mozilla Public |
|
3 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
5 |
|
6 |
|
7 # |
|
8 # Script to time mozilla startup. |
|
9 # Feeds in start time as url argument, startup-test.html |
|
10 # takes this arg and computes the time difference. |
|
11 # So something like this happens: |
|
12 # |
|
13 # mozilla file:/foo/startup-test.html?begin=T |
|
14 # where T = ms since 1970, e.g.: |
|
15 # mozilla file:/foo/startup-test.html?begin=999456977124 |
|
16 # |
|
17 # NOTE: You will get much better results if you install the |
|
18 # Time::HiRes perl module (urls in gettime.pl) and test |
|
19 # an optimized build. |
|
20 # |
|
21 # For optimized builds, startup-test.html will also dump |
|
22 # the time out to stdout if you set: |
|
23 # user_pref("browser.dom.window.dump.enabled", true); |
|
24 # |
|
25 |
|
26 require 5.003; |
|
27 |
|
28 require "gettime.pl"; |
|
29 |
|
30 use strict; |
|
31 use Cwd; |
|
32 |
|
33 sub PrintUsage { |
|
34 die <<END_USAGE |
|
35 usage: startup-unix.pl <exe> [<args>] |
|
36 e.g |
|
37 startup-unix.pl ../../../dist/bin/mozilla |
|
38 startup-unix.pl ../../../dist/bin/mozilla -P \"Default User\" |
|
39 END_USAGE |
|
40 } |
|
41 |
|
42 { |
|
43 PrintUsage() unless $#ARGV >= 0; |
|
44 # Build up command string. |
|
45 my $cwd = Cwd::getcwd(); |
|
46 |
|
47 my $cmd = join(' ', map {/\s/ ? qq("$_") : $_} @ARGV); |
|
48 my $time = Time::PossiblyHiRes::getTime(); |
|
49 $cmd .= qq( -url "file:$cwd/startup-test.html?begin=$time"); |
|
50 print "cmd = $cmd\n"; |
|
51 |
|
52 # Run the command. |
|
53 exec $cmd; |
|
54 } |
|
55 |