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