Last active
December 14, 2015 10:09
-
-
Save nickleefly/5069647 to your computer and use it in GitHub Desktop.
check memory usage, including RSS PageTables SlabInfo
This file contains hidden or 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 | |
for PROC in `ls /proc/|grep "^[0-9]"` | |
do | |
if [ -f /proc/$PROC/statm ]; then | |
TEP=`cat /proc/$PROC/statm | awk '{print ($2)}'` | |
RSS=`expr $RSS + $TEP` | |
fi | |
done | |
RSS=`expr $RSS \* 4 / 1024` | |
PageTable=`grep PageTables /proc/meminfo | awk '{print $2 / 1024}'` | |
SlabInfo=`cat /proc/slabinfo |awk 'BEGIN{sum=0;}{sum=sum+$3*$4;}END{print sum/1024/1024}'` | |
echo $RSS"MB", $PageTable"MB", $SlabInfo"MB" | |
printf "rss+pagetable+slabinfo=%sMB\n" `echo $RSS + $PageTable + $SlabInfo|bc` | |
free -m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment