1 # -*- Mode: Makefile -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is Makefile, released
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 2000
22 # the Initial Developer. All Rights Reserved.
25 # Chris Waterson <waterson@netscape.com>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
41 # This makefile will run Mozilla (or the program you specify), observe
42 # the program's memory status using the /proc filesystem, and generate
43 # a ``gross dynamic footprint'' graph using gnuplot.
47 # make MOZILLA_DIR=<mozilla-dir> PROGRAM=<program> URL=<url>
51 # make -flinux-gdf.mk \
52 # MOZILLA_DIR=/export2/waterson/seamonkey-opt/mozilla/dist/bin \
54 # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10"
56 # To use this program, you'll need to:
58 # 1. Install gnuplot, e.g., using your RedHat distro.
59 # 2. Install the "buster.cgi" script onto a webserver somewhere
60 # 3. Have a mozilla build.
62 # You can tweak ``linux.gnuplot.in'' to change the graph's output.
64 # This script computes a line using linear regression; its output is
69 # Where <b1> is the slope and <b0> is the y-intercept.
70 LINEAR_REGRESSION
=awk
-f linear-regression.awk Skip
=5
75 MOZILLA_DIR
=..
/..
/dist/bin
77 BUSTER_URL
=http
://localhost
/cgi-bin
/buster.cgi?refresh
=$(INTERVAL
)
80 #----------------------------------------------------------------------
85 #----------------------------------------------------------------------
89 .INTERMEDIATE
: linux.gnuplot vms.dat vmd.dat vmx.dat rss.dat
91 # Create a PNG image using the generated ``linux.gnuplot'' script
92 gdf.png
: vms.dat vmd.dat vmx.dat rss.dat linux.gnuplot
95 # Generate a ``gnuplot'' script from ``linux.gnuplot.in'', making
96 # appropriate substitutions as necessary.
97 linux.gnuplot
: linux.gnuplot.in vms.dat
98 sed
-e
"s/@PROGRAM@/$(PROGRAM)/" \
99 -e
"s/@VMS-LINE@/`$(LINEAR_REGRESSION) vms.dat`/" \
100 -e
"s/@GROWTH-RATE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ printf \"%0.1lf\\n\", $$1; }'`/" \
101 -e
"s/@BASE-SIZE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ print $$5 + 2000; }'`/" \
102 linux.gnuplot.in
> linux.gnuplot
104 # Break the raw data file into temporary files that can be processed
105 # by gnuplot directly.
107 awk
-f create_dat.awk TYPE
=vms
$?
> $@
110 awk
-f create_dat.awk TYPE
=vmd
$?
> $@
113 awk
-f create_dat.awk TYPE
=vmx
$?
> $@
116 awk
-f create_dat.awk TYPE
=rss
$?
> $@
118 # Run $(PROGRAM) to produce $(OUTFILE)
120 LD_LIBRARY_PATH
=$(MOZILLA_DIR
) \
121 MOZILLA_FIVE_HOME
=$(MOZILLA_DIR
) \
122 $(WATCH
) -i
$(INTERVAL
) -o
$@
$(MOZILLA_DIR
)/$(PROGRAM
) "$(BUSTER_URL)"
126 rm -f
$(OUTFILE
) gdf.png
*~