Linux has a (modular) file system interface for extracting such data from the kernel, so it can be used in almost any language or scripting tool.
Memory can be complicated. There the program executable itself, presumably mmap () 'ed in. Shared libraries Using the stack. Using heap. Parts of software located in RAM. The portions have changed. Etc.
What is PeakWorkingSetSize? This sounds like the maximum resident set size (the maximum raw RAM with physical memory used by the process).
Although this can also be the total amount of virtual memory of the entire process (the sum for the parts in RAM and SWAPPED-out).
To no avail, on Linux, you can strace a process to see its kernel-level interactions. "ps" gets its data from the files / proc / $ {PID} / *.
I suggest you cat / proc / $ {PID} / status . The Vm * lines are quite useful.
In particular: VmData refers to the use of a process heap. VmStk refers to the use of the process stack.
If you continue to use "ps", you can consider popen () .
I have no idea to get the free memory of the whole system.
Always / usr / bin / free
Please note that Linux will use unused memory for file buffering and caching ... Thus, the line is +/- buffers / cache .
Mr.Ree Nov 05 '09 at 3:18 2009-11-05 03:18
source share