Reputation: 21
I am trying to obtain the memory working set value for a given PID in my C++ application running on LINUX. In Windows I can get this info using GetProcessWorkingSetSize
function. Is there anything like this function I can call in LINUX?
Upvotes: 2
Views: 1783
Reputation: 19296
The only sensible solution that comes to mind is accessing the relevant information via the /proc
filesystem. It seems weird that a process would have to read out its own information from /proc
, though, but I don't know about any other system calls that might make this easier.
The information you're probably most interested in is located in /proc/[pid]/statm
, which includes :
Keep in mind that all those measurements are given in the number of pages.
Upvotes: 1