08 Dec, 2020

1 commit

  • Change every shebang which does not need an argument to use /usr/bin/env.
    This is needed as not every distro has everything under /usr/bin,
    sometimes not even bash.

    Signed-off-by: Finn Behrens
    Signed-off-by: Masahiro Yamada

    Finn Behrens
     

08 Aug, 2020

1 commit

  • Library archives (.a) usually contain multiple object files so their
    output of nm --size-sort contains lines like:

    00000000000003a8 t run_test

    extent-map-tests.o:

    bloat-o-meter currently doesn't handle them which results in errors when
    calling .split() on them. Fix this by simply ignoring them. This enables
    diffing subsystems which generate built-in.a files.

    Signed-off-by: Nikolay Borisov
    Signed-off-by: Andrew Morton
    Link: http://lkml.kernel.org/r/20200603103513.3712-1-nborisov@suse.com
    Signed-off-by: Linus Torvalds

    Nikolay Borisov
     

29 Dec, 2018

1 commit

  • Since __LINE__ is part of the symbol created by __ADDRESSABLE, almost
    any change causes those symbols to disappear and get reincarnated, e.g.

    add/remove: 4/4 grow/shrink: 0/3 up/down: 32/-171 (-139)
    Function old new delta
    __addressable_tracing_set_default_clock8649 - 8 +8
    __addressable_tracer_init_tracefs8631 - 8 +8
    __addressable_ftrace_dump8383 - 8 +8
    __addressable_clear_boot_tracer8632 - 8 +8
    __addressable_tracing_set_default_clock8650 8 - -8
    __addressable_tracer_init_tracefs8632 8 - -8
    __addressable_ftrace_dump8384 8 - -8
    __addressable_clear_boot_tracer8633 8 - -8
    trace_default_header 663 642 -21
    tracing_mark_raw_write 406 355 -51
    tracing_mark_write 624 557 -67
    Total: Before=63889, After=63750, chg -0.22%

    They're small and in .discard, so ignore them, leading to more useful

    add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-139 (-139)
    Function old new delta
    trace_default_header 663 642 -21
    tracing_mark_raw_write 406 355 -51
    tracing_mark_write 624 557 -67
    Total: Before=63721, After=63582, chg -0.22%

    Link: http://lkml.kernel.org/r/20181102210030.8383-1-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Andy Shevchenko
    Cc: Alexey Dobriyan
    Cc: Ingo Molnar
    Cc: Dominik Brodowski
    Cc: Maninder Singh
    Cc: Matteo Croce
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

09 Apr, 2018

2 commits

  • Tidy the naming convention for compat syscall subs. Hints which describe
    the purpose of the stub go in front and receive a double underscore to
    denote that they are generated on-the-fly by the COMPAT_SYSCALL_DEFINEx()
    macro.

    For the generic case, this means:

    t kernel_waitid # common C function (see kernel/exit.c)

    __do_compat_sys_waitid # inlined helper doing the actual work
    # (takes original parameters as declared)

    T __se_compat_sys_waitid # sign-extending C function calling inlined
    # helper (takes parameters of type long,
    # casts them to unsigned long and then to
    # the declared type)

    T compat_sys_waitid # alias to __se_compat_sys_waitid()
    # (taking parameters as declared), to
    # be included in syscall table

    For x86, the naming is as follows:

    t kernel_waitid # common C function (see kernel/exit.c)

    __do_compat_sys_waitid # inlined helper doing the actual work
    # (takes original parameters as declared)

    t __se_compat_sys_waitid # sign-extending C function calling inlined
    # helper (takes parameters of type long,
    # casts them to unsigned long and then to
    # the declared type)

    T __ia32_compat_sys_waitid # IA32_EMULATION 32-bit-ptregs -> C stub,
    # calls __se_compat_sys_waitid(); to be
    # included in syscall table

    T __x32_compat_sys_waitid # x32 64-bit-ptregs -> C stub, calls
    # __se_compat_sys_waitid(); to be included
    # in syscall table

    If only one of IA32_EMULATION and x32 is enabled, __se_compat_sys_waitid()
    may be inlined into the stub __{ia32,x32}_compat_sys_waitid().

    Suggested-by: Ingo Molnar
    Signed-off-by: Dominik Brodowski
    Cc: Al Viro
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20180409105145.5364-3-linux@dominikbrodowski.net
    Signed-off-by: Ingo Molnar

    Dominik Brodowski
     
  • Tidy the naming convention for compat syscall subs. Hints which describe
    the purpose of the stub go in front and receive a double underscore to
    denote that they are generated on-the-fly by the SYSCALL_DEFINEx() macro.

    For the generic case, this means (0xffffffff prefix removed):

    810f08d0 t kernel_waitid # common C function (see kernel/exit.c)

    __do_sys_waitid # inlined helper doing the actual work
    # (takes original parameters as declared)

    810f1aa0 T __se_sys_waitid # sign-extending C function calling inlined
    # helper (takes parameters of type long;
    # casts them to the declared type)

    810f1aa0 T sys_waitid # alias to __se_sys_waitid() (taking
    # parameters as declared), to be included
    # in syscall table

    For x86, the naming is as follows:

    810efc70 t kernel_waitid # common C function (see kernel/exit.c)

    __do_sys_waitid # inlined helper doing the actual work
    # (takes original parameters as declared)

    810efd60 t __se_sys_waitid # sign-extending C function calling inlined
    # helper (takes parameters of type long;
    # casts them to the declared type)

    810f1140 T __ia32_sys_waitid # IA32_EMULATION 32-bit-ptregs -> C stub,
    # calls __se_sys_waitid(); to be included
    # in syscall table

    810f1110 T sys_waitid # x86 64-bit-ptregs -> C stub, calls
    # __se_sys_waitid(); to be included in
    # syscall table

    For x86, sys_waitid() will be re-named to __x64_sys_waitid in a follow-up
    patch.

    Suggested-by: Ingo Molnar
    Signed-off-by: Dominik Brodowski
    Cc: Al Viro
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20180409105145.5364-2-linux@dominikbrodowski.net
    Signed-off-by: Ingo Molnar

    Dominik Brodowski
     

