home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sun / admin / 5087 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  1.9 KB

  1. Xref: sparky comp.sys.sun.admin:5087 comp.sys.sun.misc:3397
  2. Newsgroups: comp.sys.sun.admin,comp.sys.sun.misc
  3. Path: sparky!uunet!s5!is1.is.morgan.com!is0.is.morgan.com!chetal
  4. From: chetal@is.morgan.com (Pradeep Chetal)
  5. Subject: Re: How much physical memory?
  6. In-Reply-To: asherman@laser.fmrco.com's message of Wed, 29 Jul 1992 16:46:58 GMT
  7. Message-ID: <CHETAL.92Jul30045312@is1.is.morgan.com>
  8. Sender: news@is.morgan.com
  9. Nntp-Posting-Host: is1
  10. Organization: Morgan Stanley & Company
  11. References: <ASHERMAN.92Jul29114658@laser.fmrco.com>
  12. Date: Thu, 30 Jul 1992 09:53:12 GMT
  13. Lines: 37
  14.  
  15. In article <ASHERMAN.92Jul29114658@laser.fmrco.com> asherman@laser.fmrco.com (Aaron Sherman) writes:
  16.  
  17.    From perl (or C if I have to) how can I find out how much PHYSICAL
  18.    memory a system has? I've been looking at /usr/adm/messages*, but on
  19.    systems that haven't re-booted recently there is nothing left.
  20.  
  21.    I am doing this from a perl script, so perusing files or running an
  22.    existing program would be the easiest, but if the only thing I can do
  23.    is write a C program, then that's fine.
  24.  
  25.    Thanks. And, please reply via Email, I will summarize any responses.
  26.  
  27.                -AJS
  28.  
  29. I picked this perl script from net itself. If you have ONLY sun's , you may
  30. wanna use pagesize(1) rather than hard-coded value.
  31.  
  32. #!/usr/local/bin/perl
  33. #
  34. # I think for Sun-3's you divide by 128
  35. #
  36. $_ = `adb -k /vmunix /dev/mem </dev/null 2>&1`;
  37. if (/physmem\s+(.*)/) {
  38.     print "Physical memory is ", int(hex($1) / 256 + 1), " megs\n";
  39. }
  40. else {
  41.     die $_;
  42. }
  43.  
  44.  
  45. /Pradeep
  46. --
  47. ----------------------------------------------------------------------------
  48. Pradeep Chetal                                          Phone: 81-3-3286-9678
  49. Information Services Deptartment                          FAX: 81-3-3286-9040
  50. Morgan Stanley Japan Ltd.  Tokyo Branch            E-mail: chetal@is.morgan.com
  51.         Ote Center Bldg. 3F, 1-1-3 Otemachi, Chiyoda-ku, Tokyo 100
  52.