time command includes a format parameter "M", which according to the
time man page on Linux is used for the following:
Maximum resident set size of the process during its lifetime, in Kilobytes.
However, it does not look like
time is able to measure the maximum virtual set size of a process during its lifetime. How can I achieve this on Linux?
Just to be clear, I have control over the processes being profiled, so if I need to make this child process emit a signal at the end of its execution that indicates it is ready to terminate, so that the parent process can read its VSZ via
pmap, and then have the parent process explicitly terminate the child after the memory has been read, I can do it, but it would be painful, so I was hoping there might be a simpler solution that did not involve instrumenting the code of the program being profiled - something like a drop-in equivalent for
time that can also measure maximum virtual set size would be ideal. I can write a custom C program to launch the child process, though, if need be. However, if I were to go the C route, I'm not sure what system calls I would use to enable kernel tracing of VSZ in the child process.
Any guidance would be appreciated.
EDIT: This turns out to be nontrivial. Possible solutions here: http://stackoverflow.com/questions/774556/peak-memory-usage-of-a-linux-unix-process/10957355#10957355