Teach bloatometer about .rodata, and tweak the display into something that
has a better chance of getting merged.
This commit is contained in:
parent
077368194c
commit
f14f7fc5ca
@ -20,6 +20,10 @@ def getsizes(file):
|
|||||||
if type in "tTdDbB":
|
if type in "tTdDbB":
|
||||||
if "." in name: name = "static." + name.split(".")[0]
|
if "." in name: name = "static." + name.split(".")[0]
|
||||||
sym[name] = sym.get(name, 0) + int(size, 16)
|
sym[name] = sym.get(name, 0) + int(size, 16)
|
||||||
|
for l in os.popen("readelf -S " + file).readlines():
|
||||||
|
x = l.split()
|
||||||
|
if len(x)<6 or x[1] != ".rodata": continue
|
||||||
|
sym[".rodata"] = int(x[5], 16)
|
||||||
return sym
|
return sym
|
||||||
|
|
||||||
old = getsizes(sys.argv[1])
|
old = getsizes(sys.argv[1])
|
||||||
@ -52,12 +56,10 @@ for name in common:
|
|||||||
delta.sort()
|
delta.sort()
|
||||||
delta.reverse()
|
delta.reverse()
|
||||||
|
|
||||||
print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \
|
print "%-48s %7s %7s %+7s" % ("function", "old", "new", "delta")
|
||||||
(add, remove, grow, shrink, up, -down, up-down)
|
|
||||||
print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")
|
|
||||||
for d, n in delta:
|
for d, n in delta:
|
||||||
if d: print "%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)
|
if d: print "%-48s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)
|
||||||
print "----------------------------------------------------------------"
|
print "-"*78
|
||||||
s=")"
|
total="(add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s)%%sTotal: %s bytes"\
|
||||||
if (up-down)>=0: s="("
|
% (add, remove, grow, shrink, up, -down, up-down)
|
||||||
print "Result :-%s%+7d" % (s, up-down)
|
print total % (" "*(80-len(total)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user