find page size and number of pages of a process in linux

Pagesize is system wide and can be found with the getconf command

getconf PAGESIZE

The mem_usage.py tool can provide some more detailed information on a processes memory usage.


Depending on how verbose the information you want should be, you want one of the following:

  • /proc/pid/statm: Provides information about memory usage, measured in pages.
  • /proc/pid/status: Provides much of the information from /proc/pid/statm, but is easier to read.

Check out the man-page for the proc-files for thorough documentation of what the different columns mean.

  • http://linux.die.net/man/5/proc

The number of pages it is using

awk '{ print $24 }' /proc/[pid]/stat

or:

awk '{ print $2 }' /proc/[pid]/statm

According to the man proc, it is the number of pages the process has in real memory. Also take a look at the procstat.c to display proc stat in human readable format.