Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.sys.hp.hpux FAQ
Section - 8.32 How can I determine how much RAM my system has?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Houses ]


Top Document: comp.sys.hp.hpux FAQ
Previous Document: 8.31 What OS capacity limits exist?
Next Document: 8.33 What are the various revisions of PA-RISC?
See reader questions & answers on this topic! - Help others by sharing your knowledge

From SAM
========
1) goto Performance Monitors -> System Properties -> Memory
2) check Clock Frequency: value

From the command-line
=====================
If you are root, you can use adb to query the kernel:

  # echo "memory_installed_in_machine/D" | adb -k /stand/vmunix /dev/mem | \
    tail -1 | awk '$2 > 0 { print $2 / 256 }'

Or if /etc/dmesg is still current, you can grep it:

  $ /etc/dmesg | grep "real mem" | tail -1 | \
    awk '$4 > 0 { print $4 / 1048576 }'

A few more methods that can be used (as root only):

o As of 10.x, the following SAM command will show memory in MB:
    # /usr/sam/lbin/getmem
  However, getmem reportedly does not work on systems with >512 MB of RAM,
  and it is not supported by HP.

o It's painfully slow, but the following cute method will also give the
  total MB:
    # expr `wc -c /dev/mem | cut -d' ' -f1` / 1048576

o The following creative method suggested by Siem Korteweg
  <siem@xs4all.nl> prints the size in MB but works only on 10.x:
    # dd if=/dev/mem of=/dev/null bs=1024k 2>&1 | grep in | cut -d+ -f1

Programmatically
================
Here is a short program that will print the system's RAM size (can be run
by any user):

/*  mem.c - To compile: cc +DAportable -o mem mem.c  */
#include <errno.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/pstat.h>
#define BYTES_PER_MB 1048576
main()
{
  struct pst_static pst;
  union pstun pu;

  pu.pst_static = &pst;
  if ( pstat( PSTAT_STATIC, pu, (size_t)sizeof(pst), (size_t)0, 0 ) != -1 ) {
    printf( "Physical RAM = %ld MB\n",
      (long)( (double)pst.physical_memory * pst.page_size / BYTES_PER_MB ) );
    exit( 0 );
  } else {
    perror("pstat_getstatic");
    exit( errno );
  }
}

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.sys.hp.hpux FAQ
Previous Document: 8.31 What OS capacity limits exist?
Next Document: 8.33 What are the various revisions of PA-RISC?

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
hpux.faq@gmail.com





Last Update March 27 2014 @ 02:11 PM