home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / hp / 8727 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.4 KB  |  51 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!psgrain!onion!pail!servio!chrisp
  3. From: chrisp@slc.com (Chris Pinkham)
  4. Subject: Re: How do I find out how much RAM and swap my 720 has?
  5. Message-ID: <1992Jul30.150706.4746@slc.com>
  6. Organization: Servio Corp, Beaverton Oregon, US
  7. References: <1992Jul14.184539.2198@nsisrv.gsfc.nasa.gov> <28510293@hpuamsa.neth.hp.com>
  8. Date: Thu, 30 Jul 1992 15:07:06 GMT
  9. Lines: 40
  10.  
  11. I don't have the original request in front of me, but the following
  12. should provide more accessible information about physical memory. Swap
  13. info is available in swapinfo(1M) (gosh!), if you have 8.07.
  14.  
  15.  
  16. /*
  17.  * Fetch and print static system information. 
  18.  */
  19.  
  20. #include <stdio.h>
  21. #include <errno.h>
  22. #include <sys/pstat.h>
  23.  
  24. void printstatic(pstatic)
  25. struct pst_static pstatic;
  26. {
  27.    /* A pretty random selection of variables. Add whatever interests you 
  28.       (see <sys/pstat.h> for details) */
  29.  
  30.    printf("boot time: %s", ctime(&pstatic.boot_time));
  31.    printf("physical memory (bytes): %d\n", pstatic.physical_memory * pstatic.page_size);
  32.    printf("page size (bytes): %d\n", pstatic.page_size);
  33. }
  34.  
  35. main() {
  36.    struct pst_static pstatic;
  37.    union pstun pst;
  38.    int status;
  39.  
  40.    /* Suck out static information */
  41.  
  42.    pst.pst_static = &pstatic;
  43.    if ((status = pstat(PSTAT_STATIC, pst, sizeof(pstatic), 0, 0)) == -1) {
  44.       perror("pstat");
  45.       exit(1);
  46.    }
  47.    /* And print some of it */
  48.  
  49.    printstatic(pstatic);
  50. }
  51.