[Toybox] request for comments: pybloat.py

Tim Bird tim.bird at am.sony.com
Tue Feb 21 14:10:13 PST 2012


On 02/20/2012 06:04 PM, Rob Landley wrote:
> On 02/15/2012 04:22 PM, Elie De Brauwer wrote:
>> Well, I promised a version which just uses getopt, and this one I tested
>> with python 2.6, so see attach. Next point is whether to send it
>> completely to /dev/null, or to modify it if needed to fit our needs (as
>> said comments welcome).
> 
> I made a stab at it in bash (attached).  Opinions?

It's cool that it's in bash.  The delta column is not sorted.

You can get the final order to match bloat-o-meter by piping the result to
'sort -rn -k4,4'.  It would be better to do this sort before emitting
the header and footer, obviously.

I'm not sure if it's worth it to replace '0' with '-', to match bloat-o-meter,
but that's probably easy with sed, if desired.

Below is the output for a kernel I was working with,
from both tools:

$ /home/tbird/work/toybox/blinky.sh vmlinux vmlinux-kdb
name                                           old       new      delta
-----------------------------------------------------------------------
 add_swap_count_continuation                     0       368        368
 add_swap_extent                                 0       376        376
 add_to_swap                                     0       100        100
 __add_to_swap_cache                             0       300        300
 add_to_swap_cache                               0         4          4
 Bad_file                                        0        21         21
 Bad_offset                                      0        23         23
 block_sync_page                                60        84         24
 clear_page_dirty_for_io                       360       384         24
 copy_page_range                              1180      1280        100
 __create_page_tables                          208       156        -52
 __delete_from_swap_cache                        0       176        176
 delete_from_swap_cache                          0        68         68
 destroy_swap_extents                            0        72         72
 discard_swap_cluster                            0       200        200
 do_sysinfo                                    240       276         36
 do_wp_page                                      0      1856       1856
 early_console                                  56         0        -56
 early_console_write                            12         0        -12
 early_printk                                   68        12        -56
 early_write                                    60         0        -60
...
 wait_for_discard                                0        16         16
 zone_reclaimable_pages                         16        52         36
-----------------------------------------------------------------------
                                                                  21488 total



$ bloat-o-meter vmlinux vmlinux-kdb
add/remove: 103/15 grow/shrink: 51/11 up/down: 25008/-3682 (21326)
function                                     old     new   delta
sys_swapon                                     -    3308   +3308
sys_swapoff                                    -    2724   +2724
shrink_zone                                  516    2732   +2216
do_wp_page                                     -    1856   +1856
get_swap_page                                  -    1264   +1264
get_swap_page_of_type                          -    1120   +1120
...
kernel_config_data                         10995   10912     -83
__error_p                                     88       -     -88
shmem_unuse                                 1044     952     -92
__error_a                                    108       -    -108
handle_mm_fault                             2924    1948    -976
static.shrink_inactive_list                 1804       -   -1804


=============================
Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment
=============================


 1329862213.0


More information about the Toybox mailing list