Every often used regex is better be compiled in Python.
Speedup is about ~9.8% (whee!)
$ perf stat -r 16 taskset -c 15 ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux >/dev/null
7.091202853 seconds time elapsed ( +- 0.15% )
+re.compile
6.397564973 seconds time elapsed ( +- 0.34% )
Link: http://lkml.kernel.org/r/20161119004417.GB1200@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
readlines() conses whole list before doing anything which is slower for
big object files. Use per line iterator.
Speed up is ~2% on "allyesconfig" type of kernel.
$ perf stat -r 16 taskset -c 15 ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux >/dev/null
...
Before: 7.247708646 seconds time elapsed ( +- 0.28% )
After: 7.091202853 seconds time elapsed ( +- 0.15% )
Link: http://lkml.kernel.org/r/20161119004143.GA1200@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix piping output to a program which quickly exits (read: head -n1)
$ ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux | head -n1
add/remove: 0/0 grow/shrink: 9/60 up/down: 124/-305 (-181)
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
Link: http://lkml.kernel.org/r/20161028204618.GA29923@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Python divisions are integer divisions unless at least one parameter is
a float. The current bloat-o-meter fails to print sub-percentage
changes:
Total: Before=10515408, After=10604060, chg 0.000000%
Force float division by using one float and pretty the print to two
significant decimals:
Total: Before=10515408, After=10604060, chg +0.84%
Link: http://lkml.kernel.org/r/1465980311-23814-1-git-send-email-riku.voipio@linaro.org
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This adds an additional line of output (to reduce the chances of
breaking any existing output parsers) which prints the total size before
and after and the relative difference.
add/remove: 39/0 grow/shrink: 12408/55 up/down: 362227/-1430 (360797)
function old new delta
ext4_fill_super 10556 12590 +2034
_fpadd_parts - 1186 +1186
ntfs_fill_super 5340 6164 +824
...
...
__divdf3 752 386 -366
unlzma 3682 3274 -408
Total: Before=5023101, After=5383898, chg 7.000000%
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Link: http://lkml.kernel.org/r/1463124110-30314-1-git-send-email-vgupta@synopsys.com
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
In Python3+ print is a function so the old syntax is not correct
anymore:
$ ./scripts/bloat-o-meter vmlinux.o vmlinux.o.old
File "./scripts/bloat-o-meter", line 61
print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \
^
SyntaxError: invalid syntax
Fix by calling print as a function.
Tested on python 2.7.11, 3.5.1
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
str.startswith has existed since at least Python 2.0, in 2000; use it
rather than a fragile comparison against an initial slice of a string,
which requires hard-coding the length of the string to compare against.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
linux_banner can change size due to changes in the compiler, build number,
or the user@host the system was compiled on; ignore size changes in
linux_banner entirely.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Disable static detection: the static currently drops a lot of useful
information including clones generated by gcc. Drop this. The statics
will appear now without static. prefix.
But remove the LTO .NUMBER postfixes that look ugly
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
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.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Andi Kleen <andi@firstfloor.org>
Acked-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
bloat-o-meter assumes that a '.' anywhere in a symbol's name means that it
is static and prepends 'static.' to the first part of the symbol name,
discarding the portion of the name that follows the '.'. However, the
names of function entry points begin with '.' in the ppc64 ABI. This
causes all function text size changes to be accounted to a single 'static.'
entry in the output when comparing ppc64 kernels.
Change getsizes() to ignore the first character of the symbol name when
searching for '.'.
Signed-off-by: Nathan Lynch <ntl@pobox.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Make it executable like it should be. Do the same for other files intended to be
executed by the user - the ones called by the build process needn't be
executable as they already work (as argument to their interpreter).
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This is a rewrite of Andi Kleen's bloat-o-meter with sorting and reporting of
gainers/decliners. Sample output:
add/remove: 0/8 grow/shrink: 2/0 up/down: 88/-4424 (-4336)
function old new delta
__copy_to_user_ll 59 103 +44
__copy_from_user_ll 59 103 +44
fill_note 32 - -32
maydump 58 - -58
dump_seek 67 - -67
writenote 180 - -180
elf_dump_thread_status 274 - -274
fill_psinfo 308 - -308
fill_prstatus 466 - -466
elf_core_dump 3039 - -3039
The summary line says:
no functions added, 8 removed
two functions grew, none shrunk
we gained 88 bytes and lost 4424 (or -4336 net)
This work was sponsored in part by CE Linux Forum
Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>