This commit is contained in:
waterson%netscape.com 2000-11-13 23:36:59 +00:00
Родитель cc36a0ef36
Коммит 132e58e8ec
7 изменённых файлов: 562 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,2 @@
linux.dat
gdf.png

119
tools/footprint/Makefile Normal file
Просмотреть файл

@ -0,0 +1,119 @@
# -*- Mode: Makefile -*-
#
# 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 oqr
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Makefile, released November 13, 2000.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Chris Waterson <waterson@netscape.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
#
#
# This makefile will run Mozilla (or the program you specify), observe
# the program's memory status using the /proc filesystem, and generate
# a ``gross dynamic footprint'' graph using gnuplot.
#
# Usage:
#
# make MOZILLA_DIR=<mozilla-dir> PROGRAM=<program> URL=<url>
#
# e.g.,
#
# make MOZILLA_DIR=/export2/waterson/seamonkey-opt/mozilla/dist/bin \
# PROGRAM=gtkEmbed \
# URL="http://localhost/cgi-bin/buster.cgi?refresh=10"
#
# To use this program, you'll need to:
#
# 1. Install gnuplot, e.g., using your RedHat distro.
# 2. Install the "buster.cgi" script onto a webserver somewhere
# 3. Have a mozilla build.
#
# You can tweak ``linux.gnuplot.in'' to change the graph's output.
# This script computes a line using linear regression; it's output is
# of the form:
#
# <b1> * x + <b0>
#
# Where <b1> is the slope and <b0> is the y-intercept.
LINEAR_REGRESSION=awk -f linear-regression.awk
WATCH=watch.sh
MOZILLA_DIR=../../dist/bin
PROGRAM=mozilla-bin
BUSTER_URL=http://localhost/cgi-bin/buster.cgi?refresh=10
#----------------------------------------------------------------------
# Top-level target
#
all: gdf.png
#----------------------------------------------------------------------
# gtkEmbed
#
.INTERMEDIATE: linux.gnuplot vms.dat vmd.dat vml.dat rss.dat
# Create a PNG image using the generated ``linux.gnuplot'' script
gdf.png: vms.dat vmd.dat vml.dat rss.dat linux.gnuplot
gnuplot linux.gnuplot
# Generate a ``gnuplot'' script from ``linux.gnuplot.in'', making
# appropriate substitutions as necessary.
linux.gnuplot: linux.gnuplot.in vms.dat
sed -e "s/@PROGRAM@/$(PROGRAM)/" \
-e "s/@VMS-LINE@/`$(LINEAR_REGRESSION) vms.dat`/" \
-e "s/@GROWTH-RATE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ printf \"%0.1lf\\n\", $$1; }'`/" \
-e "s/@BASE-SIZE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ print $$5; }'`/" \
linux.gnuplot.in > linux.gnuplot
# Break the raw data file into temporary files that can be processed
# by gnuplot directly.
vms.dat: linux.dat
awk '{ print NR, $$1; }' $? > $@
vmd.dat: linux.dat
awk '{ print NR, $$2; }' $? > $@
vml.dat: linux.dat
awk '{ print NR, $$3; }' $? > $@
rss.dat: linux.dat
awk '{ print NR, $$4; }' $? > $@
# Run $(PROGRAM) to produce linux.dat
linux.dat:
LD_LIBRARY_PATH=$(MOZILLA_DIR) \
MOZILLA_FIVE_HOME=$(MOZILLA_DIR) \
$(WATCH) -o $@ $(MOZILLA_DIR)/$(PROGRAM) "$(BUSTER_URL)"
# Clean up the mess.
clean:
rm -f linux.dat gdf.png *~

144
tools/footprint/buster.cgi Executable file
Просмотреть файл

