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.

     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/.
     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 #
    26 require 5.003;
    28 require "gettime.pl";
    30 use strict;
    31 use Cwd;
    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 }
    42 {
    43   PrintUsage() unless $#ARGV >= 0;
    44   # Build up command string.
    45   my $cwd = Cwd::getcwd();
    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";
    52   # Run the command.
    53   exec $cmd;
    54 }

mercurial