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 takes raw data files named ``winEmbed.dat'' and
8 # ``mozilla.dat'' produces a graph that shows memory usage and peak
9 # memory usage versus number of URLs loaded.
11 # The data files are assumed to be of the form:
13 # <working-set-size-1> <peak-working-set-size-1>
14 # <working-set-size-2> <peak-working-set-size-2>
17 # It is also assumed that each measurement corresponds (roughly) to a
20 # You can tweak ``win32.gnuplot.in'' to change the graph's output.
22 # You should use this with ``make --unix'' (which will use
23 # sh.exe instead of cmd.exe to process commands); e.g.,
25 # make --unix -f win32-gdf.mk \
26 # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10"
31 # . Get gnuplot for Win32 from
33 # ftp://ftp.dartmouth.edu/pub/gnuplot/gnuplot3.7cyg.zip
35 # . The "standard" cygwin tools that you probably already have. (If
36 # you don't have 'em, see the Win32 build instructions on
40 # This script computes a line using linear regression; its output is
45 # Where <b1> is the slope and <b0> is the y-intercept.
46 LINEAR_REGRESSION
=awk
-f linear-regression.awk
48 PROGRAM_PATH
=..
\\..
\\dist\\win32_o.obj
\\bin
49 WINEMBED_PROGRAM
=winEmbed
50 MOZILLA_PROGRAM
=mozilla
53 BUSTER_URL
=http
://btek
/cgi-bin
/buster.cgi?refresh
=10
55 #----------------------------------------------------------------------
60 #----------------------------------------------------------------------
64 .INTERMEDIATE
: winEmbed-ws.dat winEmbed-pws.dat mozilla-ws.dat mozilla-pws.dat win32.gnuplot
66 # Create a PNG image using the generated ``win32.gnuplot'' script
67 win32-gdf.png
: winEmbed-ws.dat winEmbed-pws.dat mozilla-ws.dat mozilla-pws.dat win32.gnuplot
68 $(GNUPLOT
) win32.gnuplot
70 # Generate a ``gnuplot'' script from ``win32.gnuplot.in'', making
71 # appropriate substitutions as necessary.
72 win32.gnuplot
: win32.gnuplot.in winEmbed-ws.dat mozilla-ws.dat
73 sed
-e
"s/@WINEMBED-WS-LINE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat`/" \
74 -e
"s/@WINEMBED-GROWTH-RATE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat | awk '{ printf \"%0.1f\n\", $$1; }'`/" \
75 -e
"s/@WINEMBED-BASE-SIZE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat | awk '{ print $$5; }'`/" \
76 -e
"s/@MOZILLA-WS-LINE@/`$(LINEAR_REGRESSION) mozilla-ws.dat`/" \
77 -e
"s/@MOZILLA-GROWTH-RATE@/`$(LINEAR_REGRESSION) mozilla-ws.dat | awk '{ printf \"%0.1f\n\", $$1; }'`/" \
78 -e
"s/@MOZILLA-BASE-SIZE@/`$(LINEAR_REGRESSION) mozilla-ws.dat | awk '{ print $$5; }'`/" \
81 # Break the raw data file into temporary files that can be processed
82 # by gnuplot directly.
83 winEmbed-ws.dat
: winEmbed.dat
84 awk
'{ print NR, $$1 / 1024; }' $?
> $@
86 winEmbed-pws.dat
: winEmbed.dat
87 awk
'{ print NR, $$2 / 1024; }' $?
> $@
89 mozilla-ws.dat
: mozilla.dat
90 awk
'{ print NR, $$1 / 1024; }' $?
> $@
92 mozilla-pws.dat
: mozilla.dat
93 awk
'{ print NR, $$2 / 1024; }' $?
> $@
95 # Run programs to collect data
97 cmd
/c
"start $(PROGRAM_PATH)\\$(WINEMBED_PROGRAM) $(BUSTER_URL) && .\\wm $(WINEMBED_PROGRAM) > $@"
100 cmd
/c
"start $(PROGRAM_PATH)\\$(MOZILLA_PROGRAM) $(BUSTER_URL) && .\\wm $(MOZILLA_PROGRAM) > $@"
102 # Build ``wm.exe'', the memory spy
104 cl
-Od
-Zi wm.
cpp advapi32.lib
108 rm -f wm.exe
*-gdf.png
*.dat
*~