[PATCH] More bloat-o-meter tweaks.

From: Rob Landley
Date: Tue May 30 2006 - 01:48:31 EST


Some of the busybox users got confused by what looked like a table but didn't
have the total displayed at the bottom (where it won't scroll off it lots of
stuff changed). Also, changes to string lengths weren't registering because
nm doesn't look at the rodata segment. So I improvised.

This may not be the world's cleanest approach to addressing either issue.
Feel free to improve upon it. (And yes, it's svn output so it's -p0 instead
of -p1. Sorry 'bout that. Need to beat subversion with a large stick one of
these days.)

But what do you think of the approach?

Signed-off-by: Rob Landley <rob@xxxxxxxxxxx>

Index: scripts/bloat-o-meter
===================================================================
--- scripts/bloat-o-meter (revision 15036)
+++ scripts/bloat-o-meter (working copy)
@@ -20,6 +20,10 @@
if type in "tTdDbB":
if "." in name: name = "static." + name.split(".")[0]
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

old = getsizes(sys.argv[1])
@@ -52,8 +56,10 @@
delta.sort()
delta.reverse()

-print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \
- (add, remove, grow, shrink, up, -down, up-down)
-print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")
+print "%-48s %7s %7s %+7s" % ("function", "old", "new", "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 "-"*78
+total="(add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s)%%sTotal: %s bytes"\
+ % (add, remove, grow, shrink, up, -down, up-down)
+print total % (" "*(80-len(total)))

--
Never bet against the cheap plastic solution.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/