How to determine private and shared RSS memory usage?

I'm still pretty new to FreeBSD, so this may be a really noobish question. I would like to display the private memory and shared memory usage of a process. So basically the private part of RSS and the shared part of RSS separately.

On Linux one can use tools like ksysguard, which display both private and shared memory. Ksysguard uses /proc/$pid/smaps on Linux to determine private and shared memory usage separately. Unfortunately, ksysguard on FreeBSD only displays RSS memory and the detailed memory view is not available. I tried a few other tools, e.g. the xfce task manager and procstat, but it seems like they only show RSS. Just to clarify, I am not talking about retrieving PSS memory (proportional share size), which divides the shared RSS part by the number of processes sharing and adds that onto the private RSS private RSS + (shared RSS / number of processes sharing it).

The reason why RSS is inadequate for my use case, is because I would like to determine and optimize the memory usage of programs that I write. Shared memory can be (to a large part) ignored for software development, as other programs are able to utilize the shared memory. Shared memory only really matters if your program is the only one using the shared memory, which is generally not a problem on Unix-like systems. Private RSS memory is really the important part here, as it really determines how efficient your program is.

For example, a program with an RSS of 100MiB is not equal to another program with an RSS of 100MiB. The first program could share 99MiB while the second one only shares 5MiB.

Is there a tool on FreeBSD that can display both the private and shared part of RSS separately?
 
Back
Top