I cannot find a source of total physical memory usage for all userspace processes on Linux.
I want to measure a memory usage of a complex application, which consists of many sub-applications (many processes and RDBMS). I’d like to record the development of memory usage of all processes in current Linux OS instance during the application runtime. I am interested in physical or if not possible in resident memory consumption (RSS in top or PSS - PrivateRSS + SharedRSS/number of processes). There is no other application or processes running on the host (their memory usage is negligible).
Differently from other similar questions, the answer may be derived from the additional information that Linux guest is running inside of a VMWare container (this can be used to obtain the memory statistics).
It is not possible to enumerate all application processes, because there too many of them and their lifetime sometimes is very short.
Ideally, I want to get peak memory usage directly, without sampling, since I afraid to miss the peak.
My first guess is to take /proc/meminfo and use
MemTotal – MemFree = CurrentMemoryUsage, but I also afraid that it is incorrect, because the memory can be also claimed by Linux kernel, e.g. for file caching, and will also be recorded as used memory. This method is also not accurate in estimating the peak memory usage.
Using time or /proc//smaps is not possible, because there are too many independent processes in the application and they runtime can be very short.