LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-30-2007, 06:00 AM   #1
DaneelGiskard
LQ Newbie
 
Registered: Apr 2007
Posts: 24

Rep: Reputation: 15
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
 
Old 08-30-2007, 06:11 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,127

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
/proc the data you need - top is a handy way of getting the math done.
smaps is useful for memory - still requires some interpretation.
 
Old 08-30-2007, 10:53 AM   #3
DaneelGiskard
LQ Newbie
 
Registered: Apr 2007
Posts: 24

Original Poster
Rep: Reputation: 15
Hi!

Many thanks for the reply!

Quote:
Originally Posted by syg00 View Post
/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
 
Old 08-30-2007, 11:43 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,127

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


Reply


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
Generate alert with "CPU load average" "CPU utilization" viky Linux - Hardware 3 07-25-2007 04:24 AM
Alert used "cpu load" and "cpu utilization" viky General 0 07-23-2007 03:19 AM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
User "list" running process "python" TroelsSmit Linux - Newbie 2 02-22-2005 04:55 AM
"User" & "System" CPU load difference JJX Linux - General 3 06-06-2004 01:42 AM


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

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