tools/performance/startup/startup-unix.pl
author reed@reedloden.com
Tue, 29 Jan 2008 07:58:38 -0800
changeset 10915 71ec64f4a1c9eebf208e2bf5c979801c8d80a888
parent 1 9b2a99adc05e53cd4010de512f50118594756650
child 29325 3ed32d04742a49a64884a03a5c05514c97d41b1f
permissions -rwxr-xr-x
Bug 66057 - "Proxy: $http_proxy should influence proxy settings" [p=roc@ocallahan.org (Robert O'Callahan [roc]) / diane@ghic.org (Diane Trout) / ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=josh r+sr=biesi a1.9=damons]

#!/usr/bin/perl

#
# Script to time mozilla startup.
# Feeds in start time as url argument, startup-test.html
# takes this arg and computes the time difference.
# So something like this happens:
#
# mozilla file:/foo/startup-test.html?begin=T
#   where T = ms since 1970, e.g.:
# mozilla file:/foo/startup-test.html?begin=999456977124
# 
# NOTE: You will get much better results if you install the
# Time::HiRes perl module (urls in gettime.pl) and test
# an optimized build.
#
# For optimized builds, startup-test.html will also dump
# the time out to stdout if you set:
#   user_pref("browser.dom.window.dump.enabled", 1);
#

require 5.003;

require "gettime.pl";

use strict;
use Cwd;

sub PrintUsage {
  die <<END_USAGE
  usage: startup-unix.pl <exe> [<args>]
  e.g
      startup-unix.pl ../../../dist/bin/mozilla
      startup-unix.pl ../../../dist/bin/mozilla -P \"Default User\"
END_USAGE
}

{
  PrintUsage() unless $#ARGV >= 0;
  # Build up command string.
  my $cwd = Cwd::getcwd();

  my $cmd = join(' ', map {/\s/ ? qq("$_") : $_} @ARGV);
  my $time = Time::PossiblyHiRes::getTime();
  $cmd .= qq( -url "file:$cwd/startup-test.html?begin=$time");
  print "cmd = $cmd\n";

  # Run the command.
  exec $cmd;
}