aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartekgola@gmail.com>2013-10-16 19:18:05 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-10-16 19:18:05 +0200
commit28a209466f43c22db42dd02baa136ac7ac25069b (patch)
treebd8fc6cdbe9bfc9e2a586ff01b9fadcaecd60560
parent64938011f3ba06a8f425926397172dc361bce851 (diff)
downloadbusybox-w32-28a209466f43c22db42dd02baa136ac7ac25069b.tar.gz
busybox-w32-28a209466f43c22db42dd02baa136ac7ac25069b.tar.bz2
busybox-w32-28a209466f43c22db42dd02baa136ac7ac25069b.zip
bloat-o-meter: add usage info
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--docs/keep_data_small.txt15
-rwxr-xr-xscripts/bloat-o-meter11
2 files changed, 16 insertions, 10 deletions
diff --git a/docs/keep_data_small.txt b/docs/keep_data_small.txt
index 21d732674..9fc799646 100644
--- a/docs/keep_data_small.txt
+++ b/docs/keep_data_small.txt
@@ -138,13 +138,6 @@ less readable, use #defines:
138#define sector (G.sector) 138#define sector (G.sector)
139 139
140 140
141 Word of caution
142
143If applet doesn't use much of global data, converting it to use
144one of above methods is not worth the resulting code obfuscation.
145If you have less than ~300 bytes of global data - don't bother.
146
147
148 Finding non-shared duplicated strings 141 Finding non-shared duplicated strings
149 142
150strings busybox | sort | uniq -c | sort -nr 143strings busybox | sort | uniq -c | sort -nr
@@ -224,6 +217,14 @@ Result (non-static busybox built against glibc):
224 217
225 Keeping code small 218 Keeping code small
226 219
220Use scripts/bloat-o-meter to check whether introduced changes
221didn't generate unnecessary bloat. This script needs unstripped binaries
222to generate a detailed report. To automate this, just use
223"make bloatcheck". It requires busybox_old binary to be present,
224use "make baseline" to generate it from unmodified source, or
225copy busybox_unstripped to busybox_old before modifying sources
226and rebuilding.
227
227Set CONFIG_EXTRA_CFLAGS="-fno-inline-functions-called-once", 228Set CONFIG_EXTRA_CFLAGS="-fno-inline-functions-called-once",
228produce "make bloatcheck", see the biggest auto-inlined functions. 229produce "make bloatcheck", see the biggest auto-inlined functions.
229Now, set CONFIG_EXTRA_CFLAGS back to "", but add NOINLINE 230Now, set CONFIG_EXTRA_CFLAGS back to "", but add NOINLINE
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 6db2a5e58..cb861b8e9 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -7,11 +7,14 @@
7# This software may be used and distributed according to the terms 7# This software may be used and distributed according to the terms
8# of the GNU General Public License, incorporated herein by reference. 8# of the GNU General Public License, incorporated herein by reference.
9 9
10import sys, os#, re 10import sys, os
11 11
12def usage(): 12def usage():
13 sys.stderr.write("usage: %s [-t] file1 file2\n" % sys.argv[0]) 13 sys.stderr.write("usage: %s [-t] file1 file2 [-- <readelf options>]\n"
14 sys.exit(-1) 14 % sys.argv[0])
15 sys.stderr.write("\t-t\tShow time spent on parsing/processing\n")
16 sys.stderr.write("\t--\tPass additional parameters to readelf\n")
17 sys.exit(1)
15 18
16f1, f2 = (None, None) 19f1, f2 = (None, None)
17flag_timing, dashes = (False, False) 20flag_timing, dashes = (False, False)
@@ -31,6 +34,8 @@ for f in sys.argv[1:]:
31 f1 = f 34 f1 = f
32 elif f2 is None: 35 elif f2 is None:
33 f2 = f 36 f2 = f
37 else:
38 usage()
34if flag_timing: 39if flag_timing:
35 import time 40 import time
36if f1 is None or f2 is None: 41if f1 is None or f2 is None: