summaryrefslogtreecommitdiff
path: root/scripts/bloat-o-meter
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2008-05-23 12:53:18 +0000
committerBernhard Reutner-Fischer2008-05-23 12:53:18 +0000
commitcf575ca8561c53ef8299e9efcebb9dce96de2ff0 (patch)
treefbba0514cabc2a2b017d4e2c651470efd5b99ce8 /scripts/bloat-o-meter
parent61082ec1cccd25495ee102ba80a42e55eafe1b27 (diff)
downloadbusybox-cf575ca8561c53ef8299e9efcebb9dce96de2ff0.zip
busybox-cf575ca8561c53ef8299e9efcebb9dce96de2ff0.tar.gz
- optionally pass additional flags down to nm
Diffstat (limited to 'scripts/bloat-o-meter')
-rwxr-xr-xscripts/bloat-o-meter15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 76d342c..02e8c8a 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -9,24 +9,29 @@
import sys, os, re
-if len(sys.argv) != 3:
+def usage():
sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0])
sys.exit(-1)
+if len(sys.argv) < 3:
+ usage()
+
for f in sys.argv[1], sys.argv[2]:
if not os.path.exists(f):
sys.stderr.write("Error: file '%s' does not exist\n" % f)
- sys.exit(-1)
+ usage()
+nm_args = " ".join([x for x in sys.argv[3:]])
def getsizes(file):
sym = {}
- for l in os.popen("nm --size-sort " + file).readlines():
+ for l in os.popen("nm --size-sort %s %s" % (nm_args, file)).readlines():
+ l = l.strip()
# Skip empty lines
- if not len(l.strip()): continue
+ if not len(l): continue
# Skip archive members
if len(l.split()) == 1 and l.endswith(':'):
continue
- size, type, name = l[:-1].split()
+ size, type, name = l.split()
if type in "tTdDbBrR":
if "." in name: name = "static." + name.split(".")[0]
sym[name] = sym.get(name, 0) + int(size, 16)