Created
April 16, 2013 13:29
-
-
Save cobusc/5395884 to your computer and use it in GitHub Desktop.
Quick check if Erlang VMs have swap memory
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
#!/bin/bash | |
# Check swap usage of Erlang VMs | |
for p in $(ps -e | grep beam | cut -d" " -f 1); do | |
SWAP=$(grep "Swap:" /proc/${p}/smaps | awk '{swap = swap + $2} END {print swap}') | |
CMDPREFIX=$(head -c 100 /proc/${p}/cmdline) | |
printf "PID ${p} SWAP %dKB CMDPREFIX '%s...'\n" ${SWAP} ${CMDPREFIX} | |
done | |
# Example output | |
# | |
# PID 20419 SWAP 28340KB CMDPREFIX '/some/app...' | |
# PID 21898 SWAP 102012KB CMDPREFIX '/some/other/app...' | |
# PID 22606 SWAP 14744KB CMDPREFIX '/yet/another...' | |
# PID 32665 SWAP 0KB CMDPREFIX '/last/example/app...' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment