LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Measure "CPU load" and "memory consumption" of a process (http://www.linuxquestions.org/questions/programming-9/measure-cpu-load-and-memory-consumption-of-a-process-580919/)

DaneelGiskard 08-30-2007 06:00 AM

Measure "CPU load" and "memory consumption" of a process
 
Hi all,

I have to accurately measure the CPU load and the memory consumption of a specific process. So far I have been using 'top' and 'ps' for this task, but I wonder if there is a better way to do it.

Ideally I would like to call something like
measure <myExecutable>
with measure outputting the CPU load and memory consumption over the runtime of <myExecutable> to a log file.

Is there such a program? What do you use for your measurements?

Many thanks,
Michael

syg00 08-30-2007 06:11 AM

/proc the data you need - top is a handy way of getting the math done.
smaps is useful for memory - still requires some interpretation.

DaneelGiskard 08-30-2007 10:53 AM

Hi!

Many thanks for the reply!

Quote:

Originally Posted by syg00 (Post 2875519)
/proc the data you need - top is a handy way of getting the math done.
smaps is useful for memory - still requires some interpretation.

Can you maybe elaborate a bit (or point me to additional resources) about what you mean by "/proc the data". I know the proc file system and I know that the kernel fills the "files" there with specific information. But that is about as much as I know about it.

It would be great if you could give me some additional help in that direction.

Many thanks,
Michael

syg00 08-30-2007 11:43 AM

D'oh; that should have been "/proc has the data you need"
Lots of info on the web - perhaps start with"man proc".


All times are GMT -5. The time now is 03:32 AM.