public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Small patch to bloat-o-meter.
@ 2006-05-07 19:59 Rob Landley
  2006-05-08  3:02 ` Matt Mackall
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Landley @ 2006-05-07 19:59 UTC (permalink / raw)
  To: mpm, linux-kernel

Workaround for the fact that gcc 4.x no longer provides consistent names for 
static symbols.

Signed-off-by: Rob Landley <rob@landley.net>
---

When I added bloat-o-meter to busybox, I had to fix this to get useful 
results.  Since the kernel version seems to be the master, I thought you 
might be interested.

--- linux-old/scripts/bloat-o-meter	2006-05-07 15:47:23.000000000 -0400
+++ linux-2.6.16/scripts/bloat-o-meter	2006-05-07 15:08:31.000000000 -0400
@@ -18,7 +18,9 @@
     for l in os.popen("nm --size-sort " + file).readlines():
         size, type, name = l[:-1].split()
         if type in "tTdDbB":
-            sym[name] = int(size, 16)
+            if name.find(".") != -1: name = "static." + name.split(".")[0]
+            if name in sym: sym[name] += int(size, 16)
+            else :sym[name] = int(size, 16)
     return sym
 
 old = getsizes(sys.argv[1])


-- 
Never bet against the cheap plastic solution.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Small patch to bloat-o-meter.
  2006-05-07 19:59 [PATCH] Small patch to bloat-o-meter Rob Landley
@ 2006-05-08  3:02 ` Matt Mackall
  2006-05-08  4:43   ` Rob Landley
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2006-05-08  3:02 UTC (permalink / raw)
  To: Rob Landley; +Cc: linux-kernel

On Sun, May 07, 2006 at 03:59:00PM -0400, Rob Landley wrote:
> Workaround for the fact that gcc 4.x no longer provides consistent names for 
> static symbols.
> 
> Signed-off-by: Rob Landley <rob@landley.net>
> ---
> 
> When I added bloat-o-meter to busybox, I had to fix this to get useful 
> results.  Since the kernel version seems to be the master, I thought you 
> might be interested.
> 
> --- linux-old/scripts/bloat-o-meter	2006-05-07 15:47:23.000000000 -0400
> +++ linux-2.6.16/scripts/bloat-o-meter	2006-05-07 15:08:31.000000000 -0400
> @@ -18,7 +18,9 @@
>      for l in os.popen("nm --size-sort " + file).readlines():
>          size, type, name = l[:-1].split()
>          if type in "tTdDbB":
> -            sym[name] = int(size, 16)
> +            if name.find(".") != -1: name = "static." + name.split(".")[0]

if "." in name:

(just like 'if type in "tTdDbB":' above it)

> +            if name in sym: sym[name] += int(size, 16)
> +            else :sym[name] = int(size, 16)

else:

Actually, this probably wants to be:

sym.setdefault(name, 0) += int(size, 16)

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Small patch to bloat-o-meter.
  2006-05-08  3:02 ` Matt Mackall
@ 2006-05-08  4:43   ` Rob Landley
  2006-05-08  4:48     ` Matt Mackall
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Landley @ 2006-05-08  4:43 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

On Sunday 07 May 2006 11:02 pm, Matt Mackall wrote:
> > --- linux-old/scripts/bloat-o-meter	2006-05-07 15:47:23.000000000 -0400
> > +++ linux-2.6.16/scripts/bloat-o-meter	2006-05-07 15:08:31.000000000
> > -0400 @@ -18,7 +18,9 @@
> >      for l in os.popen("nm --size-sort " + file).readlines():
> >          size, type, name = l[:-1].split()
> >          if type in "tTdDbB":
> > -            sym[name] = int(size, 16)
> > +            if name.find(".") != -1: name = "static." +
> > name.split(".")[0]
>
> if "." in name:
>
> (just like 'if type in "tTdDbB":' above it)

I learned python over 5 years ago and the language has changed out from under 
me a bit.  When I've done a lot of C programming recently, I tend to fall 
back on the old ways... :)

> > +            if name in sym: sym[name] += int(size, 16)
> > +            else :sym[name] = int(size, 16)
>
> else:

I'm surprised that even ran...

> Actually, this probably wants to be:
>
> sym.setdefault(name, 0) += int(size, 16)

File "scripts/bloat-o-meter", line 22
  sym.setdefault(name, 0) += int(size, 16)
SyntaxError: can't assign to function call

Rob
-- 
Never bet against the cheap plastic solution.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Small patch to bloat-o-meter.
  2006-05-08  4:43   ` Rob Landley
@ 2006-05-08  4:48     ` Matt Mackall
  2006-05-08  5:11       ` Rob Landley
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2006-05-08  4:48 UTC (permalink / raw)
  To: Rob Landley; +Cc: linux-kernel

On Mon, May 08, 2006 at 12:43:51AM -0400, Rob Landley wrote:
> On Sunday 07 May 2006 11:02 pm, Matt Mackall wrote:
> > > --- linux-old/scripts/bloat-o-meter	2006-05-07 15:47:23.000000000 -0400
> > > +++ linux-2.6.16/scripts/bloat-o-meter	2006-05-07 15:08:31.000000000
> > > -0400 @@ -18,7 +18,9 @@
> > >      for l in os.popen("nm --size-sort " + file).readlines():
> > >          size, type, name = l[:-1].split()
> > >          if type in "tTdDbB":
> > > -            sym[name] = int(size, 16)
> > > +            if name.find(".") != -1: name = "static." +
> > > name.split(".")[0]
> >
> > if "." in name:
> >
> > (just like 'if type in "tTdDbB":' above it)
> 
> I learned python over 5 years ago and the language has changed out from under 
> me a bit.  When I've done a lot of C programming recently, I tend to fall 
> back on the old ways... :)
> 
> > > +            if name in sym: sym[name] += int(size, 16)
> > > +            else :sym[name] = int(size, 16)
> >
> > else:
> 
> I'm surprised that even ran...
> 
> > Actually, this probably wants to be:
> >
> > sym.setdefault(name, 0) += int(size, 16)
> 
> File "scripts/bloat-o-meter", line 22
>   sym.setdefault(name, 0) += int(size, 16)
> SyntaxError: can't assign to function call

Oh, right. That's why I never do that.

sym[name] = sym.get(name, 0) + int(size, 16)

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Small patch to bloat-o-meter.
  2006-05-08  4:48     ` Matt Mackall
@ 2006-05-08  5:11       ` Rob Landley
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Landley @ 2006-05-08  5:11 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

Second try: patch to upgrade scripts/bloat-o-meter to handle the names gcc 4 
gives static symbols.

Signed-off-by: Rob Landley <rob@landley.net>
---

--- linux-2.6.16/scripts/bloat-o-meter	2006-05-08 01:04:06.000000000 -0400
+++ linux-rob/scripts/bloat-o-meter	2006-05-08 01:02:36.000000000 -0400
@@ -18,7 +18,8 @@
     for l in os.popen("nm --size-sort " + file).readlines():
         size, type, name = l[:-1].split()
         if type in "tTdDbB":
-            sym[name] = int(size, 16)
+            if "." in name: name = "static." + name.split(".")[0]
+            sym[name] = sym.get(name, 0) + int(size, 16)
     return sym
 
 old = getsizes(sys.argv[1])

-- 
Never bet against the cheap plastic solution.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-08  5:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-07 19:59 [PATCH] Small patch to bloat-o-meter Rob Landley
2006-05-08  3:02 ` Matt Mackall
2006-05-08  4:43   ` Rob Landley
2006-05-08  4:48     ` Matt Mackall
2006-05-08  5:11       ` Rob Landley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox