1 # -*- Mode: Makefile -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # This makefile will run Mozilla (or the program you specify), observe
8 # the program's memory status using the /proc filesystem, and generate
9 # a ``gross dynamic footprint'' graph using gnuplot.
13 # make MOZILLA_DIR=<mozilla-dir> PROGRAM=<program> URL=<url>
17 # make -flinux-gdf.mk \
18 # MOZILLA_DIR=/export2/waterson/seamonkey-opt/mozilla/dist/bin \
20 # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10"
22 # To use this program, you'll need to:
24 # 1. Install gnuplot, e.g., using your RedHat distro.
25 # 2. Install the "buster.cgi" script onto a webserver somewhere
26 # 3. Have a mozilla build.
28 # You can tweak ``linux.gnuplot.in'' to change the graph's output.
30 # This script computes a line using linear regression; its output is
35 # Where <b1> is the slope and <b0> is the y-intercept.
36 LINEAR_REGRESSION
=awk
-f linear-regression.awk Skip
=5
41 MOZILLA_DIR
=..
/..
/dist/bin
43 BUSTER_URL
=http
://localhost
/cgi-bin
/buster.cgi?refresh
=$(INTERVAL
)
46 #----------------------------------------------------------------------
51 #----------------------------------------------------------------------
55 .INTERMEDIATE
: linux.gnuplot vms.dat vmd.dat vmx.dat rss.dat
57 # Create a PNG image using the generated ``linux.gnuplot'' script
58 gdf.png
: vms.dat vmd.dat vmx.dat rss.dat linux.gnuplot
61 # Generate a ``gnuplot'' script from ``linux.gnuplot.in'', making
62 # appropriate substitutions as necessary.
63 linux.gnuplot
: linux.gnuplot.in vms.dat
64 sed
-e
"s/@PROGRAM@/$(PROGRAM)/" \
65 -e
"s/@VMS-LINE@/`$(LINEAR_REGRESSION) vms.dat`/" \
66 -e
"s/@GROWTH-RATE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ printf \"%0.1lf\\n\", $$1; }'`/" \
67 -e
"s/@BASE-SIZE@/`$(LINEAR_REGRESSION) vms.dat | awk '{ print $$5 + 2000; }'`/" \
68 linux.gnuplot.in
> linux.gnuplot
70 # Break the raw data file into temporary files that can be processed
71 # by gnuplot directly.
73 awk
-f create_dat.awk TYPE
=vms
$?
> $@
76 awk
-f create_dat.awk TYPE
=vmd
$?
> $@
79 awk
-f create_dat.awk TYPE
=vmx
$?
> $@
82 awk
-f create_dat.awk TYPE
=rss
$?
> $@
84 # Run $(PROGRAM) to produce $(OUTFILE)
86 LD_LIBRARY_PATH
=$(MOZILLA_DIR
) \
87 MOZILLA_FIVE_HOME
=$(MOZILLA_DIR
) \
88 $(WATCH
) -i
$(INTERVAL
) -o
$@
$(MOZILLA_DIR
)/$(PROGRAM
) "$(BUSTER_URL)"
92 rm -f
$(OUTFILE
) gdf.png
*~