On Sun, Feb 17, 2002, Dan Kenigsberg wrote about "how to measure process memory 
usage?":
> Is there a utility to measure memory usage of a process, preferably proken into
> static/stack/heap? The man page of GNU `time' suggests that it should do the
> trick, but running
>       /usr/bin/time myprog
> always reports 0 memory usage.
> 
> And another question - is there a portable way of doing it using system calls?

getrusage(2) was supposed to do that. Unfortunately, in Linux the memory
measurements parts don't seem to be supported (see the NOTE in the manual),
which is why time(1) also doesn't know how to measure it.

You can try running ps (or looking in /proc/<processid>/status, and other
similar files) while the process is running. Does anyone know of a better way?

P.S. Since memory consumption can change (grow or decrease) during a run,
it is not even obvious that something like getrusage(2) for memory consumption
can return any useful answer for a process that exited - which is perhaps
why it was never implemented in Linux.

-- 
Nadav Har'El                        |         Sunday, Feb 17 2002, 5 Adar 5762
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |I want to be a human being, not a human
http://nadav.harel.org.il           |doing -- Scatman John

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to