Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

beaumk

macrumors member
Original poster
Oct 9, 2009
52
0
Hi,

recently bought a rmbp 512.
along with crashing kernal alert every 2 days, it doesnt seem to follow other common script keyword. well, for now just for the RAM.
so, i found and tried multiple script to get percentage of RAM currently occupied.

totalram=`top -l 1 | awk '/PhysMem/ {print $8 $10}' | sed "s/M/ /g" | awk '{sum+= $1 + $2 } END{print sum}' ` ; usedram=`top -l 1 | awk '/PhysMem/ {print $8}' | sed "s/M/ /g"` ; rounded=`echo $totalram $usedram | awk '{ print $2 * 100 /$1}' | awk '{print int($1+0.5)}'` ; echo "Memory: ""$rounded""%"

and


myRAM=`top -l 1 -F -R | awk '/PhysMem/ {print "" $8+0}'`
totalRAM=8192
myPercentRAM=`expr $myRAM \* 100 / $totalRAM`

echo "RAM: $myRAM%"

and

top -l 1 | awk '/PhysMem/ {print "Used RAM: " $8 " Free: " $10}';echo "";echo " PID CPU% RAM_MB Process";ps -arcwwwxo "pid %cpu rss command" | egrep "$1" | grep -v grep | head -12 | tail -11


turns out none of these work.

fi you type those in all you get for out come is
RAM: 0%
Memory: %
stuff like this.

i think it doesnt recognize $8 and $10 thing. has this recently changed to different number on mavericks or something?

please help me out.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.