09 Mar, 2018

1 commit


30 Nov, 2017

1 commit

  • Under some circumstances it's possible to get a divider 0 which crashes
    the script.

    Traceback (most recent call last):
    File "linux/scripts/bloat-o-meter", line 98, in
    print_result("Function", "tTdDbBrR", 2)
    File "linux/scripts/bloat-o-meter", line 87, in print_result
    (otot, ntot, (ntot - otot)*100.0/otot))
    ZeroDivisionError: float division by zero

    Hide this by checking the divider first.

    Link: http://lkml.kernel.org/r/20171123171219.31453-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Andy Shevchenko
    Cc: Alexey Dobriyan
    Cc: Vaneet Narang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

16 Nov, 2017

1 commit

  • This patch provides 3 new arguments for bloat-o-meter
    1) -c -> for all (showing function and data differently)
    2) -d -> data
    3) -t -> function

    output:

    ./scripts/bloat-o-meter -c "file1" "file2"
    add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-152 (-152)
    Function old new delta
    main 412 260 -152
    Total: Before=548, After=396, chg -27.74%
    ##########################################################
    add/remove: 1/0 grow/shrink: 1/0 up/down: 84/0 (84)
    Data old new delta
    arr - 64 +64
    backtrace 60 80 +20
    Total: Before=109, After=193, chg +77.06%
    ##########################################################
    add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-64 (-64)
    RO Data old new delta
    arr 64 - -64
    Total: Before=68, After=4, chg -94.12%

    [maninder1.s@samsung.com: v1 -> v2]
    Link: http://lkml.kernel.org/r/1506569402-24787-1-git-send-email-maninder1.s@samsung.com
    Link: http://lkml.kernel.org/r/1506336313-27187-1-git-send-email-maninder1.s@samsung.com
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Cc: Amit Sahrawat
    Cc: Andi Kleen
    Cc: Michal Marek
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maninder Singh
     

13 Dec, 2016

2 commits

  • 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
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • 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
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

12 Nov, 2016

1 commit

  • 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
    Cc: Matt Mackall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

27 Jul, 2016

1 commit

  • 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
    Reviewed-by: Josh Triplett
    Cc: Vineet Gupta
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Riku Voipio
     

20 May, 2016

1 commit

  • 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
    Cc: Josh Triplett
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vineet Gupta
     

15 Jan, 2016

1 commit

  • 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
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     

24 Aug, 2014

1 commit


07 Nov, 2013

3 commits


23 Mar, 2011

1 commit

  • 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
    Cc: Andi Kleen
    Acked-by: Nathan Lynch
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jean Delvare