michael@0: # -*- Mode: Makefile -*- michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # This makefile takes raw data files named ``winEmbed.dat'' and michael@0: # ``mozilla.dat'' produces a graph that shows memory usage and peak michael@0: # memory usage versus number of URLs loaded. michael@0: # michael@0: # The data files are assumed to be of the form: michael@0: # michael@0: # michael@0: # michael@0: # ... michael@0: # michael@0: # It is also assumed that each measurement corresponds (roughly) to a michael@0: # URL load. michael@0: # michael@0: # You can tweak ``win32.gnuplot.in'' to change the graph's output. michael@0: # michael@0: # You should use this with ``make --unix'' (which will use michael@0: # sh.exe instead of cmd.exe to process commands); e.g., michael@0: # michael@0: # make --unix -f win32-gdf.mk \ michael@0: # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10" michael@0: # michael@0: # What You'll Need michael@0: # ---------------- michael@0: # michael@0: # . Get gnuplot for Win32 from michael@0: # michael@0: # ftp://ftp.dartmouth.edu/pub/gnuplot/gnuplot3.7cyg.zip michael@0: # michael@0: # . The "standard" cygwin tools that you probably already have. (If michael@0: # you don't have 'em, see the Win32 build instructions on michael@0: # mozilla.org.) michael@0: # michael@0: michael@0: # This script computes a line using linear regression; its output is michael@0: # of the form: michael@0: # michael@0: # * x + michael@0: # michael@0: # Where is the slope and is the y-intercept. michael@0: LINEAR_REGRESSION=awk -f linear-regression.awk michael@0: michael@0: PROGRAM_PATH=..\\..\\dist\\win32_o.obj\\bin michael@0: WINEMBED_PROGRAM=winEmbed michael@0: MOZILLA_PROGRAM=mozilla michael@0: michael@0: GNUPLOT=wgnuplot.exe michael@0: BUSTER_URL=http://btek/cgi-bin/buster.cgi?refresh=10 michael@0: michael@0: #---------------------------------------------------------------------- michael@0: # Top-level target michael@0: # michael@0: all: win32-gdf.png michael@0: michael@0: #---------------------------------------------------------------------- michael@0: # winEmbed michael@0: # michael@0: michael@0: .INTERMEDIATE: winEmbed-ws.dat winEmbed-pws.dat mozilla-ws.dat mozilla-pws.dat win32.gnuplot michael@0: michael@0: # Create a PNG image using the generated ``win32.gnuplot'' script michael@0: win32-gdf.png: winEmbed-ws.dat winEmbed-pws.dat mozilla-ws.dat mozilla-pws.dat win32.gnuplot michael@0: $(GNUPLOT) win32.gnuplot michael@0: michael@0: # Generate a ``gnuplot'' script from ``win32.gnuplot.in'', making michael@0: # appropriate substitutions as necessary. michael@0: win32.gnuplot: win32.gnuplot.in winEmbed-ws.dat mozilla-ws.dat michael@0: sed -e "s/@WINEMBED-WS-LINE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat`/" \ michael@0: -e "s/@WINEMBED-GROWTH-RATE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat | awk '{ printf \"%0.1f\n\", $$1; }'`/" \ michael@0: -e "s/@WINEMBED-BASE-SIZE@/`$(LINEAR_REGRESSION) winEmbed-ws.dat | awk '{ print $$5; }'`/" \ michael@0: -e "s/@MOZILLA-WS-LINE@/`$(LINEAR_REGRESSION) mozilla-ws.dat`/" \ michael@0: -e "s/@MOZILLA-GROWTH-RATE@/`$(LINEAR_REGRESSION) mozilla-ws.dat | awk '{ printf \"%0.1f\n\", $$1; }'`/" \ michael@0: -e "s/@MOZILLA-BASE-SIZE@/`$(LINEAR_REGRESSION) mozilla-ws.dat | awk '{ print $$5; }'`/" \ michael@0: win32.gnuplot.in > $@ michael@0: michael@0: # Break the raw data file into temporary files that can be processed michael@0: # by gnuplot directly. michael@0: winEmbed-ws.dat: winEmbed.dat michael@0: awk '{ print NR, $$1 / 1024; }' $? > $@ michael@0: michael@0: winEmbed-pws.dat: winEmbed.dat michael@0: awk '{ print NR, $$2 / 1024; }' $? > $@ michael@0: michael@0: mozilla-ws.dat: mozilla.dat michael@0: awk '{ print NR, $$1 / 1024; }' $? > $@ michael@0: michael@0: mozilla-pws.dat: mozilla.dat michael@0: awk '{ print NR, $$2 / 1024; }' $? > $@ michael@0: michael@0: # Run programs to collect data michael@0: winEmbed.dat: wm.exe michael@0: cmd /c "start $(PROGRAM_PATH)\\$(WINEMBED_PROGRAM) $(BUSTER_URL) && .\\wm $(WINEMBED_PROGRAM) > $@" michael@0: michael@0: mozilla.dat: wm.exe michael@0: cmd /c "start $(PROGRAM_PATH)\\$(MOZILLA_PROGRAM) $(BUSTER_URL) && .\\wm $(MOZILLA_PROGRAM) > $@" michael@0: michael@0: # Build ``wm.exe'', the memory spy michael@0: wm.exe: wm.cpp michael@0: cl -Od -Zi wm.cpp advapi32.lib michael@0: michael@0: # Clean up the mess. michael@0: clean: michael@0: rm -f wm.exe *-gdf.png *.dat *~ michael@0: