Bumping manifests a=b2g-bump
[gecko.git] / tools / footprint / win32-gdf.mk
blob59ce28d602062d4cddf551d51b3cd4149be10088
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>
15 # ...
17 # It is also assumed that each measurement corresponds (roughly) to a
18 # URL load.
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"
28 # What You'll Need
29 # ----------------
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
37 # mozilla.org.)
40 # This script computes a line using linear regression; its output is
41 # of the form:
43 # <b1> * x + <b0>
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
52 GNUPLOT=wgnuplot.exe
53 BUSTER_URL=http://btek/cgi-bin/buster.cgi?refresh=10
55 #----------------------------------------------------------------------
56 # Top-level target
58 all: win32-gdf.png
60 #----------------------------------------------------------------------
61 # winEmbed
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; }'`/" \
79 win32.gnuplot.in > $@
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
96 winEmbed.dat: wm.exe
97 cmd /c "start $(PROGRAM_PATH)\\$(WINEMBED_PROGRAM) $(BUSTER_URL) && .\\wm $(WINEMBED_PROGRAM) > $@"
99 mozilla.dat: wm.exe
100 cmd /c "start $(PROGRAM_PATH)\\$(MOZILLA_PROGRAM) $(BUSTER_URL) && .\\wm $(MOZILLA_PROGRAM) > $@"
102 # Build ``wm.exe'', the memory spy
103 wm.exe: wm.cpp
104 cl -Od -Zi wm.cpp advapi32.lib
106 # Clean up the mess.
107 clean:
108 rm -f wm.exe *-gdf.png *.dat *~