9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: arisawa@ar.aichi-u.ac.jp
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] memory
Date: Fri, 28 Jan 2005 19:03:30 +0900	[thread overview]
Message-ID: <4e5c2326276e172e08fc5aad71626c23@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <7ed2763a9561e1f9fa3067d1566639ad@tombob.com>

Just translation from Robert, avoiding zero division.

#!/bin/rc
all=`{cat /dev/swap | sed 's,/, ,g'}
echo '
pageinmb = 4096/(1024*1024)
mem = '$all(1)^'*pageinmb
memtotal = '$all(2)^'*pageinmb
memperc = mem*100/memtotal
swap = '$all(4)^'*pageinmb
swaptotal = '$all(5)^'*pageinmb
if(swaptotal != 0){
         swapperc = swap*100/swaptotal
} else {
         swapperc = 0
}
print "memory: ",int(mem),"MB used (",int(memperc),"% of 
",int(memtotal),"MB).\n"
print "swap: ",int(swap),"MB used (",int(swapperc),"% of 
",int(swaptotal),"MB).\n"
' | hoc


Kenji Arisawa



  reply	other threads:[~2005-01-28 10:03 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
2005-01-27 12:42       ` Robert Raschke
2005-01-28 10:03         ` arisawa [this message]
  -- 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=4e5c2326276e172e08fc5aad71626c23@ar.aichi-u.ac.jp \
    --to=arisawa@ar.aichi-u.ac.jp \
    --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).