|
1 # -*- Mode: Makefile -*- |
|
2 # |
|
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/. |
|
6 |
|
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. |
|
10 # |
|
11 # The data files are assumed to be of the form: |
|
12 # |
|
13 # <working-set-size-1> <peak-working-set-size-1> |
|
14 # <working-set-size-2> <peak-working-set-size-2> |
|
15 # ... |
|
16 # |
|
17 # It is also assumed that each measurement corresponds (roughly) to a |
|
18 # URL load. |
|
19 # |
|
20 # You can tweak ``win32.gnuplot.in'' to change the graph's output. |
|
21 # |
|
22 # You should use this with ``make --unix'' (which will use |
|
23 # sh.exe instead of cmd.exe to process commands); e.g., |
|
24 # |
|
25 # make --unix -f win32-gdf.mk \ |
|
26 # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10" |
|
27 # |
|
28 # What You'll Need |
|
29 # ---------------- |
|
30 # |
|
31 # . Get gnuplot for Win32 from |
|
32 # |
|
33 # ftp://ftp.dartmouth.edu/pub/gnuplot/gnuplot3.7cyg.zip |
|
34 # |
|
35 # . The "standard" cygwin tools that you probably already have. (If |
|
36 # you don't have 'em, see the Win32 build instructions on |
|
37 # mozilla.org.) |
|
38 # |
|
39 |
|
40 # This script computes a line using linear regression; its output is |
|
41 # of the form: |
|
42 # |
|
43 # <b1> * x + <b0> |
|
44 # |
|
45 # Where <b1> is the slope and <b0> is the y-intercept. |
|
46 LINEAR_REGRESSION=awk -f linear-regression.awk |
|
47 |
|
48 PROGRAM_PATH=..\\..\\dist\\win32_o.obj\\bin |
|
49 WINEMBED_PROGRAM=winEmbed |
|
50 MOZILLA_PROGRAM=mozilla |
|
51 |
|
52 GNUPLOT=wgnuplot.exe |
|
53 BUSTER_URL=http://btek/cgi-bin/buster.cgi?refresh=10 |
|
54 |
|
55 #---------------------------------------------------------------------- |
|
56 # Top-level target |
|
57 # |
|
58 all: win32-gdf.png |
|
59 |
|
60 #---------------------------------------------------------------------- |
|
61 # winEmbed |
|
62 # |
|
63 |
|
64 .INTERMEDIATE: winEmbed-ws.dat winEmbed-pws.dat mozilla-ws.dat mozilla-pws.dat win32.gnuplot |
|
65 |
|
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 |
|
69 |
|
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; }'`/" \ |
|
79 win32.gnuplot.in > $@ |
|
80 |
|
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; }' $? > $@ |
|
85 |
|
86 winEmbed-pws.dat: winEmbed.dat |
|
87 awk '{ print NR, $$2 / 1024; }' $? > $@ |
|
88 |
|
89 mozilla-ws.dat: mozilla.dat |
|
90 awk '{ print NR, $$1 / 1024; }' $? > $@ |
|
91 |
|
92 mozilla-pws.dat: mozilla.dat |
|
93 awk '{ print NR, $$2 / 1024; }' $? > $@ |
|
94 |
|
95 # Run programs to collect data |
|
96 winEmbed.dat: wm.exe |
|
97 cmd /c "start $(PROGRAM_PATH)\\$(WINEMBED_PROGRAM) $(BUSTER_URL) && .\\wm $(WINEMBED_PROGRAM) > $@" |
|
98 |
|
99 mozilla.dat: wm.exe |
|
100 cmd /c "start $(PROGRAM_PATH)\\$(MOZILLA_PROGRAM) $(BUSTER_URL) && .\\wm $(MOZILLA_PROGRAM) > $@" |
|
101 |
|
102 # Build ``wm.exe'', the memory spy |
|
103 wm.exe: wm.cpp |
|
104 cl -Od -Zi wm.cpp advapi32.lib |
|
105 |
|
106 # Clean up the mess. |
|
107 clean: |
|
108 rm -f wm.exe *-gdf.png *.dat *~ |
|
109 |