Created
April 19, 2014 22:15
-
-
Save azat/11099277 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Here we use pmap(1), but it can use smaps instead of it | |
# not do depends from pmap, but for now it's simpler | |
pid="$1" | |
# pmap -x $pid | tail -n+3 | awk '{ size = $2; addr = sprintf("%.f\n", "0x" $1); if (addr-size == prev_addr) { printf "%s # can merged with prev", $1}; prev_addr = addr; }' | |
pmap -x $pid | tail -n+3 | awk '{ size = $2; addr = sprintf("%.f\n", "0x" $1); printf("%.f vs %.f diff %.f\n", prev_addr, addr-size, addr-size-prev_addr); prev_addr = addr; }' | awk '{print $NF}' | sort | uniq -c | sort -nr -k1,1 | head |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment