memftprt

memftprt: memory footprint measurement tool for any process in execution or suspended mode.

Notes:
This paper written by Bob Matthews and Norm Murray (RedHat kernel group) explains virtual memory behavior of the Red Hat Linux Advanced Server 2.1 kernel, but it’s a good reference for internals of the VM system in newer distributions of Linux.

BrandonLive (?) from the Microsoft Windows team gives a high level description of what “Task Manager” reports as Free, Available, Cached, Total and Commit , Lubos Lunak has a write-up on reading memory usage numbers on Linux …

What is memftprt?

At its core, memftprt is a memory footprint measurement tool. It is useful for examining the various memory statistics for a process as described by the OS. It can answer questions like how large is the resident set? what is the private set of the process? The most common usage is in the context of a virtualized environment (e.g. Cloud) where optimization for space (i.e. footprint) and time (i.e. throughput or response time) is critical for determining the price/performance of operations. An example: A devops asks what are the optimal sizing params for an application running on one or more JEE Application Server instances (e.g. Websphere, Glassfish) in a fail-over configuration?

Measurement is taken at a specified point during which the process is either in run or suspended mode. For .NET and Java applications, memftprt can measure actual memory footprint and what a user would be perceive as memory footprint as measured by tools like top.

memftprt takes the pid of the process to measure, waits for the specified amount of time (-t) and takes the measurements (statm, ps, top) and outputs the summarized results to console. A set of log files are also generated during the measurements. It’s important to note that due to elements such as timing, kernel thread scheduling and others, the results may be not be accurate. The recommended approach is to make sure that the measurements are taken on a machine that was freshly booted and that no other (user) process (other that the one being measured) is running at the time of measurement. It’s also recommended to perform a few measurements to ascertain a level of (statistical) confidence in the results (e.g. no outliers)

Download Version 1.39 for x64 systems – Linux here.
Download Version 1.01 for x64 systems – Windows coming soon….

Sample output

[root@ip-10-38-129-46 linux-amd64]# ./memftprt

memftprt : process memory footprint measurement tool
Usage: footprint -s -p

-s : wait for seconds before taking measurement
-p : pid of the process

[root@ip-10-38-129-46 linux-amd64]# ./footprint -t 1 -p 3087
The page size 4 KB
VmPTE: Page table entries size 5660 KB
VmHWM: Peak RSS – HWM 2744984 KB
VmSize: Virtual memory size 4997180 KB
VmExe: Size of text segments 4 KB
VmStk: Size of stack 88 KB
VmData: Size of data 4862344 KB
VmPeak: Peak VM size 4997180 KB
VmLib: Shared library code size 12856 KB
VmLck: Locked memory size 0 KB
Total program size – statm 1249295 Pages
Library – statm 0 Pages
Text code – statm 1 Pages
Resident set size – statm 686246 Pages
Dirty pages – statm 0 Pages
Data/Stack – statm 1215608 Pages
Shared pages – statm 2245 Pages
Number of pages swapped 0 Pages
Current limit on the RSS 4294967295 KB
RSS – /proc/pid/stat 2744984 KB
RSS – /proc/pid/stat 686246 Pages
VSize – ps 4997180 KB
Major Faults – ps 0 Faults
Minor Faults – ps 718886 Faults
RSS – ps 2744984 KB
Share – top 8980 KB

[root@ip-10-38-129-46 linux-amd64]# ./memftprt -t 2 -p 3087
The page size 4 KB
VmPTE: Page table entries size 6500 KB
VmHWM: Peak RSS – HWM 3173876 KB
VmSize: Virtual memory size 4997180 KB
VmExe: Size of text segments 4 KB
VmStk: Size of stack 88 KB
VmData: Size of data 4862344 KB
VmPeak: Peak VM size 4997180 KB
VmLib: Shared library code size 12856 KB
VmLck: Locked memory size 0 KB
Total program size – statm 1249295 Pages
Library – statm 0 Pages
Text code – statm 1 Pages
Resident set size – statm 793469 Pages
Dirty pages – statm 0 Pages
Data/Stack – statm 1215608 Pages
Shared pages – statm 2245 Pages
Number of pages swapped 0 Pages
Current limit on the RSS 4294967295 KB
RSS – /proc/pid/stat 3173876 KB
RSS – /proc/pid/stat 793469 Pages
VSize – ps 4997180 KB
Major Faults – ps 0 Faults
Minor Faults – ps 835704 Faults
RSS – ps 3173876 KB
Share – top 8980 KB

[root@ip-10-38-129-46 linux-amd64]# ./memftprt -t 10 -p 3087
The page size 4 KB
VmPTE: Page table entries size 7824 KB
VmHWM: Peak RSS – HWM 3853196 KB
VmSize: Virtual memory size 4997180 KB
VmExe: Size of text segments 4 KB
VmStk: Size of stack 88 KB
VmData: Size of data 4862344 KB
VmPeak: Peak VM size 4997180 KB
VmLib: Shared library code size 12856 KB
VmLck: Locked memory size 0 KB
Total program size – statm 1249295 Pages
Library – statm 0 Pages
Text code – statm 1 Pages
Resident set size – statm 963299 Pages
Dirty pages – statm 0 Pages
Data/Stack – statm 1215608 Pages
Shared pages – statm 2245 Pages
Number of pages swapped 0 Pages
Current limit on the RSS 4294967295 KB
RSS – /proc/pid/stat 3853196 KB
RSS – /proc/pid/stat 963299 Pages
VSize – ps 4997180 KB
Major Faults – ps 0 Faults
Minor Faults – ps 1014822 Faults
RSS – ps 3853196 KB
Share – top 8980 KB

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>