From: Mike Frysinger <vapier.adi@gmail.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Robin Getz <rgetz@blackfin.uclinux.org>,
Sam Ravnborg <sam@ravnborg.org>,
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
Denis Vlasenko <vda.linux@googlemail.com>,
Rob Landley <rob@landley.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] update kernel's scripts/bloat-o-meter from busybox
Date: Mon, 1 Jun 2009 16:39:10 -0400 [thread overview]
Message-ID: <8bd0f97a0906011339u37058082wcc187417dcc78d67@mail.gmail.com> (raw)
In-Reply-To: <1243885732.22069.112.camel@calx>
On Mon, Jun 1, 2009 at 15:48, Matt Mackall wrote:
> On Mon, 2009-06-01 at 15:26 -0400, Robin Getz wrote:
>> --- scripts/bloat-o-meter (revision 6437)
>> +++ scripts/bloat-o-meter (working copy)
>> @@ -9,18 +9,37 @@
>>
>> import sys, os, re
>>
>> -if len(sys.argv) != 3:
>> +def usage():
>> sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0])
>> sys.exit(-1)
>>
>> +if len(sys.argv) < 3:
>> + usage()
>> +
>> +for f in sys.argv[1], sys.argv[2]:
>
> in sys.argv[1:3]: is a bit more standard
>
> But this test should instead happen inside getsizes, no loop needed.
>
>> + if not os.path.exists(f):
>> + sys.stderr.write("Error: file '%s' does not exist\n" % f)
>> + usage()
>> +
>> +nm_args = " ".join([x for x in sys.argv[3:]])
>
> nm_args = " ".join(sys.argv[3:])
ive made the argv changes in busybox upstream
>> def getsizes(file):
>> sym = {}
>> - for l in os.popen("nm --size-sort " + file).readlines():
>> - size, type, name = l[:-1].split()
>> - if type in "tTdDbB":
>> + for l in os.popen("nm --size-sort %s %s" % (nm_args, file)).readlines():
>> + l = l.strip()
>> + # Skip empty lines
>> + if not len(l): continue
>
> (seems to be some whitespace damage? there should be no tabs in this
> source)
fixed the whitespace damage (all spaces)
>> old = getsizes(sys.argv[1])
>> @@ -53,8 +72,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)))
>
> Not terribly excited about this last bit, which is going out of its way
> to right-align the total? Who cares about that?
it makes things a lot easier to read, especially in commit scripts
as for the rest of your comments, Denis or Rob can tackle those
-mike
next prev parent reply other threads:[~2009-06-01 20:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-01 19:26 Robin Getz
2009-06-01 19:48 ` Matt Mackall
2009-06-01 20:39 ` Mike Frysinger [this message]
2009-06-01 20:57 ` Robin Getz
2009-06-01 21:17 ` Matt Mackall
2009-06-02 6:04 ` Rob Landley
2009-06-02 13:07 ` Bernhard Reutner-Fischer
2009-06-02 20:11 ` Robin Getz
2009-06-05 21:42 ` Sam Ravnborg
2009-06-10 12:27 ` Denys Vlasenko
2009-06-14 20:37 ` Sam Ravnborg
2009-06-02 5:59 ` Rob Landley
2009-06-02 6:10 ` Joe Perches
2009-06-02 6:33 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8bd0f97a0906011339u37058082wcc187417dcc78d67@mail.gmail.com \
--to=vapier.adi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=rep.dot.nop@gmail.com \
--cc=rgetz@blackfin.uclinux.org \
--cc=rob@landley.net \
--cc=sam@ravnborg.org \
--cc=vda.linux@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®