]>
git.proxmox.com Git - mirror_ubuntu-kernels.git/blob - scripts/bloat-o-meter
3 # Copyright 2004 Matt Mackall <mpm@selenic.com>
5 # inspired by perl Bloat-O-Meter (c) 1997 by Andi Kleen
7 # This software may be used and distributed according to the terms
8 # of the GNU General Public License, incorporated herein by reference.
12 if len(sys
.argv
) != 3:
13 sys
.stderr
.write("usage: %s file1 file2\n" % sys
.argv
[0])
18 for l
in os
.popen("nm --size-sort " + file).readlines():
19 size
, type, name
= l
[:-1].split()
21 if "." in name
: name
= "static." + name
.split(".")[0]
22 sym
[name
] = sym
.get(name
, 0) + int(size
, 16)
25 old
= getsizes(sys
.argv
[1])
26 new
= getsizes(sys
.argv
[2])
27 grow
, shrink
, add
, remove
, up
, down
= 0, 0, 0, 0, 0, 0
28 delta
, common
= [], {}
35 if name
not in common
:
38 delta
.append((-old
[name
], name
))
41 if name
not in common
:
44 delta
.append((new
[name
], name
))
47 d
= new
.get(name
, 0) - old
.get(name
, 0)
48 if d
>0: grow
, up
= grow
+1, up
+d
49 if d
<0: shrink
, down
= shrink
+1, down
-d
50 delta
.append((d
, name
))
55 print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \
56 (add
, remove
, grow
, shrink
, up
, -down
, up
-down
)
57 print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")
59 if d
: print "%-40s %7s %7s %+7d" % (n
, old
.get(n
,"-"), new
.get(n
,"-"), d
)