From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4d5848ebc16d0227918a0fa9c8327e94@plan9.ucalgary.ca> To: 9fans@cse.psu.edu Subject: Re: [9fans] memory Date: Wed, 26 Jan 2005 18:05:43 -0700 From: andrey mirtchovski In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 36fa75a0-eace-11e9-9e20-41e7f4b1d025 i find the following useful. i'm lazy and i'm not good at multiplying by blocksize in my head :) plan9% cat /bin/mem #!/bin/rc # show available and used memory in # user-discernible format. all=`{cat /dev/swap | sed 's,/, ,g'} # 4096/(1024*1024) pageinmb=0.00390625 mem = `{echo $all(1)^'*'^$pageinmb | hoc } memtotal = `{echo $all(2)^'*'^$pageinmb | hoc} swap = `{echo $all(4)^'*'^$pageinmb | hoc } swaptotal = `{echo $all(5)^'*'^$pageinmb | hoc} echo memory: $mem MB used. $memtotal MB total echo swap: $swap MB used. $swaptotal MB total plan9% it helps those times when one has forgotten to turn on the swap or is using only 16 megs of ram instead of the available 128 :) it output looks like this on plan9.ucalgary.ca (10000 blocks fossil cache): plan9% mem memory: 126.6640625 MB used. 430.27734375 MB total swap: 0 MB used. 611.76953125 MB total plan9%