How do you find the amount of RAM free?
Rick Farris
rfarris at rfengr.com
Thu Jun 13 11:15:54 AEST 1991
In article <1265 at teslab.lab.OZ> andrew at teslab.lab.oz.au (Andrew Phillips) writes:
> It would also be nice if we could tell at any time how
> much RAM is unused.
Here's a short perl script that shows how much memory is
used and how much is available. I didn't write it, any
kudos should go to Rock Kent; rock at rancho.uucp.
---
#!/usr/local/bin/perl
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
open(PS, "ps -el |");
while (<PS>) {
$tot += substr($_, 48, 6);
}
close(PS);
open(SAR, "sar -r 1 |");
while (<SAR>) {
$tot2 = substr($_, 9, 7);
}
close(SAR);
printf "\nUsed : %4.2f mb\n", $tot / 1024;
printf "Avail: %4.2f mb\n", ($tot2 * 4096) / 1024000;
---
Output of above program:
serene:/u/rfarris> pmem
Used : 4.64 mb
Avail: 6.24 mb
--
Rick Farris RF Engineering POB M Del Mar, CA 92014 voice (619) 259-6793
rfarris at rfengr.com ...!ucsd!serene!rfarris serenity bbs 259-7757
More information about the Comp.unix.xenix.sco
mailing list