how do I show amount of memory?

t patterson tp at decwrl.dec.com
Sun Jun 4 10:39:07 AEST 1989


In article <156 at wbcs.UUCP> doug at wbcs.UUCP (Doug Kratky) writes:
>
>Is there a command in ULTRIX that will show the amount of
>physical memory installed on a system?

this should work:   (result of "cat ~/bin/showmem")

#!/bin/sh
#    show amount of memory on machine in kilobytes
machine=vax
[ -f /bin/machine ] && {
	machine=`/bin/machine`
}
x=`echo "&physmem/D ; quit " | dbx -k /vmunix /dev/mem | tail -1 |\
	 awk '{print  $2}'`
case "${machine}" in
    vax)
	# a little bit of round-off error will creep in...
	echo `expr $x /  2` " K"
	;;
    mips)
	echo `expr $x \* 4` " K"
	;;
    *)
	exit 1
	;;
esac
exit 0


essentially this amounts to:  poke through memory for the value "physmem"
   and print it; on a VAX, this variable is the number of 512byte pages, on a
   PMAX, it lists the number of 4K pages.

   this is one situation where a VAX may be faster than a PMAX; on the
VAX you could use "adb" instead of "dbx" and not have to read in & filter
out so much crud.
    it's also much, much faster if you do it in C (but worth the effort?).

--
t. patterson            domain: tp at decwrl.dec.com    path: decwrl!tp
DEC Western             enet:   decwrl::tp
Software Lab            icbm:   122 9 41 W / 37 26 35 N



More information about the Comp.unix.ultrix mailing list