LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-20-2005, 04:43 AM   #1
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
CPU load high, top processes very low?


hiho@ll

i programmed my own reporting client/server which reports host load

it ran last night, very well, but i don't understand this:

the logging intervall is every 30 seconds
i log the cpu load using /proc/stat
and i log the top 3 processes using top

my problem now is
i got some very high cpu load spikes over a half an hour
but the top processes were as low as ever!?

is it possible, that the /proc/stat cpu load is high but, top reports nearly sleeping processes?
maybe /proc/stat is a relative

for top i'm using the command
top -n 1 -b

what also could be a problem is that top influences it's own statistics
which means
if i run top -n 1 -b and the cpu is idle, the top process will consum high cpu time

which could also influence my measures

anybody knows an alternative to top?
can i read in /proc which processes consume most cpu?

thx@ll
 
Old 04-20-2005, 05:11 AM   #2
Geronimo
Member
 
Registered: Aug 2004
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 52

Rep: Reputation: 15
try runnig `top`... And have a look at the top entries - i.e. the ones that use most CPU time. hit 'q' to quit!

Hope it helped

Greets
G.
 
Old 04-20-2005, 09:05 AM   #3
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Original Poster
Rep: Reputation: 30
well

as i posted i'm using the "top" command

and my question is:
is it possible, that cpu load is very high, but "top" reports just 3.8% cpu for the process "top" and every other process is nearly 0.0%?

thx
 
Old 05-24-2005, 12:49 PM   #4
Gamezace
Member
 
Registered: Apr 2004
Location: NOVA, VT
Distribution: gentoo
Posts: 88

Rep: Reputation: 15
I just had a very similiar problem - and so I ran gkrellm juxtaposed to a terminal running 'top' and found interesting results.

gkrellm was reporting my CPU load abot 50% constantly, whereas top was no where about 18% most of the time...not really sure what is causing that.
 
Old 06-03-2005, 01:37 PM   #5
Gamezace
Member
 
Registered: Apr 2004
Location: NOVA, VT
Distribution: gentoo
Posts: 88

Rep: Reputation: 15
Well, I solved the problem on my machine. As it turns out, the problem was transparency. I had all my terminals set to transparent backgrounds - and I guess this old company machine doesn't have enough power to handle that.

Maybe this will help you,
 
Old 03-15-2007, 01:48 PM   #6
sahithi
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
my problem is a bit different

top shows a process taking 98% of CPU time

but

cat /proc/stat gives the idle jiffy time a constant value which does not decrease..

is something wrong with /proc/stat or is top showing it wrong?

what command exactly shows the cpu stats ?
 
Old 03-15-2007, 09:45 PM   #7
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
well just basically you got to dig.
all the stats in /poc got limitations thats for sure, or they would have to spend lots of time doing /proc junk instead of writing system code.


its very confusing when you say tranperance fixed BUT X was not showing up as the culprit.
see X has the video card memory and what not to deal with
perhaps it would help also to turn down RT tick frequencies ? do you interupt frequencies turnrd way up ?

i killed a P4 like that once faster than you can say, "why does my system keep freezing up"

Last edited by studioj; 03-15-2007 at 09:46 PM.
 
Old 03-15-2007, 10:23 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,086

Rep: Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905
Edit: D'oh - didn't realize I responded to such an old post.
Deleted.

Last edited by syg00; 03-15-2007 at 11:36 PM.
 
Old 03-16-2007, 04:03 AM   #9
edenCC
Member
 
Registered: May 2006
Location: Gz,China
Distribution: RH,FB
Posts: 198
Blog Entries: 1

Rep: Reputation: 32
top is not so good for your detection, and using ps will be much better.

example:
top 3 cpu consumption
ps -auxf | sort -nr -k 3 | head -3
top 3 mem consumption
ps -auxf | sort -nr -k 4 | head -3
 
