Skip to contentSkip to conversation

bloat-o-meter: Include read-only data section in report

PATCH In review Jean Delvare 2 participants 2 messages Mar 2, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bloat-o-meter: Include read-only data section in report

I'm not sure why the read-only data section is excluded from the report, it seems as relevant as the other data sections (b and d).

I've stripped the symbols starting with __mod_ as they can have their names dynamically generated and thus comparison between binaries is not possible.

---
Disclaimer: I don't know anything about python.

 scripts/bloat-o-meter |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/bloat-o-meter +3 -1
@@ -17,7 +17,9 @@ def getsizes(file):
     sym = {}
     for l in os.popen("nm --size-sort " + file).readlines():
         size, type, name = l[:-1].split()
-        if type in "tTdDbB":
+        if type in "tTdDbBrR":
+            # strip generated symbols
+            if name[:6] == "__mod_": continue
             # function names begin with '.' on 64-bit powerpc
             if "." in name[1:]: name = "static." + name.split(".")[0]
             sym[name] = sym.get(name, 0) + int(size, 16)
Signature · 1 line
Jean Delvare
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jean Delvare

I'm not sure why the read-only data section is excluded from the report, it seems as relevant as the other data sections (b and d).

I've stripped the symbols starting with __mod_ as they can have their names dynamically generated and thus comparison between binaries is not possible.

Seems to do the right thing here.