1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tools/performance/startup/startup-unix.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +#!/usr/bin/perl 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 + 1.10 +# 1.11 +# Script to time mozilla startup. 1.12 +# Feeds in start time as url argument, startup-test.html 1.13 +# takes this arg and computes the time difference. 1.14 +# So something like this happens: 1.15 +# 1.16 +# mozilla file:/foo/startup-test.html?begin=T 1.17 +# where T = ms since 1970, e.g.: 1.18 +# mozilla file:/foo/startup-test.html?begin=999456977124 1.19 +# 1.20 +# NOTE: You will get much better results if you install the 1.21 +# Time::HiRes perl module (urls in gettime.pl) and test 1.22 +# an optimized build. 1.23 +# 1.24 +# For optimized builds, startup-test.html will also dump 1.25 +# the time out to stdout if you set: 1.26 +# user_pref("browser.dom.window.dump.enabled", true); 1.27 +# 1.28 + 1.29 +require 5.003; 1.30 + 1.31 +require "gettime.pl"; 1.32 + 1.33 +use strict; 1.34 +use Cwd; 1.35 + 1.36 +sub PrintUsage { 1.37 + die <<END_USAGE 1.38 + usage: startup-unix.pl <exe> [<args>] 1.39 + e.g 1.40 + startup-unix.pl ../../../dist/bin/mozilla 1.41 + startup-unix.pl ../../../dist/bin/mozilla -P \"Default User\" 1.42 +END_USAGE 1.43 +} 1.44 + 1.45 +{ 1.46 + PrintUsage() unless $#ARGV >= 0; 1.47 + # Build up command string. 1.48 + my $cwd = Cwd::getcwd(); 1.49 + 1.50 + my $cmd = join(' ', map {/\s/ ? qq("$_") : $_} @ARGV); 1.51 + my $time = Time::PossiblyHiRes::getTime(); 1.52 + $cmd .= qq( -url "file:$cwd/startup-test.html?begin=$time"); 1.53 + print "cmd = $cmd\n"; 1.54 + 1.55 + # Run the command. 1.56 + exec $cmd; 1.57 +} 1.58 +