Old 03-16-2007, 04:49 AM   #10
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
Subtract top's cpu idle time (%id) from 100% and you'll see it's the same number gkrellm is reporting. I think they're both getting that info from vmstat anyway.

Code:
[climber@lode ~]$ top

top - 05:33:19 up 16 days, 13:48,  2 users,  load average: 0.09, 0.20, 0.18
Tasks: 141 total,   2 running, 139 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.3%hi,  0.0%si,  0.0%st
Mem:    954560k total,   902380k used,    52180k free,   196300k buffers
Swap:  4192924k total,    38984k used,  4153940k free,   355816k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
27584 root      16   0 12708 1076  792 S  0.3  0.1   0:00.27 top                
    1 root      15   0 10304  568  540 S  0.0  0.1   0:00.73 init               
    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0        
    3 root      34  19     0    0    0 S  0.0  0.0   0:10.10 ksoftirqd/0        
    4 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0         
    5 root      10  -5     0    0    0 S  0.0  0.0   0:18.86 events/0           
    6 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 khelper            
    7 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 kthread            
    9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 xenwatch           
   10 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 xenbus             
   49 root      10  -5     0    0    0 S  0.0  0.0   0:00.05 kblockd/0          
   50 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid             
  169 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0           
  171 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 ksuspend_usbd      
  174 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khubd              
  176 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kseriod            
  198 root      15   0     0    0    0 S  0.0  0.0   0:00.16 pdflush            
[climber@lode ~]$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0  38984  44296 196536 356332    0    0     2     6    3   29  4  2 93  0  0
And from vmstat's man page FWIW:
Code:
   CPU
       These are percentages of total CPU time.
       us: Time spent running non-kernel code. (user time, including nice time)
       sy: Time spent running kernel code. (system time)
       id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
       wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
       st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
 
Old 03-18-2007, 05:31 PM   #11
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Original Poster
Rep: Reputation: 30
@sahithi
the values in /proc/stat don't decrease
see: http://www.linuxhowtos.org/System/procstat.htm

as the link describes the values in /proc/stat identify the amount of time (that's why it doesn't decrease, cause time continues ) the cpu has spent in what kind of "work"

for example, the first /proc/stat line shows like this at t0
cpu user nice system idle iowait irq softirq (dont know)
cpu 736324 49874 581102 298162832 3012015 120311 0 0
a few seconds later (t1):
cpu 736334 49874 581102 298162971 3012015 120311 0 0
differences:
cpu 10 0 0 139 0 0 0 0
all numbers together at t0 are: 302662458
a few seconds later (t1): 302662607
difference (t1-t0): 149

the difference 149 is 100% cpu time
so it seems the cpu has spent 93.28% (139 time unit's (seems to be USER_HZ)) in cpu idle
and 6.72% in user mode

i think the problem with top is that top causes cpu load too, which tapmers the cpu values

hope this helps
 
Old 03-19-2007, 12:07 AM   #12
sahithi
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
@Thinking

Ha..

"Aggregation " is what I missed in my interpretation.

Thanks a lot..

 
Old 03-19-2007, 12:59 AM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,086

Rep: Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905Reputation: 2905
Quote:
Originally Posted by Thinking
i think the problem with top is that top causes cpu load too, which tapmers the cpu values
Mmmm - see this discussion on the observer effect.
At the default 3 second interval, I would say top is the lightest of the samplers - they all probe /proc after all.
 
  


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
dm-crypt and high cpu load(pdflush) tazdevil77 Slackware 2 12-25-2004 02:03 PM
High load - but CPU 99% idle? Boss Hoss Linux - Hardware 6 05-24-2004 04:39 AM
High idle cpu load in 2.6.4? geekzen Linux - General 4 04-10-2004 11:54 AM
Why am I getting ?high? CPU load? pnh73 Linux - General 15 10-21-2003 10:36 AM
Help! very high CPU load by squid cash_05 Linux - Networking 0 10-08-2003 07:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration