Compare commits
2 Commits
test_unit
...
MY_FOO_BRA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae74ac3c3b | ||
|
|
104d04c16a |
@@ -1 +0,0 @@
|
||||
Another clobber to see about the orange... :(
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
## hostname: gaius
|
||||
## uname: WINNT GAIUS 5.2 3790 xx I386
|
||||
#
|
||||
|
||||
|
||||
# . $topsrcdir/browser/config/mozconfig
|
||||
|
||||
mk_add_options MOZ_CO_PROJECT=browser
|
||||
##mk_add_options MOZ_MAKE_FLAGS="-j8"
|
||||
#mk_add_options MOZ_CO_MODULE="mozilla/tools/update-packaging"
|
||||
mk_add_options MOZ_PACKAGE_NSIS=1
|
||||
|
||||
ac_add_options --enable-application=browser
|
||||
ac_add_options --enable-update-channel=nightly
|
||||
ac_add_options --enable-optimize
|
||||
ac_add_options --disable-debug
|
||||
# ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-tests
|
||||
ac_add_options --disable-static
|
||||
# ac_add_options --disable-shared
|
||||
# ac_add_options --enable-official-branding
|
||||
ac_add_options --enable-svg
|
||||
ac_add_options --enable-canvas
|
||||
ac_add_options --enable-default-toolkit=cairo-windows
|
||||
#ac_add_options --enable-update-packaging
|
||||
@@ -1,254 +0,0 @@
|
||||
#
|
||||
## hostname: gaius
|
||||
## uname: WINNT GAIUS 5.2 3790 xx I386
|
||||
#
|
||||
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
$ENV{MOZ_INSTALLER_USE_7ZIP} = '1';
|
||||
$ENV{NO_EM_RESTART} = '1';
|
||||
$ENV{MOZ_PACKAGE_NSIS} = '1';
|
||||
|
||||
# $ENV{MOZ_PACKAGE_MSI}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Controls whether a MSI package is made.
|
||||
# Requires: Windows and a local MakeMSI installation.
|
||||
#$ENV{MOZ_PACKAGE_MSI} = 0;
|
||||
|
||||
# $ENV{MOZ_SYMBOLS_TRANSFER_TYPE}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: scp
|
||||
# Values: scp | rsync
|
||||
# Purpose: Use scp or rsync to transfer symbols to the Talkback server.
|
||||
# Requires: The selected type requires the command be available both locally
|
||||
# and on the Talkback server.
|
||||
#$ENV{MOZ_SYMBOLS_TRANSFER_TYPE} = "scp";
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
$BuildAdministrator = 'build@mozilla.org';
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
|
||||
$BuildXForms = 1;
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
#$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
#$BuildDebug = 0; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
#$TestOnly = 0; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
#$BuildLocales = 0; # Do l10n packaging?
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
$ProductName = "Firefox";
|
||||
$VendorName = "Mozilla";
|
||||
|
||||
$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
$RegxpcomTest = 0;
|
||||
$AliveTest = 0;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
#$BloatTest = 0; # warren memory bloat test
|
||||
#$BloatTest2 = 0; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
$LayoutPerformanceTest = 0; # Tp
|
||||
#$DHTMLPerformanceTest = 0; # Tdhtml
|
||||
#$QATest = 0;
|
||||
$XULWindowOpenTest = 0; # Txul
|
||||
#$StartupPerformanceTest = 1; # Ts
|
||||
#$NeckoUnitTest = 0;
|
||||
$RenderPerformanceTest = 0; # Tgfx
|
||||
|
||||
$RunUnitTests = 1;
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
$GraphNameOverride = 'fxexp-win32-tbox';
|
||||
|
||||
# $results_server
|
||||
#----------------------------------------------------------------------------
|
||||
# Server on which test results will be accessible. This was originally tegu,
|
||||
# then became axolotl. Once we moved services from axolotl, it was time
|
||||
# to give this service its own hostname to make future transitions easier.
|
||||
# - cmp@mozilla.org
|
||||
#$results_server = "build-graphs.mozilla.org";
|
||||
|
||||
$pageload_server = "pageload.build.mozilla.org"; # localhost
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
#$CVSCheckoutTimeout = 3600;
|
||||
#$CreateProfileTimeout = 45;
|
||||
#$RegxpcomTestTimeout = 120;
|
||||
|
||||
#$AliveTestTimeout = 30;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
#$BloatTestTimeout = 120; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
$LayoutPerformanceTestTimeout = 800; # entire test, seconds
|
||||
#$DHTMLPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 20; # seconds
|
||||
#$XULWindowOpenTestTimeout = 90; # seconds
|
||||
#$NeckoUnitTestTimeout = 30; # seconds
|
||||
$RenderPerformanceTestTimeout = 1800; # seconds
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
$Make = 'make'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
$blat = 'd:/moztools/bin/blat.exe';
|
||||
$use_blat = 1;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
#$moz_cvsroot = $ENV{CVSROOT};
|
||||
$moz_cvsroot = ':ext:cltbld@cvs.mozilla.org:/cvsroot';
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
#$ObjDir = 'fx-trunk-cairo';
|
||||
|
||||
# Extra build name, if needed.
|
||||
$BuildNameExtra = 'Unit Testing';
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
#$BuildSleep = 10;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
#$BuildTree = 'MozillaTest';
|
||||
#$BuildTree = 'Firefox-Cairo';
|
||||
$BuildTree = 'MozillaExperimental';
|
||||
|
||||
#$BuildName = '';
|
||||
#$BuildTag = '';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox.exe';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# Release build options
|
||||
$ReleaseBuild = 0;
|
||||
$shiptalkback = 0;
|
||||
$ReleaseToLatest = 0; # Push the release to latest-<milestone>?
|
||||
$ReleaseToDated = 0; # Push the release to YYYY-MM-DD-HH-<milestone>?
|
||||
$build_hour = "4";
|
||||
$package_creation_path = "/browser/installer";
|
||||
# needs setting for mac + talkback: $mac_bundle_path = "/browser/app";
|
||||
$ssh_version = "2";
|
||||
#$ssh_user = "cltbld";
|
||||
#$ssh_server = "stage.mozilla.org";
|
||||
$ftp_path = "/home/ftp/pub/firefox/nightly";
|
||||
$url_path = "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly";
|
||||
$tbox_ftp_path = "/home/ftp/pub/firefox/tinderbox-builds";
|
||||
$tbox_url_path = "http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds";
|
||||
$milestone = "trunk";
|
||||
$notify_list = 'build-announce@mozilla.org';
|
||||
#$stub_installer = 0;
|
||||
#$sea_installer = 1;
|
||||
#$archive = 1;
|
||||
#$push_raw_xpis = 1;
|
||||
#$update_package = 1;
|
||||
#$update_product = "Firefox";
|
||||
#$update_version = "trunk";
|
||||
#$update_platform = "WINNT_x86-msvc";
|
||||
#$update_hash = "sha1";
|
||||
#$update_filehost = "ftp.mozilla.org";
|
||||
#$update_appv = "3.0a1";
|
||||
#$update_extv = "3.0a1";
|
||||
#$update_pushinfo = 0;
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
#$LogCompression = '';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
#$LogEncoding = '';
|
||||
|
||||
# Prevent Extension Manager from spawning child processes during tests
|
||||
# - processes that tbox scripts cannot kill.
|
||||
#$ENV{NO_EM_RESTART} = '1';
|
||||
|
||||
# Build XForms
|
||||
$BuildXForms = 1;
|
||||
102
mozilla/webtools/leak-o-matic/Zip.pm
Normal file
102
mozilla/webtools/leak-o-matic/Zip.pm
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: Zip.pm,v 1.3 1999-11-17 19:15:00 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# Simple, incomplete interface to .zip files.
|
||||
#
|
||||
|
||||
|
||||
package Zip;
|
||||
|
||||
require 5.000;
|
||||
|
||||
use strict;
|
||||
|
||||
use Carp;
|
||||
use IO;
|
||||
use Symbol;
|
||||
use Time::Local;
|
||||
|
||||
my $zipname;
|
||||
|
||||
sub new($$) {
|
||||
@_ == 2 || croak 'usage: new Zip [FILENAME]';
|
||||
my $class = shift;
|
||||
my $zip = gensym;
|
||||
if (@_) {
|
||||
Zip::open($zip, $_[0]) || return undef;
|
||||
}
|
||||
bless $zip, $class;
|
||||
}
|
||||
|
||||
sub DESTROY($) {
|
||||
}
|
||||
|
||||
sub open($$) {
|
||||
@_ == 2 || croak 'usage: $zip->open(FILENAME)';
|
||||
my ($zip, $filename) = @_;
|
||||
$zipname = $filename;
|
||||
}
|
||||
|
||||
sub close($) {
|
||||
@_ == 1 || croak 'usage: $zip->close()';
|
||||
$zipname = undef;
|
||||
}
|
||||
|
||||
sub dir($) {
|
||||
@_ == 1 || croak 'usage: $zip->dir()';
|
||||
$zipname || croak 'no open zipfile';
|
||||
|
||||
|
||||
my @result = ();
|
||||
|
||||
my @list = qx/unzip -l $zipname/;
|
||||
ENTRY: foreach (@list) {
|
||||
# Entry expected to be in the format
|
||||
# size mm-dd-yy hh:mm name
|
||||
next ENTRY unless (/ *(\d+) +(\d+)-(\d+)-(\d+) +(\d+):(\d+) +(.+)$/);
|
||||
|
||||
my $mtime = Time::Local::timelocal(0, $6, $5, $3, $2, ($4 < 1900) ? ($4 + 1900) : $4);
|
||||
|
||||
push(@result, { name => $7,
|
||||
size => $1,
|
||||
mtime => $mtime });
|
||||
}
|
||||
|
||||
return @result;
|
||||
}
|
||||
|
||||
sub expand($$) {
|
||||
@_ == 2 || croak 'usage: $zip->expand(FILENAME)';
|
||||
$zipname || croak 'no open zipfile';
|
||||
|
||||
my $filename = $_[1];
|
||||
|
||||
my $result = new IO::Handle;
|
||||
CORE::open($result, "unzip -p $zipname $filename |");
|
||||
return $result;
|
||||
}
|
||||
|
||||
1;
|
||||
366
mozilla/webtools/leak-o-matic/balance.cgi
Executable file
366
mozilla/webtools/leak-o-matic/balance.cgi
Executable file
@@ -0,0 +1,366 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: balance.cgi,v 1.2 1999-11-17 19:15:00 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# Builds a tree of reference counts
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
|
||||
use CGI;
|
||||
use POSIX;
|
||||
use Zip;
|
||||
|
||||
$::query = new CGI();
|
||||
|
||||
$::opt_log = $::query->param('log');
|
||||
$::opt_class = $::query->param('class');
|
||||
$::opt_object = $::query->param('object');
|
||||
@::opt_exclude = $::query->param('exclude');
|
||||
$::opt_show_balanced = $::query->param('show-balanced');
|
||||
$::opt_subtree_size = $::query->param('subtree-size');
|
||||
$::opt_prune_depth = $::query->param('prune-depth');
|
||||
$::opt_reverse = $::query->param('reverse');
|
||||
$::opt_collapse_to_method = $::query->param('collapse-to-method');
|
||||
$::opt_collapse_to_class = $::query->param('collapse-to-class');
|
||||
|
||||
$::opt_log || die;
|
||||
$::opt_class || die;
|
||||
$::opt_object || die;
|
||||
|
||||
# Make sure that values get initialized properly
|
||||
$::opt_prune_depth = 0 if (! $::opt_prune_depth);
|
||||
$::opt_subtree_size = 0 if (! $::opt_subtree_size);
|
||||
$::opt_collapse_to_class = 0 if (! $::opt_collapse_to_class);
|
||||
$::opt_collapse_to_method = 0 if (! $::opt_collapse_to_method);
|
||||
|
||||
# Sanity checks
|
||||
$::opt_prune_depth = 0 if $::opt_prune_depth < 0;
|
||||
$::opt_subtree_size = 0 if $::opt_subtree_size < 0;
|
||||
|
||||
|
||||
print $::query->header;
|
||||
|
||||
print qq{
|
||||
<html>
|
||||
<head>
|
||||
<title>$::opt_class [$::opt_object]</title>
|
||||
<script language="JavaScript" src="balance.js"></script>
|
||||
<style type="text/css" src="balance.css"></style>
|
||||
</head>
|
||||
<body>
|
||||
};
|
||||
|
||||
print $::query->h1("$::opt_class [$::opt_object]");
|
||||
|
||||
print "<small>\n";
|
||||
{
|
||||
my @statinfo = stat($::opt_log);
|
||||
my $when = POSIX::strftime "%a %b %e %H:%M:%S %Y", localtime($statinfo[9]);
|
||||
print "$when<br>\n";
|
||||
}
|
||||
|
||||
print "<a href='bloat-log.cgi?log=$::opt_log'>Bloat Log</a>\n";
|
||||
print "<a href='leaks.cgi?log=$::opt_log'>Back to Overview</a>\n";
|
||||
print "</small>\n";
|
||||
|
||||
# The 'excludes' are functions that, if detected in a particular call
|
||||
# stack, will cause the _entire_ call stack to be ignored. You might,
|
||||
# for example, explicitly exclude two functions that have a matching
|
||||
# AddRef/Release pair.
|
||||
|
||||
my %excludes;
|
||||
{
|
||||
my $method;
|
||||
foreach $method (@::opt_exclude) {
|
||||
$excludes{$method} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Each entry in the tree rooted by callGraphRoot contains the following:
|
||||
# #name# This call's name+offset string
|
||||
# #refcount# The net reference count of this call
|
||||
# #label# The label used for this subtree; only defined for labeled nodes
|
||||
# #children# List of children in alphabetical order
|
||||
# zero or more children indexed by method name+offset strings.
|
||||
|
||||
my $callGraphRoot;
|
||||
$callGraphRoot = { '#name#' => '.root', '#refcount#' => 'n/a' };
|
||||
|
||||
# The 'imbalance' is a gross count of how balanced a particular
|
||||
# callsite is. It is used to prune away callsites that are detected to
|
||||
# be balanced; that is, that have matching AddRef/Release() pairs.
|
||||
|
||||
my %imbalance;
|
||||
$imbalance{'.root'} = 'n/a';
|
||||
|
||||
|
||||
# The main read loop.
|
||||
my $log = new Zip($::opt_log);
|
||||
$log || die('unable to open log $log');
|
||||
|
||||
my $logfile = "refcnt-" . $::opt_class . "-" . $::opt_object . ".log";
|
||||
|
||||
my $handle = $log->expand($logfile);
|
||||
|
||||
LINE: while (<$handle>) {
|
||||
next LINE if (! /^</);
|
||||
my @fields = split(/ /, $_);
|
||||
|
||||
my $class = shift(@fields);
|
||||
my $obj = shift(@fields);
|
||||
my $sno = shift(@fields);
|
||||
next LINE unless ($sno eq $::opt_object);
|
||||
|
||||
my $op = shift(@fields);
|
||||
next LINE unless ($op eq "AddRef" || $op eq "Release");
|
||||
|
||||
my $cnt = shift(@fields);
|
||||
|
||||
# Collect the remaining lines to create a stack trace.
|
||||
my @stack;
|
||||
CALLSITE: while (<$handle>) {
|
||||
chomp;
|
||||
last CALLSITE if (/^$/);
|
||||
$stack[++$#stack] = $_;
|
||||
}
|
||||
|
||||
# Reverse the remaining fields to produce the call stack, with the
|
||||
# oldest frame at the front of the array.
|
||||
if (! $::opt_reverse) {
|
||||
@stack = reverse(@stack);
|
||||
}
|
||||
|
||||
my $call;
|
||||
|
||||
# If any of the functions in the stack are supposed to be excluded,
|
||||
# march on to the next line.
|
||||
foreach $call (@stack) {
|
||||
next LINE if exists($excludes{$call});
|
||||
}
|
||||
|
||||
|
||||
# Add the callstack as a path through the call graph, updating
|
||||
# refcounts at each node.
|
||||
|
||||
my $caller = $callGraphRoot;
|
||||
|
||||
foreach $call (@stack) {
|
||||
|
||||
# Chop the method offset if we're 'collapsing to method' or
|
||||
# 'collapsing to class'.
|
||||
$call =~ s/\+0x.*$//g if ($::opt_collapse_to_method || $::opt_collapse_to_class);
|
||||
|
||||
# Chop the method name if we're 'collapsing to class'.
|
||||
$call =~ s/::.*$//g if ($::opt_collapse_to_class);
|
||||
|
||||
my $site = $caller->{$call};
|
||||
if (!$site) {
|
||||
# This is the first time we've seen this callsite. Add a
|
||||
# new entry to the call tree.
|
||||
|
||||
$site = { '#name#' => $call, '#refcount#' => 0 };
|
||||
$caller->{$call} = $site;
|
||||
}
|
||||
|
||||
if ($op eq 'AddRef') {
|
||||
++($site->{'#refcount#'});
|
||||
++($imbalance{$call});
|
||||
} elsif ($op eq 'Release') {
|
||||
--($site->{'#refcount#'});
|
||||
--($imbalance{$call});
|
||||
} else {
|
||||
die "Bad operation $op";
|
||||
}
|
||||
|
||||
$caller = $site;
|
||||
}
|
||||
}
|
||||
|
||||
# Given a subtree and its nesting level, return true if that subtree should be pruned.
|
||||
# If it shouldn't be pruned, destructively attempt to prune its children.
|
||||
# Also compute the #children# properties of unpruned nodes.
|
||||
sub prune($$) {
|
||||
my ($site, $nest) = @_;
|
||||
|
||||
# If they want us to prune the tree's depth, do so here.
|
||||
return 1 if ($::opt_prune_depth && $nest >= $::opt_prune_depth);
|
||||
|
||||
# If the subtree is balanced, ignore it.
|
||||
return 1 if (!$::opt_show_balanced && !$site->{'#refcount#'});
|
||||
|
||||
my $name = $site->{'#name#'};
|
||||
|
||||
# If the symbol isn't imbalanced, then prune here (and warn)
|
||||
# XXX no symbol-level balancing; this was buggy.
|
||||
# if (!$::opt_show_balanced && !$imbalance{$name}) {
|
||||
# warn "discarding " . $name . "\n";
|
||||
# return 1;
|
||||
# }
|
||||
|
||||
my @children;
|
||||
foreach my $child (sort(keys(%$site))) {
|
||||
if (substr($child, 0, 1) ne '#') {
|
||||
if (prune($site->{$child}, $nest + 1)) {
|
||||
delete $site->{$child};
|
||||
} else {
|
||||
push @children, $site->{$child};
|
||||
}
|
||||
}
|
||||
}
|
||||
$site->{'#children#'} = \@children;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
# Compute the #label# properties of this subtree.
|
||||
# Return the subtree's number of nodes, not counting nodes reachable
|
||||
# through a labeled node.
|
||||
sub createLabels($) {
|
||||
my ($site) = @_;
|
||||
my @children = @{$site->{'#children#'}};
|
||||
my $nChildren = @children;
|
||||
my $nDescendants = 0;
|
||||
|
||||
foreach my $child (@children) {
|
||||
my $childDescendants = createLabels($child);
|
||||
if ($nChildren > 1 && $childDescendants > $::opt_subtree_size) {
|
||||
die "Internal error" if defined($child->{'#label#'});
|
||||
$child->{'#label#'} = "__label__";
|
||||
$childDescendants = 1;
|
||||
}
|
||||
$nDescendants += $childDescendants;
|
||||
}
|
||||
return $nDescendants + 1;
|
||||
}
|
||||
|
||||
|
||||
my $nextLabel = 0;
|
||||
my @labeledSubtrees;
|
||||
|
||||
sub list($$$$$) {
|
||||
my ($site, $nest, $nestStr, $childrenLeft, $root) = @_;
|
||||
my $label = !$root && $site->{'#label#'};
|
||||
|
||||
# Assign a unique number to the label.
|
||||
if ($label) {
|
||||
die unless $label eq "__label__";
|
||||
$label = "__" . ++$nextLabel . "__";
|
||||
$site->{'#label#'} = $label;
|
||||
push @labeledSubtrees, $site;
|
||||
}
|
||||
|
||||
print $nestStr;
|
||||
if ($::opt_old_style) {
|
||||
print $label, " " if $label;
|
||||
print $site->{'#name#'}, ": bal=", $site->{'#refcount#'}, "\n";
|
||||
} else {
|
||||
my $refcount = $site->{'#refcount#'};
|
||||
my $l = 8 - length $refcount;
|
||||
$l = 1 if $l < 1;
|
||||
print $refcount, " " x $l;
|
||||
print $label, " " if $label;
|
||||
print "<tt class='method'>";
|
||||
print $site->{'#name#'};
|
||||
print "</tt>\n";
|
||||
}
|
||||
|
||||
$nestStr .= $childrenLeft && !$::opt_old_style ? "| " : " ";
|
||||
if (!$label) {
|
||||
my @children = @{$site->{'#children#'}};
|
||||
$childrenLeft = @children;
|
||||
foreach my $child (@children) {
|
||||
$childrenLeft--;
|
||||
list($child, $nest + 1, $nestStr, $childrenLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!prune($callGraphRoot, 0)) {
|
||||
createLabels $callGraphRoot if ($::opt_subtree_size);
|
||||
|
||||
print "<div onclick='toggle(event.target);'><pre>\n";
|
||||
list $callGraphRoot, 0, "", 0, 1;
|
||||
while (@labeledSubtrees) {
|
||||
my $labeledSubtree = shift @labeledSubtrees;
|
||||
print "\n<hr>\n", $labeledSubtree->{'#label#'}, "\n";
|
||||
list $labeledSubtree, 0, "", 0, 1;
|
||||
}
|
||||
print "\n<hr>\n" if @labeledSubtrees;
|
||||
print "</pre></div>\n";
|
||||
}
|
||||
|
||||
# Now generate the control panel at the bottom. This needs to be "neater".
|
||||
|
||||
print qq{
|
||||
<hr>
|
||||
<form method='get' action='balance.cgi' onsubmit='onsubmit();'>
|
||||
<input id='log' name='log' type='hidden' value='$::opt_log'></input>
|
||||
<input id='class' name='class' type='hidden' value='$::opt_class'></input>
|
||||
<input id='object' name='object' type='hidden' value='$::opt_object'></input>
|
||||
|
||||
<fieldset>
|
||||
<legend>Methods to Exclude</legend>
|
||||
<select id='exclude' name='exclude' style='width:100%;height:10em' size="10" multiple>
|
||||
};
|
||||
|
||||
{
|
||||
my $method;
|
||||
foreach $method (@::opt_exclude) {
|
||||
print " <option selected>$method</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print qq{
|
||||
</select>
|
||||
<br>
|
||||
|
||||
<input type="button" onclick="remove();" value="Remove"></input>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Options</legend>
|
||||
};
|
||||
|
||||
print "<input id='collapse-to-method' name='collapse-to-method' type='checkbox' value='$::opt_collapse_to_method' ";
|
||||
print "checked" if $::opt_collapse_to_method;
|
||||
print ">Collapse To Method</input>\n";
|
||||
|
||||
print "<input id='collapse-to-class' value='collapse-to-class' type='checkbox' value='$::opt_collapse_to_class' ";
|
||||
print "checked" if $::opt_collapse_to_class;
|
||||
print ">Collapse To Class</input>\n";
|
||||
|
||||
print qq{
|
||||
</fieldset>
|
||||
|
||||
<input type='submit' value='Rebuild'></input>
|
||||
</form>
|
||||
};
|
||||
|
||||
print $::query->end_html;
|
||||
|
||||
|
||||
38
mozilla/webtools/leak-o-matic/balance.css
Normal file
38
mozilla/webtools/leak-o-matic/balance.css
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Leak-o-Matic.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corp. Portions created by Netscape Communucations
|
||||
* Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Waterson <waterson@netscape.com>
|
||||
*
|
||||
* $Id: balance.css,v 1.2 1999-11-17 19:15:01 waterson%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Style rules for the HTML generated by ``balance.cgi''
|
||||
|
||||
*/
|
||||
|
||||
tt.method {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
tt.method[selected ~= "true"] {
|
||||
color: red;
|
||||
}
|
||||
97
mozilla/webtools/leak-o-matic/balance.js
Normal file
97
mozilla/webtools/leak-o-matic/balance.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Leak-o-Matic.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corp. Portions created by Netscape Communucations
|
||||
* Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Waterson <waterson@netscape.com>
|
||||
*
|
||||
* $Id: balance.js,v 1.2 1999-11-17 19:15:02 waterson%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Script for the HTML generated by ``balance.cgi''
|
||||
|
||||
*/
|
||||
|
||||
function toggle(target)
|
||||
{
|
||||
var tt = target.parentNode;
|
||||
|
||||
// ensure that we're actuallly looking at a method
|
||||
if (tt.getAttribute('class') != 'method') return;
|
||||
|
||||
// toggle the selected state
|
||||
var selected = tt.getAttribute('selected') == 'true';
|
||||
selected = !selected;
|
||||
tt.setAttribute('selected', selected ? 'true' : 'false');
|
||||
|
||||
// add/remove from the 'exclude' list
|
||||
var exclude = document.getElementById('exclude');
|
||||
var value = target.nodeValue;
|
||||
|
||||
if (selected) {
|
||||
var found = false;
|
||||
for (var i = 0; i < exclude.length; ++i) {
|
||||
if (exclude.options[i].text == value) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! found) {
|
||||
dump('adding ' + value + '\n');
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute('selected', 'true');
|
||||
option.appendChild(document.createTextNode(value));
|
||||
exclude.appendChild(option);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < exclude.length; ++i) {
|
||||
if (exclude.options[i].text == value) {
|
||||
exclude.removeChild(exclude.options[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove() {
|
||||
// remove all of the selected items from the 'exclude' list
|
||||
var exclude = document.getElementById('exclude');
|
||||
|
||||
for (var i = 0; i < exclude.length; ++i) {
|
||||
if (exclude.options[i].selected) {
|
||||
exclude.removeChild(exclude.options[i]);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onsubmit() {
|
||||
// make sure that all of the elements in the select are actually
|
||||
// -selected- so that the HTTP GET will contain them as excludes.
|
||||
var exclude = document.getElementById('exclude');
|
||||
|
||||
for (var i = 0; i < exclude.length; ++i) {
|
||||
// XXX doing this with 'options[i].selected = true' actually
|
||||
// -changes- the selection. Oops.
|
||||
exclude.options[i].setAttribute('selected', 'true');
|
||||
}
|
||||
}
|
||||
65
mozilla/webtools/leak-o-matic/bloat-log.cgi
Executable file
65
mozilla/webtools/leak-o-matic/bloat-log.cgi
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: bloat-log.cgi,v 1.3 1999-11-17 19:15:02 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# Extracts the original bloat log from a Leak-o-Matic zip
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use CGI;
|
||||
use POSIX;
|
||||
use Zip;
|
||||
|
||||
$::query = new CGI();
|
||||
|
||||
# The ZIP where all the log files are kept
|
||||
$::log = $::query->param('log');
|
||||
$::zip = new Zip($::log);
|
||||
|
||||
print $::query->header;
|
||||
|
||||
{
|
||||
my @statinfo = stat($::log);
|
||||
my $when = POSIX::strftime "%a %b %e %H:%M:%S %Y", localtime($statinfo[9]);
|
||||
|
||||
print $::query->start_html("Bloat Log, $when"),
|
||||
$::query->h1("Bloat Log");
|
||||
|
||||
print "<small>$when</small>\n";
|
||||
}
|
||||
|
||||
print "<pre>\n";
|
||||
|
||||
{
|
||||
my $handle = $::zip->expand('master-bloat.log');
|
||||
|
||||
while (<$handle>) {
|
||||
print $_;
|
||||
}
|
||||
}
|
||||
|
||||
print "</pre>\n";
|
||||
print $::query->end_html;
|
||||
73
mozilla/webtools/leak-o-matic/handle-mail.pl
Executable file
73
mozilla/webtools/leak-o-matic/handle-mail.pl
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: handle-mail.pl,v 1.4 1999-11-18 03:38:24 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# ``sendmail'' handler to receive data on the server. Cooperates with
|
||||
# ``make-data.pl'', the data collection script.
|
||||
#
|
||||
# To use, create an account on your server; e.g., "leak-o-matic", that
|
||||
# will receive mail from the data collector. In this account's home
|
||||
# directory, create a .forward file that containes the following
|
||||
#
|
||||
# "|handle-mail.pl --datadir=whatever"
|
||||
#
|
||||
# Yes, the quotes are important. Depending on your sendmail
|
||||
# configuration, you may need to place the ``handle-mail.pl'' script
|
||||
# in a special directory; e.g., /etc/smrsh on a vanilla RH6.0 system.
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use File::Copy;
|
||||
|
||||
GetOptions("datadir=s");
|
||||
chdir('/tmp');
|
||||
|
||||
# Open a pipe to ``uudecode'' so we can unstuff the binary
|
||||
open(OUT, "|uudecode");
|
||||
|
||||
LINE: while (<>) {
|
||||
# Ignore anything up until the ``begin'' directive
|
||||
if (/^begin \d\d\d (.*)/) {
|
||||
$::file = $1;
|
||||
print OUT $_;
|
||||
last LINE;
|
||||
}
|
||||
}
|
||||
|
||||
# No file means we read the entire message and found nothing
|
||||
$::file || die;
|
||||
|
||||
while (<>) {
|
||||
print OUT $_;
|
||||
}
|
||||
|
||||
# Be sure to close the pipe (so uudecode can complete) before moving
|
||||
# the file
|
||||
close(OUT);
|
||||
|
||||
# Move to the data directory, if there is one.
|
||||
move($::file, $::opt_datadir) if $::opt_datadir;
|
||||
23
mozilla/webtools/leak-o-matic/instructions.html
Normal file
23
mozilla/webtools/leak-o-matic/instructions.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Leak-o-Matic Instructions</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr><td bgcolor="#000000" valign="top">
|
||||
<img src="http://www.mozilla.org/images/mozilla-banner.gif"
|
||||
alt="mozilla.org" border="0" href="http://www.mozilla.org/">
|
||||
</td></tr></table>
|
||||
|
||||
<center>
|
||||
<h1>Leak-o-Matic Instructions</h1>
|
||||
</center>
|
||||
|
||||
<p>
|
||||
Write me!
|
||||
</p>
|
||||
|
||||
<small>$Id: instructions.html,v 1.1 1999-11-16 22:10:08 waterson%netscape.com Exp $</small>
|
||||
</body>
|
||||
</html>
|
||||
103
mozilla/webtools/leak-o-matic/leaks.cgi
Executable file
103
mozilla/webtools/leak-o-matic/leaks.cgi
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: leaks.cgi,v 1.3 1999-11-17 19:15:03 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# Expands a logfile into all of the leakers
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use CGI;
|
||||
use POSIX;
|
||||
use Zip;
|
||||
|
||||
$::query = new CGI();
|
||||
|
||||
# The ZIP where all the log files are kept
|
||||
$::log = $::query->param('log');
|
||||
$::zip = new Zip($::log);
|
||||
|
||||
print $::query->header;
|
||||
|
||||
{
|
||||
my @statinfo = stat($::log);
|
||||
my $when = POSIX::strftime "%a %b %e %H:%M:%S %Y", localtime($statinfo[9]);
|
||||
|
||||
print $::query->start_html("Leaked Objects, $when"),
|
||||
$::query->h1("Leaked Objects");
|
||||
|
||||
print "<small>$when<br><a href='bloat-log.cgi?log=$::log'>Bloat Log</a></small>\n";
|
||||
}
|
||||
|
||||
# Collect all of the log files. Files are assumed to be named
|
||||
# "refcnt-class-serialno.log", so we'll list all of the files and then
|
||||
# parse out the 'class' and 'serialno' values to present a pretty
|
||||
# HTML-ized version.
|
||||
{
|
||||
my @files = $::zip->dir();
|
||||
|
||||
my $current = "";
|
||||
my $count = 0;
|
||||
|
||||
my $file;
|
||||
FILE: foreach (@files) {
|
||||
$_ = $$_{name};
|
||||
next FILE unless (/^refcnt-([^-]+)-(\d+).log$/);
|
||||
|
||||
$::classes{$1} = [] if !$::classes{$1};
|
||||
my $objects = $::classes{$1};
|
||||
push(@$objects, $2);
|
||||
}
|
||||
}
|
||||
|
||||
print "<table border='0'>\n";
|
||||
print "<th><tr bgcolor='#DDDDDD'><td align='center'><b>Class</b></td><td align='center'><b>Objects</b></td></tr></th>\n";
|
||||
print "<tbody>\n";
|
||||
|
||||
{
|
||||
my $bgcolor='#FFFFFF';
|
||||
|
||||
my $class;
|
||||
foreach $class (sort(keys(%::classes))) {
|
||||
print "<tr bgcolor='$bgcolor'>\n";
|
||||
print "<td valign='top'><a href='http://lxr.mozilla.org/seamonkey/ident?i=$class'>$class</a></td>\n";
|
||||
print "<td><small>\n";
|
||||
my $objects = $::classes{$class};
|
||||
|
||||
my $object;
|
||||
foreach $object (sort { $::a <=> $::b } @$objects) {
|
||||
print "<a href='balance.cgi?log=$::log&class=$class&object=$object'>$object</a>\n";
|
||||
}
|
||||
print "\n</small></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$bgcolor = ($bgcolor eq '#FFFFFF') ? '#FFFFBB' : '#FFFFFF';
|
||||
}
|
||||
}
|
||||
|
||||
print "</tbody></table>\n";
|
||||
|
||||
print $::query->end_html;
|
||||
|
||||
101
mozilla/webtools/leak-o-matic/logs.cgi
Executable file
101
mozilla/webtools/leak-o-matic/logs.cgi
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Testing 1-2-3
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: logs.cgi,v 1.6.2.1 2000-01-07 03:46:25 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# ``Front door'' script that shows all of the logs that are
|
||||
# available for perusal
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use CGI;
|
||||
use POSIX;
|
||||
|
||||
$::query = new CGI();
|
||||
$::logdir = $::query->param('logdir');
|
||||
$::logdir = 'data' unless $::logdir; # default is 'data' subdir
|
||||
|
||||
print $::query->header;
|
||||
print $::query->start_html("Leak-o-Matic");
|
||||
|
||||
print qq{
|
||||
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td bgcolor='#000000' valign='top'>
|
||||
<img src='http://www.mozilla.org/images/mozilla-banner.gif'
|
||||
border="0" alt='mozilla.org' href='http://www.mozilla.org/'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
<h1>Leak-o-Matic</h1>
|
||||
</center>
|
||||
|
||||
<p>
|
||||
Welcome to the Marvelous Leak-o-Matic. Listed below are the leak logs
|
||||
that are currently available for your perusal.
|
||||
</p>
|
||||
|
||||
<div align='center'>
|
||||
<table border='0' cellpadding='2' cellspacing='0' bgcolor='#EEEEEE'>
|
||||
<tr><td bgcolor='#DDDDDD' align='center' colspan='3'><b>Leak-o-Matic Logs</b></td></tr>
|
||||
|
||||
};
|
||||
|
||||
# ``ls'' the directory, ``-1r'' returns it sorted by name, reversed, so
|
||||
# the most recent logs will be at the top.
|
||||
|
||||
ZIP: foreach (qx/ls -1r $::logdir\/*.zip/) {
|
||||
chomp;
|
||||
|
||||
next ZIP unless (/(\d\d\d\d)(\d\d)(\d\d)/);
|
||||
|
||||
my ($year, $month, $day) = ($1, $2, $3);
|
||||
|
||||
print "<tr>\n";
|
||||
print "<td>$month/$day/$year</td>\n";
|
||||
print "<td><a href='leaks.cgi?log=$_'>Leaks</a></td>\n";
|
||||
print "<td><a href='bloat-log.cgi?log=$_'>Bloat Log</a></td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print qq{
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
For more information on how to use the Leak-o-Matic, see the
|
||||
|
||||
<a href="instructions.html">instructions</a>.
|
||||
</p>
|
||||
|
||||
};
|
||||
|
||||
print '<small>$Id: logs.cgi,v 1.6.2.1 2000-01-07 03:46:25 waterson%netscape.com Exp $</small>';
|
||||
print $::query->end_html;
|
||||
|
||||
177
mozilla/webtools/leak-o-matic/make-data.pl
Executable file
177
mozilla/webtools/leak-o-matic/make-data.pl
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Leak-o-Matic.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communucations
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Waterson <waterson@netscape.com>
|
||||
#
|
||||
# $Id: make-data.pl,v 1.6 1999-11-18 06:06:28 waterson%netscape.com Exp $
|
||||
#
|
||||
|
||||
#
|
||||
# This script runs the apecified application until it's blue in the
|
||||
# face. First, it runs it to generate a top level ``master bloat''
|
||||
# log, containing a map of all the objects leaked. For each class that
|
||||
# it detects has leaked, it re-runs the app to collect the serial
|
||||
# numbers of the objects leaked. Then for each object, it re-runs the
|
||||
# app to collect a stack trace.
|
||||
#
|
||||
# It creates a ``.zip'' file that is meant to be used with
|
||||
# ``logs.cgi'' and the rest of the Leak-o-Matic CGIs. If the
|
||||
# ``--email'' option is specified, it will mail the ``.zip'' file,
|
||||
# uuencoded, to the specified address. See ``handle-mail.pl'' for a
|
||||
# server-side mail handler.
|
||||
#
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use POSIX "sys_wait_h";
|
||||
|
||||
$::opt_dir = ".";
|
||||
$::opt_app = "mozilla-bin -f bloaturls.txt";
|
||||
$::opt_timeout = 600;
|
||||
|
||||
GetOptions("dir=s", "app=s", "email=s", "timeout=i");
|
||||
|
||||
sub ForkAndWait($$$) {
|
||||
my ($dir, $app, $timeout) = @_;
|
||||
my $pid = fork;
|
||||
|
||||
if ($pid == 0) {
|
||||
open(STDOUT, ">/dev/null");
|
||||
open(STDERR, ">/dev/null");
|
||||
chdir($::opt_dir);
|
||||
exec("$app");
|
||||
# bye!
|
||||
}
|
||||
|
||||
if ($timeout > 0) {
|
||||
while ($timeout--) {
|
||||
sleep 1;
|
||||
my $status = POSIX::waitpid($pid, WNOHANG());
|
||||
return 0 if $status != 0;
|
||||
}
|
||||
|
||||
kill("TERM", $pid);
|
||||
POSIX::waitpid($pid, 0);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
POSIX::waitpid($pid, 0);
|
||||
}
|
||||
|
||||
my $status = $? / 256;
|
||||
if ($status != 0) {
|
||||
die "'$app' terminated abnormally, status == $status";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
# First, just run the browser with the bloat log turned on. From that,
|
||||
# we'll capture all of the leaky classes.
|
||||
|
||||
my $MasterBloatLog = $ENV{"PWD"} . "/master-bloat.log";
|
||||
|
||||
printf("generating top-level class list\n");
|
||||
$ENV{"XPCOM_MEM_BLOAT_LOG"} = $MasterBloatLog;
|
||||
|
||||
ForkAndWait($::opt_dir, $::opt_app, 0);
|
||||
|
||||
# Now parse the bloat log.
|
||||
my @leakyclasses;
|
||||
|
||||
{
|
||||
open(BLOATLOG, $MasterBloatLog);
|
||||
|
||||
LINE: while (<BLOATLOG>) {
|
||||
s/^ +//;
|
||||
next LINE unless /^[0-9]/;
|
||||
|
||||
my ($num, $class, $bytesPerInst, $bytesLeaked,
|
||||
$totalObjects, $remainingObjects)
|
||||
= split(/ +/);
|
||||
|
||||
next LINE unless ($num > 0 && $remainingObjects > 0);
|
||||
|
||||
$leakyclasses[++$#leakyclasses] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
# Iterate through each class that leaked, and find out what objects
|
||||
# have leaked.
|
||||
|
||||
my $BloatLogFile = "/tmp/leak-report-bloat.log";
|
||||
$ENV{"XPCOM_MEM_BLOAT_LOG"} = $BloatLogFile;
|
||||
|
||||
my $class;
|
||||
foreach $class (@leakyclasses) {
|
||||
printf("+ $class\n");
|
||||
|
||||
delete $ENV{"XPCOM_MEM_REFCNT_LOG"};
|
||||
delete $ENV{"XPCOM_MEM_LOG_OBJECTS"};
|
||||
$ENV{"XPCOM_MEM_LOG_CLASSES"} = $class;
|
||||
|
||||
ForkAndWait($::opt_dir, $::opt_app, 0);
|
||||
|
||||
open(BLOATLOG, $BloatLogFile);
|
||||
|
||||
my @leakedobjects;
|
||||
my $serialNumbersHaveStarted = 0;
|
||||
|
||||
LINE: while (<BLOATLOG>) {
|
||||
$serialNumbersHaveStarted = 1
|
||||
if /^Serial Numbers of Leaked Objects:/;
|
||||
|
||||
next LINE unless ($serialNumbersHaveStarted && /^[0-9]/);
|
||||
|
||||
chomp;
|
||||
$leakedobjects[++$#leakedobjects] = $_;
|
||||
}
|
||||
|
||||
# ...and for each object that leaked, generate reference count
|
||||
# stack traces.
|
||||
|
||||
my $object;
|
||||
foreach $object (@leakedobjects) {
|
||||
my $refcntlogfile = $ENV{"PWD"} . "/refcnt-" . $class . "-" . $object . ".log";
|
||||
|
||||
print "|- $refcntlogfile\n";
|
||||
|
||||
$ENV{"XPCOM_MEM_REFCNT_LOG"} = $refcntlogfile;
|
||||
$ENV{"XPCOM_MEM_LOG_OBJECTS"} = $object;
|
||||
|
||||
if (ForkAndWait($::opt_dir, $::opt_app, $::opt_timeout) < 0) {
|
||||
print " * Timed out; discarding.\n";
|
||||
unlink $refcntlogfile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
# Now zip up all of the datafiles into YYYYMMDD.zip
|
||||
my $zipfile = POSIX::strftime("%Y%m%d.zip", localtime(time));
|
||||
system("zip -m $zipfile *.log");
|
||||
|
||||
# ...and mail it off to the server
|
||||
system("cat $zipfile | uuencode $zipfile | mail $::opt_email")
|
||||
if $::opt_email;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user