9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: andrey mirtchovski <mirtchov@cpsc.ucalgary.ca>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] memory
Date: Wed, 26 Jan 2005 18:05:43 -0700	[thread overview]
Message-ID: <4d5848ebc16d0227918a0fa9c8327e94@plan9.ucalgary.ca> (raw)
In-Reply-To: <e7e289acc2b7534f28232d0ba6cfdb7c@collyer.net>

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% 



  reply	other threads:[~2005-01-27  1:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26 10:07 cej
2005-01-26 10:58 ` Heiko Dudzus
2005-01-27  0:17 ` Tim Newsham
2005-01-27  0:45   ` geoff
2005-01-27  1:05     ` andrey mirtchovski [this message]
2005-01-27 12:42       ` Robert Raschke
2005-01-28 10:03         ` arisawa
  -- strict thread matches above, loose matches on Subject: below --
2005-02-07  7:16 tapique
2005-02-08  4:52 ` Russ Cox
2005-02-08  5:12   ` Lucio De Re
2000-11-21 13:28 presotto
2000-11-20 20:48 Russ Cox
2000-11-20 21:04 ` Boyd Roberts
2000-11-20 21:49 ` Mike Haertel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d5848ebc16d0227918a0fa9c8327e94@plan9.ucalgary.ca \
    --to=mirtchov@cpsc.ucalgary.ca \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).