#!/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
|