Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 08-29-2008, 06:34 AM   #1
Registered: May 2008
Posts: 41

Rep: Reputation: 15
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
Old 08-30-2008, 02:39 AM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,246

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitoring process CPU and Memory usage jdt05 Programming 5 05-02-2008 08:10 AM
tool to measure cpu/memory usage by a process saritha Linux - Software 1 10-08-2007 06:16 AM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
limiting cpu and memory usage by user process amitkush Linux - Security 2 07-04-2003 12:21 AM

All times are GMT -5. The time now is 09:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration