[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting the memory used by a process



Mathieu Malaterre:
> 
>   I am trying to find out the memory used by a process (peak memory
> actually). I found the command 'pmap', howeverI cannot find a way to
> retrieve the PID of a process when execution time is really short. For
> instance, this does not work:
> 
> /bin/ls && (ps ax | grep ls)

This only starts ps | grep after ls has (successfully) finished. You
would need to use '&' instead of '&&', but that still doesn't guarantee
that ls is still running when ps collects process information. I don't
think there is any way to do that reliably. But on the other hand I
don't think memory usage for such a short-lived process is interesting
anyway.

However, instead of ps | grep I usually use pgrep.

J.
-- 
I am worried that my dreams pale in comparison beside TV docu-soaps.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: