home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / admin / 6286 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.2 KB  |  73 lines

  1. Newsgroups: comp.unix.admin
  2. Path: sparky!uunet!mcsun!dxcern!dxcern!cons
  3. From: cons@mercury.cern.ch (Lionel Cons)
  4. Subject: Re: RAM size
  5. In-Reply-To: karl@thuja.gsfc.nasa.gov's message of Thu, 19 Nov 1992 19:19:56 GMT
  6. Message-ID: <CONS.92Nov20095918@mercury.cern.ch>
  7. Sender: news@dxcern.cern.ch (USENET News System)
  8. Organization: CERN, European Research Center for Particle Physics
  9. References: <MENJAN.92Nov17221015@ra.cs.umb.edu> <1992Nov19.140503.13218@tinman.mke.ab.com>
  10.     <1992Nov19.191956.2748@nsisrv.gsfc.nasa.gov>
  11. Distribution: comp
  12. Date: Fri, 20 Nov 1992 08:59:18 GMT
  13. Lines: 58
  14.  
  15. >>>>> On Thu, 19 Nov 1992 19:19:56 GMT, karl@thuja.gsfc.nasa.gov (Karl A. Anderson) said:
  16.  
  17. In article <1992Nov19.140503.13218@tinman.mke.ab.com>, tdphette@mke.ab.com (Thad Phetteplace x4461) writes:
  18.  
  19. > |> menjan@cs.umb.edu (Men-Jan Lin) writes: 
  20. > |> : 
  21. > |> : How can I know the RAM size of my Sun and HP workstation ?  
  22. > |> : (not reboot) 
  23. > |> : Thanks.  
  24. > |> : 
  25. > |> : -Jane 
  26. > |> 
  27. > |> On a Sun you can run the dmesg command and print the messages from the 
  28. > |> last boot. The RAM size should be in there.  Pipe it to 'grep mem' to 
  29. > |> filter out other messages...  
  30. > |> 
  31. > |> dmesg | grep mem 
  32. > |> 
  33. > |> That should do it.  I don't know if you can do the same on an HP.  
  34. > |>
  35. > Dmesg also works on an HP, but you have to be super-user.  Also, on
  36. > a Sun you can use devinfo(8).  Here's a script somebody posted a
  37. > while ago:
  38. >  ...
  39. >
  40.  
  41. Here is the script I use on an HP (don't have to be run by root):
  42.  
  43. #!/bin/sh
  44.  
  45. tmp=/tmp/tmp.$$
  46. cat << _EOF_ >$tmp.c
  47. #include <stdio.h>
  48. #include <sys/pstat.h>
  49. main() {
  50.    struct pst_static pstatic;
  51.    union pstun pst;
  52.    pst.pst_static = &pstatic;
  53.    if (pstat(PSTAT_STATIC, pst, sizeof(pstatic), 0, 0) < 0)
  54.       printf("unknown\n");
  55.    else
  56.       printf("%d\n", pstatic.physical_memory * pstatic.page_size/1024/1024);
  57. }
  58. _EOF_
  59. cc -o $tmp $tmp.c
  60. memory=`$tmp`
  61. rm -f $tmp $tmp.c
  62. echo "$memory MB"
  63. --
  64.  
  65. Lionel Cons
  66.  
  67. +------- CERN - European Laboratory for Particle Physics -------+
  68. | E-mail: cons@dxcern.cern.ch                                   |
  69. | Earth-mail: CN/SW/WS, CERN, CH-1211 GENEVE 23, Switzerland    |
  70. | Phone: +41 22 767 49 13              Fax: +41 22 767 71 55    |
  71. +---------------------------------------------------------------+
  72.