bloat-o-meter: add usage info
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
64938011f3
commit
28a209466f
@ -138,13 +138,6 @@ less readable, use #defines:
|
|||||||
#define sector (G.sector)
|
#define sector (G.sector)
|
||||||
|
|
||||||
|
|
||||||
Word of caution
|
|
||||||
|
|
||||||
If applet doesn't use much of global data, converting it to use
|
|
||||||
one of above methods is not worth the resulting code obfuscation.
|
|
||||||
If you have less than ~300 bytes of global data - don't bother.
|
|
||||||
|
|
||||||
|
|
||||||
Finding non-shared duplicated strings
|
Finding non-shared duplicated strings
|
||||||
|
|
||||||
strings busybox | sort | uniq -c | sort -nr
|
strings busybox | sort | uniq -c | sort -nr
|
||||||
@ -224,6 +217,14 @@ Result (non-static busybox built against glibc):
|
|||||||
|
|
||||||
Keeping code small
|
Keeping code small
|
||||||
|
|
||||||
|
Use scripts/bloat-o-meter to check whether introduced changes
|
||||||
|
didn't generate unnecessary bloat. This script needs unstripped binaries
|
||||||
|
to generate a detailed report. To automate this, just use
|
||||||
|
"make bloatcheck". It requires busybox_old binary to be present,
|
||||||
|
use "make baseline" to generate it from unmodified source, or
|
||||||
|
copy busybox_unstripped to busybox_old before modifying sources
|
||||||
|
and rebuilding.
|
||||||
|
|
||||||
Set CONFIG_EXTRA_CFLAGS="-fno-inline-functions-called-once",
|
Set CONFIG_EXTRA_CFLAGS="-fno-inline-functions-called-once",
|
||||||
produce "make bloatcheck", see the biggest auto-inlined functions.
|
produce "make bloatcheck", see the biggest auto-inlined functions.
|
||||||
Now, set CONFIG_EXTRA_CFLAGS back to "", but add NOINLINE
|
Now, set CONFIG_EXTRA_CFLAGS back to "", but add NOINLINE
|
||||||
|
@ -7,11 +7,14 @@
|
|||||||
# This software may be used and distributed according to the terms
|
# This software may be used and distributed according to the terms
|
||||||
# of the GNU General Public License, incorporated herein by reference.
|
# of the GNU General Public License, incorporated herein by reference.
|
||||||
|
|
||||||
import sys, os#, re
|
import sys, os
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
sys.stderr.write("usage: %s [-t] file1 file2\n" % sys.argv[0])
|
sys.stderr.write("usage: %s [-t] file1 file2 [-- <readelf options>]\n"
|
||||||
sys.exit(-1)
|
% sys.argv[0])
|
||||||
|
sys.stderr.write("\t-t\tShow time spent on parsing/processing\n")
|
||||||
|
sys.stderr.write("\t--\tPass additional parameters to readelf\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
f1, f2 = (None, None)
|
f1, f2 = (None, None)
|
||||||
flag_timing, dashes = (False, False)
|
flag_timing, dashes = (False, False)
|
||||||
@ -31,6 +34,8 @@ for f in sys.argv[1:]:
|
|||||||
f1 = f
|
f1 = f
|
||||||
elif f2 is None:
|
elif f2 is None:
|
||||||
f2 = f
|
f2 = f
|
||||||
|
else:
|
||||||
|
usage()
|
||||||
if flag_timing:
|
if flag_timing:
|
||||||
import time
|
import time
|
||||||
if f1 is None or f2 is None:
|
if f1 is None or f2 is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user