@ -0,0 +1,144 @@
#!/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 oqr
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is buster.cgi, released November 13, 2000.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Chris Waterson <waterson@netscape.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
#
#
# This is a modified version of Chris Hofmann's <chofmann@netscape.com>
# infamous "browser buster" test harness. It's a bit simpler (CGI
# instead of using cookies; IFRAME instead of FRAMESET), and has some
# extra parameters that make it a bit easier to test with, but it's
# pretty faithful otherwise.
#
# It accepts a couple of parameters, including
#
# file=<filename> Set this to the name of the file containing
# the URLs that you want the buster to cycle through. This
# might be a security hole, so don't run this script on a
# server with s3kret stuff on it, mmkay?
#
# page=<number> This is used to maintain state, and is the line
# number in the file that the buster will pull up in the
# IFRAME. Set if by hand if you need to for some reason.
#
# last=<number> The buster will run until it's exhausted all
# the URLs in the file, or until it reaches this line in the
# file; e.g., setting it to "5" will load five URLs.
#
# refresh=<number> The timeout (in seconds) to wait before doing
# a page refresh, and thus loading the next URL. Defaults to
# thirty.
#
use CGI;
# Find the page'th URL in the file with the specified name
sub FindURL($$)
{
my ($file, $page) = @_;
open URLS, $file
|| die("can't open $::File");
LINE: while (<URLS>) {
next LINE if /^#/;
last LINE unless --$page;
}
close URLS;
chomp;
return $_;
}
# Scrape parameters
$::Query = new CGI;
$::File = $::Query->param("file");
$::File = "top100.txt" unless $::File;
$::Page = $::Query->param("page");
$::Page = 0 unless $::Page;
$::URL = FindURL($::File, ++$::Page);
$::Last = $::Query->param("last");
$::Last = -1 unless $::Last;
$::Refresh = $::Query->param("refresh");
$::Refresh = 30 unless $::Refresh;
# Header
print qq{Content-type: text/html
<html>
<head>
};
# Meat
if ($::URL && ($::Page <= $::Last || $::Last == -1)) {
# Make a web page that'll load $::URL in an IFRAME, with
# a meta-refresh that'll reload us again in short order.
print qq{<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="refresh" content="$::Refresh;url=buster.cgi?file=$::File&page=$::Page&last=$::Last&refresh=$::Refresh">
<title>BrowserBuster II: $::URL</title>
<style type="text/css">
body {
overflow: hidden;
border: 0;
margin: 0;
}
</style>
</head>
<body>
};
print "$::File: $::URL";
if ($::Last != -1) {
print " ($::Page of $::Last)<br>";
}
print qq{
<iframe width="100%" height="100%" src="$::URL">
};
}
else {
# Make a web page that'll close the current browser
# window, terminating the test app.
print qq{<head>
<title>BrowserBuster II: Done!</title>
<body onload="window.close();">
All done!
};
}
# Footer
print qq{</body>
</html>
};

Просмотреть файл

@ -0,0 +1,40 @@
# 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 oqr
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is linear-regression.awk, released November 13, 2000.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Chris Waterson <waterson@netscape.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
{
sx += $1;
sy += $2;
sxy += $1 * $2;
sx2 += $1 * $1; }
END {
b1 = (NR * sxy - sx * sy) / (NR * sx2 - sx * sx);
b0 = (sy - b1 * sx ) / NR;
print b1, "* x +", b0; }

Просмотреть файл

@ -0,0 +1,43 @@
# 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 oqr
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is linux.gnuplot.in, released November 13, 2000.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Chris Waterson <waterson@netscape.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
set term png color
set output 'gdf.png'
set title '@PROGRAM@ - Gross Dynamic Footprint'
set xlabel 'URLs'
set ylabel 'KB'
set key top left
set label '@GROWTH-RATE@KB/URL' at 5, @BASE-SIZE@
plot 'vms.dat' title 'Total VM Size' with point 1,\
@VMS-LINE@ notitle with line 1,\
'vmd.dat' title 'Data Size' with line 3,\
'vml.dat' title 'Code Size' with line 5,\
'rss.dat' title 'Resident Set Size' with line 7

136
tools/footprint/top100.txt Normal file
Просмотреть файл

@ -0,0 +1,136 @@
# These are the "Top 100" from chofmann's list
http://www.yahoo.com
http://www.netscape.com
http://www.microsoft.com
http://www.excite.com
http://www.mckinley.com
http://www.city.net
http://www.webcrawler.com
http://www.mirabilis.com
http://www.infoseek.com
http://www.pathfinder.com
http://www.warnerbros.com
http://www.webmd.com
http://www.altavista.digital.com
http://www.altavista.com
http://www.usatoday.com
http://www.mysap.com
http://www.starwave.com
http://www.hotwired.com
http://www.statmarket.com
http://www.lycos.com
http://espn.go.com
http://www.cnet.com
http://www.search.com
http://www.news.com
http://www.download.com
http://www.geocities.com
http://www.shockwave.com
http://www.bn.com
http://www.imdb.com
http://uk.imdb.com
http://www.macromedia.com
http://www.infobeat.com
http://www.fxweb.com
http://www.whowhere.com
http://www.real.com
http://www.sportsline.com
http://www.dejanews.com
http://www.the-park.com
http://www.cmpnet.com
http://www.go2net.com
http://www.metacrawler.com
http://www.playsite.com
http://www.stocksite.com
http://www.ameritrade.com
http://www.zone.com
http://www.nyse.com
http://www.economist.com
http://www.infospace.com
http://www.zdnet.com
http://www.hotfiles.com
http://www.chathouse.com
http://www.looksmart.com
http://www.hotjobs.com
http://www.macaddict.com
http://www.benews.com
http://www.apple.com
http://www.beseen.com
http://www.dogpile.com
http://www.xoom.com
http://www.tucows.com
http://www.freethemes.com
http://www.winfiles.com
http://www.vservers.com
http://www.mtv.com
http://www.the-xfiles.com
http://www.autoworld.com
http://www.monster.com
http://www.surplusdirect.com
http://www.tomshardware.com
http://www.bigyellow.com
http://www.100hot.com
http://www.messagemates.com
http://www.onelist.com
http://www.bluemountain.com
http://www.ea.com
http://www.bullfrog.co.uk
http://www.travelocity.com
http://www.pbs.com
http://www.bigcharts.com
http://www.davesclassics.com
http://www.goto.com
http://www.weather.com
http://www.gamespot.com
http://www.bloomberg.com
http://www.winzip.com
http://www.filez.com
http://www.browserwatch.com
http://www.internet.com
http://www.cardmaster.com
http://www.creaf.com
http://netaddress.usa.net
http://www.occ.com
http://www.as.org
http://www.amazon.com
http://www.drudgereport.com
http://www.hardradio.com
http://www.intel.com
http://www.mp3.com
http://www.ebay.com
http://www.msn.com
http://www.fifa.com
http://www.attitude.com
http://www.happypuppy.com
http://www.gamesdomain.com
http://www.onsale.com
http://www.tm.com
http://www.xlnc1.com
http://www.greatsports.com
http://www.discovery.com
http://www.nai.com
http://www.nasa.gov
http://www.os2ss.com
http://www.warzone.com
http://www.gamestats.com
http://www.winamp.com
http://java.sun.com
http://www.hp.com
http://www.cdnow.com
http://www.nytimes.com
http://www.majorleaguebaseball.com
http://www.thestreet.com
http://www.planetquake.com
http://www.cnbc.com
http://www.slashdot.org
http://www.adobe.com
http://www.quicken.com
http://www.developer.com
http://www.mapquest.com
http://www.freshmeat.net
http://www.bxa.doc.gov/Encryption/regs.htm
http://www.rewards2k.com
http://www.cnnfn.com
http://www.blockbuster.com
http://www.richinstyle.com/
http://www.xml.com

78
tools/footprint/watch.sh Executable file
Просмотреть файл

@ -0,0 +1,78 @@
#!/bin/sh
#
# 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 oqr
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is linux.gnuplot.in, released November 13, 2000.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Chris Waterson <waterson@netscape.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
#
#
# Treats the arguments as a command that is to be forked and observed;
# e.g.,
#
# watch.sh ./mozilla -f bloaturls.txt
#
# Periodically snap-shots the virtual memory info of the process, and
# dumps the output to ``watch.out''
#
# Clear the output file
OUTPUT_FILE=watch.out
INTERVAL=10
while [ $# -gt 0 ]; do
case "$1" in
-o) OUTPUT_FILE=$2
shift 2
;;
-i) INTERVAL=$2
shift 2
;;
*) break
;;
esac
done
rm -f ${OUTPUT_FILE}
# treat the arguments as the command to execute
$* &
# remember the process ID
PID=$!
while [ -e /proc/${PID} ]; do
cat /proc/${PID}/status |\
awk '$1=="VmSize:" { vmsize = $2; }
$1=="VmData:" { vmdata = $2; }
$1=="VmLib:" { vmlib = $2; }
$1=="VmRSS:" { vmrss = $2; }
END { print vmsize, vmdata, vmlib, vmrss; }' >> ${OUTPUT_FILE}
sleep ${INTERVAL}
done