tools/performance/startup/startup-unix.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial