Skip to contentSkip to conversation

More bloat-o-meter tweaks.

PATCH New Rob Landley 1 participant 1 message May 30, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 More bloat-o-meter tweaks.

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?

bloat-o-meter +10 -4
Index: scripts/bloat-o-meter
===================================================================
@@ -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)))
Signature · 1 line
Never bet against the cheap plastic solution.