LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (http://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How to calculate cpu and memory usage of a process (http://www.linuxquestions.org/questions/ubuntu-63/how-to-calculate-cpu-and-memory-usage-of-a-process-666270/)

narendra1310 08-29-2008 06:34 AM

How to calculate cpu and memory usage of a process
 
hi all,

I wrote a script through which i will findout cpu and mem of a process using ps command . But i want to know how to find cpu and mem of a procces which have multiple instances (i.e. if a process get forked in parent process , now we need to find usage of both rather than parent process alone, because if child process comsume some qntity of cpu and not by parent process then we will get erronous results)

so let me know the script or command line to find cpu and mem usage of all instances of a process.

thank you

syg00 08-30-2008 02:39 AM

Forking will generate a new pid - simple enough to track similarly to what you have already done.
"ps" allows many options in how to request output - by UID, euid, command ... see the manpage.


All times are GMT -5. The time now is 04:30 AM.