Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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/.
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.
10 #
11 # Usage:
12 #
13 # make MOZILLA_DIR=<mozilla-dir> PROGRAM=<program> URL=<url>
14 #
15 # e.g.,
16 #
17 # make -flinux-gdf.mk \
18 # MOZILLA_DIR=/export2/waterson/seamonkey-opt/mozilla/dist/bin \
19 # PROGRAM=gtkEmbed \
20 # BUSTER_URL="http://localhost/cgi-bin/buster.cgi?refresh=10"
21 #
22 # To use this program, you'll need to:
23 #
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.
27 #
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
31 # of the form:
32 #
33 # <b1> * x + <b0>
34 #
35 # Where <b1> is the slope and <b0> is the y-intercept.
36 LINEAR_REGRESSION=awk -f linear-regression.awk Skip=5
38 INTERVAL=10
39 WATCH=./watch.sh
41 MOZILLA_DIR=../../dist/bin
42 PROGRAM=gtkEmbed
43 BUSTER_URL=http://localhost/cgi-bin/buster.cgi?refresh=$(INTERVAL)
44 OUTFILE=linux.dat
46 #----------------------------------------------------------------------
47 # Top-level target
48 #
49 all: gdf.png
51 #----------------------------------------------------------------------
52 # gtkEmbed
53 #
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
59 gnuplot 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.
72 vms.dat: $(OUTFILE)
73 awk -f create_dat.awk TYPE=vms $? > $@
75 vmd.dat: $(OUTFILE)
76 awk -f create_dat.awk TYPE=vmd $? > $@
78 vmx.dat: $(OUTFILE)
79 awk -f create_dat.awk TYPE=vmx $? > $@
81 rss.dat: $(OUTFILE)
82 awk -f create_dat.awk TYPE=rss $? > $@
84 # Run $(PROGRAM) to produce $(OUTFILE)
85 $(OUTFILE):
86 LD_LIBRARY_PATH=$(MOZILLA_DIR) \
87 MOZILLA_FIVE_HOME=$(MOZILLA_DIR) \
88 $(WATCH) -i $(INTERVAL) -o $@ $(MOZILLA_DIR)/$(PROGRAM) "$(BUSTER_URL)"
90 # Clean up the mess.
91 clean:
92 rm -f $(OUTFILE) gdf.png *~