• Benoit Lize's avatar
    tools: Dump a process' heap, and analyze it. · e34d38aa
    Benoit Lize authored
    Adds a tool to dump the content of all anonymous mapping in a given process,
    and one to show statistics about the content.
    
    From a process, this shows:
    - Total anonymous mappings size
    - For each page, whether it's present XOR swapped
    - The total number of 0 pages
    - Pages with identical non-zero content
    - Compressed size of non-zero pages.
    
    The compression ratio is derived using zlib, which is likely to be
    overestimating the compression ratio, as it's better than ZRAM's compression
    algorithm.
    
    Tested on Android and Linux.
    
    Sample output (cnn.com on Android Go):
    
    Total pages = 36532 (149.64MB)
    Total zero pages = 15191 (41.58%)
    Total present zero pages = 754 (3.09MB)
    Total size of non-zero pages = 87412736 (87.41MB)
    Total compressed size = 28994296 (33.17%)
    Duplicated non-zero pages = 812
    Max non-zero pages with the same content = 387
    Swapped pages = 231 (946.18kB)
    Non-present pages = 14667 (60.08MB)
    Freed = 5232960 (5.23MB)
    
    TBR: brucedawson@chromium.org
    
    Change-Id: Iba991f8a57d01591e72359163711064297ea8658
    Bug: 845459
    Reviewed-on: https://chromium-review.googlesource.com/1087059
    Commit-Queue: Benoit L <lizeb@chromium.org>
    Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
    Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
    Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
    Reviewed-by: default avataragrieve <agrieve@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#567960}
    e34d38aa
BUILD.gn 318 Bytes