LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-19-2012, 07:22 AM   #1
Manjunath1847
Member
 
Registered: Mar 2007
Posts: 44

Rep: Reputation: 16
top command issue


Hi,

While debugging my linux application program, related to performance, sometimes I see top reporting huge value for %cpu usage. My system has 2 CPU. So I believe, what ever may be the application, %cpu utilization for any process can never go beyond 200% max. But when I run the top in batch mode and with 0 time gap on my application (i.e. top -b -d0 -p <app_pid>), I see at some point of time %cpu usage showing more than 1000 like 1657 or 1732. Can %cpu usage for an application can really go to such values or is it a top bug? Any ideas here.

Thanks in advance.

Regards,
Manjunath
 
Old 07-19-2012, 07:28 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,276

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
"-d0" makes no sense.
Garbage in, garbage out.
 
Old 07-20-2012, 12:08 AM   #3
Manjunath1847
Member
 
Registered: Mar 2007
Posts: 44

Original Poster
Rep: Reputation: 16
I suspect my application takes high CPU for very short interval of time - for less than 1 second. So I need to constantly monitor the %cpu usage of my process. If I give -d1, 1 second I believe is a big value, and I may miss the high cpu hit.
 
Old 07-20-2012, 01:36 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,276

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
You can use fractions of a second with the -d (0.2 say)
Or better try collectl which has a daemon option and should give you much better data. This mention will no doubt cause the developer to drop by and offer better advice.
 
Old 07-23-2012, 05:40 PM   #5
markseger
Member
 
Registered: Jul 2003
Posts: 241

Rep: Reputation: 25
syg00 loves to tickle me and once again has succeeded.
If you really want to take a real close look at a specific application, running collectl with --procfilt pointing you app is extremely efficient. while I haven't measured this in awhile, I'd bet you could sample every 0.01 second and not put much of a load on the system. you could also run as a daemon as suggested but at a monitoring interval with that sort of a frequency you will generate a lot of data.
-mark
 
  


Reply

Tags
cpuusage, performance, top


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
top command Volcano Linux - General 1 02-09-2012 07:13 AM
LXer: Can You Top This? 15 Practical Linux Top Command Examples LXer Syndicated Linux News 0 01-09-2010 09:42 PM
Finding the top CPU-using processes? "top" command does not help... catalytical Linux - Server 1 04-06-2009 04:50 PM
Performance issue - finding top process DotHQ Linux - General 2 07-26-2007 07:49 PM
Odd issue involving top.... Basslord1124 Slackware 5 01-09-2007 03:56 PM


All times are GMT -5. The time now is 05:25 PM.

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