home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp
- Path: sparky!uunet!psgrain!onion!pail!servio!chrisp
- From: chrisp@slc.com (Chris Pinkham)
- Subject: Re: How do I find out how much RAM and swap my 720 has?
- Message-ID: <1992Jul30.150706.4746@slc.com>
- Organization: Servio Corp, Beaverton Oregon, US
- References: <1992Jul14.184539.2198@nsisrv.gsfc.nasa.gov> <28510293@hpuamsa.neth.hp.com>
- Date: Thu, 30 Jul 1992 15:07:06 GMT
- Lines: 40
-
- I don't have the original request in front of me, but the following
- should provide more accessible information about physical memory. Swap
- info is available in swapinfo(1M) (gosh!), if you have 8.07.
-
-
- /*
- * Fetch and print static system information.
- */
-
- #include <stdio.h>
- #include <errno.h>
- #include <sys/pstat.h>
-
- void printstatic(pstatic)
- struct pst_static pstatic;
- {
- /* A pretty random selection of variables. Add whatever interests you
- (see <sys/pstat.h> for details) */
-
- printf("boot time: %s", ctime(&pstatic.boot_time));
- printf("physical memory (bytes): %d\n", pstatic.physical_memory * pstatic.page_size);
- printf("page size (bytes): %d\n", pstatic.page_size);
- }
-
- main() {
- struct pst_static pstatic;
- union pstun pst;
- int status;
-
- /* Suck out static information */
-
- pst.pst_static = &pstatic;
- if ((status = pstat(PSTAT_STATIC, pst, sizeof(pstatic), 0, 0)) == -1) {
- perror("pstat");
- exit(1);
- }
- /* And print some of it */
-
- printstatic(pstatic);
- }
-